/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
    --primary:       #2563EB;
    --primary-dark:  #1D4ED8;
    --primary-light: #EFF6FF;
    --success:       #16A34A;
    --danger:        #DC2626;
    --danger-light:  #FEF2F2;
    --warning:       #D97706;
    --warning-light: #FFFBEB;
    --wp-color:      #21759B;
    --php-color:     #7C3AED;
    --gray-50:       #F9FAFB;
    --gray-100:      #F3F4F6;
    --gray-200:      #E5E7EB;
    --gray-300:      #D1D5DB;
    --gray-400:      #9CA3AF;
    --gray-500:      #6B7280;
    --gray-600:      #4B5563;
    --gray-700:      #374151;
    --gray-900:      #111827;
    --radius:        .75rem;
    --radius-sm:     .375rem;
    --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:     0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--gray-100); color: var(--gray-900); line-height: 1.5; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%); }
.login-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2.5rem 2rem; width: 100%; max-width: 380px; }
.login-logo  { width: 56px; height: 56px; background: var(--primary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #fff; margin: 0 auto 1.25rem; }
.login-logo svg { width: 28px; height: 28px; }
.login-card h1 { text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.login-sub { text-align: center; color: var(--gray-500); font-size: .875rem; margin-bottom: 1.5rem; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 0 1.5rem; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.header-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.125rem; }
.header-icon  { width: 24px; height: 24px; color: var(--primary); }
.header-domain { color: var(--gray-400); font-weight: 400; font-size: .9rem; }
.header-actions { display: flex; align-items: center; gap: .5rem; }

/* ─── Main ───────────────────────────────────────────────────────────────── */
.main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* ─── Stats ──────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stat-value { font-size: 1.875rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-green { color: var(--success); }
.stat-gray  { color: var(--gray-400); }
.stat-blue  { color: var(--primary); }

/* ─── PHP bar ────────────────────────────────────────────────────────────── */
.php-bar { background: #fff; border-radius: var(--radius); padding: .625rem 1rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; display: flex; align-items: center; flex-wrap: wrap; gap: .375rem; }
.php-bar-label { color: var(--gray-500); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-right: .25rem; }
.php-badge { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: var(--gray-100); color: var(--gray-700); }
.php-badge-default { background: #EDE9FE; color: var(--php-color); }

/* ─── Grid projets ───────────────────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1rem; }

/* ─── Card projet ─────────────────────────────────────────────────────────── */
.project-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: box-shadow .15s; border: 1px solid var(--gray-200); }
.project-card:hover { box-shadow: var(--shadow-md); }
.card-inactive { opacity: .75; }

.card-header { padding: 1rem 1.25rem .75rem; border-bottom: 1px solid var(--gray-100); }
.card-title  { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-subdomain { font-weight: 700; font-size: 1.05rem; }
.card-domain    { color: var(--gray-400); font-size: .8rem; margin-top: .2rem; }

/* Meta ligne */
.card-meta { padding: .625rem 1.25rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; border-bottom: 1px solid var(--gray-100); }
.meta-item  { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--gray-500); }
.meta-item svg  { width: 14px; height: 14px; }
.meta-php-btn { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; color: var(--php-color); background: #EDE9FE; border: none; padding: .2rem .6rem; border-radius: 999px; transition: background .15s; cursor: pointer; }
.meta-php-btn:hover { background: #DDD6FE; }
.meta-php-btn svg { width: 12px; height: 12px; }
.meta-disk svg { width: 14px; height: 14px; }

/* ─── Section BDD ────────────────────────────────────────────────────────── */
.db-section { border-bottom: 1px solid var(--gray-100); }

.db-section-header {
    padding: .625rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    font-size: .82rem; font-weight: 600; color: var(--gray-700);
    cursor: pointer; user-select: none;
    transition: background .12s;
}
.db-section-header:hover { background: var(--gray-50); }
.db-section-header > span { display: flex; align-items: center; gap: .45rem; }
.db-section-header svg { width: 14px; height: 14px; color: var(--gray-500); }
.db-chevron { width: 14px !important; height: 14px !important; transition: transform .2s; }
.db-chevron.rotated { transform: rotate(180deg); }

.db-count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gray-100); color: var(--gray-600);
    font-size: .7rem; font-weight: 700; padding: .1rem .45rem;
    border-radius: 999px; min-width: 1.3rem;
}

.db-list { padding: .25rem .75rem .5rem; display: flex; flex-direction: column; gap: .25rem; }
.db-list.hidden { display: none; }

.db-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .4rem .5rem; border-radius: var(--radius-sm);
    background: var(--gray-50); gap: .5rem;
}
.db-row-main { background: var(--primary-light); }
.db-row-info { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; min-width: 0; flex: 1; }
.db-name  { font-family: monospace; font-size: .78rem; font-weight: 600; color: var(--gray-900); word-break: break-all; }
.db-label { font-size: .7rem; color: var(--gray-500); background: var(--gray-200); padding: .1rem .4rem; border-radius: 999px; }
.db-stats { font-size: .72rem; color: var(--gray-400); white-space: nowrap; }

.db-row-actions { display: flex; gap: .25rem; flex-shrink: 0; }

.db-add-btn {
    display: flex; align-items: center; gap: .4rem; justify-content: center;
    width: 100%; padding: .4rem; border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm); background: transparent; color: var(--gray-500);
    font-size: .8rem; cursor: pointer; transition: all .15s; margin-top: .25rem;
}
.db-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.db-add-btn svg { width: 13px; height: 13px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; letter-spacing: .03em; }
.badge-active   { background: #DCFCE7; color: #15803D; }
.badge-inactive { background: var(--gray-100); color: var(--gray-500); }
.badge-wp       { background: #DBEAFE; color: #1D4ED8; }

/* ─── Boutons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: .875rem; padding: .5rem 1rem; transition: background .15s, opacity .15s; cursor: pointer; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-50); }

.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #FECACA; }
.btn-danger:hover:not(:disabled) { background: #FEE2E2; }

.btn-wp { background: var(--wp-color); color: #fff; font-size: .8rem; padding: .35rem .75rem; }
.btn-wp:hover:not(:disabled) { background: #1a5e7d; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm   { font-size: .8rem; padding: .35rem .75rem; }
.btn-xs   { font-size: .73rem; padding: .2rem .4rem; border-radius: .25rem; }

/* ─── Card actions ───────────────────────────────────────────────────────── */
.card-actions { padding: .75rem 1.25rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: auto; }

/* ─── Formulaire ─────────────────────────────────────────────────────────── */
.field       { margin-bottom: 1rem; }
.field label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .375rem; color: var(--gray-700); }
.field input, .select {
    display: block; width: 100%; padding: .5rem .75rem;
    border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
    font-size: .9rem; background: #fff; transition: border-color .15s;
    color: var(--gray-900);
}
.field input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.input-group { display: flex; }
.input-group input { flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-suffix { display: flex; align-items: center; padding: 0 .75rem; border: 1px solid var(--gray-300); border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--gray-50); color: var(--gray-500); font-size: .875rem; white-space: nowrap; }

.field-hint { font-size: .78rem; color: var(--gray-500); margin-top: .3rem; }

.checkbox-label { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom { width: 18px; height: 18px; border: 2px solid var(--gray-300); border-radius: .25rem; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.checkbox-label input:checked ~ .checkbox-custom { background: var(--primary); border-color: var(--primary); }
.checkbox-label input:checked ~ .checkbox-custom::after { content: ''; width: 10px; height: 6px; border: 2px solid #fff; border-top: none; border-right: none; transform: rotate(-45deg); display: block; }

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; animation: modal-in .15s ease; overflow: hidden; }
@keyframes modal-in { from { opacity: 0; transform: scale(.97) translateY(-8px); } to { opacity: 1; transform: none; } }

.modal-header { padding: 1.25rem 1.5rem 1rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-200); }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--gray-400); font-size: 1.25rem; line-height: 1; padding: .25rem; border-radius: .25rem; transition: color .15s; }
.modal-close:hover { color: var(--gray-700); }

.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer { padding: .875rem 1.5rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* Spinner bouton */
.btn-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Résultat création ──────────────────────────────────────────────────── */
.result-grid { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; padding: 1.25rem 1.5rem; font-size: .875rem; }
.result-key { color: var(--gray-500); font-weight: 600; }
.result-val { font-family: monospace; word-break: break-all; }
.result-section { grid-column: 1 / -1; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); padding-top: .75rem; margin-top: .25rem; border-top: 1px solid var(--gray-100); }

/* ─── Alertes ────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; line-height: 1.4; }
.alert-error   { background: var(--danger-light); color: var(--danger); border: 1px solid #FECACA; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #FDE68A; }
.alert code { background: rgba(0,0,0,.08); padding: .1em .35em; border-radius: .25em; font-family: monospace; font-size: .9em; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; max-width: 320px; }
.toast-ok  { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.toast-err { background: var(--danger-light); color: var(--danger); border: 1px solid #FECACA; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--gray-500); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 1rem; display: block; color: var(--gray-300); }
.empty-state p { margin-bottom: 1.5rem; }

/* ─── User chip (header) ─────────────────────────────────────────────────── */
.user-chip { display: flex; align-items: center; gap: .4rem; padding: .25rem .6rem; background: var(--gray-100); border-radius: 999px; }
.user-chip-name { font-size: .8rem; font-weight: 600; color: var(--gray-700); }

.role-badge { font-size: .65rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.role-admin   { background: #FEF3C7; color: #92400E; }
.role-manager { background: #DBEAFE; color: #1E40AF; }
.role-viewer  { background: var(--gray-100); color: var(--gray-500); }

/* ─── Liste utilisateurs (modal) ─────────────────────────────────────────── */
.user-row { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.user-row:last-child { border-bottom: none; }
.user-row-name { font-weight: 600; font-size: .875rem; flex: 1; }
.user-row-info { font-size: .75rem; color: var(--gray-400); }
.user-row-actions { display: flex; gap: .3rem; }

/* ─── Section FTP ────────────────────────────────────────────────────────── */
.ftp-section { border-bottom: 1px solid var(--gray-100); }
.ftp-body { padding: .5rem .75rem .75rem; }
.ftp-loading { padding: .5rem; }

.ftp-status-badge { font-size: .68rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; }
.ftp-badge-on  { background: #DBEAFE; color: #1D4ED8; }
.ftp-badge-off { background: var(--gray-100); color: var(--gray-500); }

.ftp-creds { background: var(--gray-50); border-radius: var(--radius-sm); padding: .625rem .75rem; margin-bottom: .5rem; }
.ftp-cred-row { display: flex; align-items: center; gap: .5rem; font-size: .8rem; margin-bottom: .2rem; }
.ftp-cred-row:last-child { margin-bottom: 0; }
.ftp-cred-key { color: var(--gray-400); font-weight: 600; width: 5rem; flex-shrink: 0; }
.ftp-cred-val { font-family: monospace; font-size: .78rem; color: var(--gray-900); word-break: break-all; }

.ftp-dir-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.ftp-dir-row select { flex: 1; font-size: .8rem; padding: .3rem .5rem; }
.ftp-dir-row input  { flex: 1; font-size: .8rem; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); }
.ftp-actions { display: flex; gap: .375rem; flex-wrap: wrap; }

.ftp-account-card { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: .6rem .75rem; margin-bottom: .5rem; }
.ftp-acc-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.ftp-acc-title { font-size: .8rem; font-weight: 600; color: var(--gray-700); display: flex; align-items: center; gap: .4rem; }
.ftp-acc-label-tag { background: var(--primary-light); color: var(--primary); font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }
.ftp-acc-header-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.ftp-chdir-row { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.ftp-chdir-row select { flex: 1; font-size: .8rem; padding: .3rem .5rem; }
.ftp-add-form { border-top: 1px solid var(--gray-200); margin-top: .6rem; padding-top: .6rem; }
.ftp-add-title { font-size: .75rem; font-weight: 600; color: var(--gray-600); margin-bottom: .4rem; }
.ftp-add-inputs { display: flex; gap: .4rem; margin-bottom: .35rem; }
.ftp-label-input { flex: 0 0 140px; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .8rem; }

/* ─── Section Crons ──────────────────────────────────────────────────────── */
.cron-section { border-bottom: 1px solid var(--gray-100); }
.cron-body { padding: .5rem .75rem .75rem; }

.cron-badge { font-size: .68rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; }
.cron-badge-on  { background: #FEF3C7; color: #92400E; }
.cron-badge-off { background: var(--gray-100); color: var(--gray-500); }

.cron-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .5rem; }
.cron-row  { display: flex; align-items: center; gap: .5rem; background: var(--gray-50);
             border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: .4rem .6rem; }
.cron-row-info { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.cron-schedule { font-size: .75rem; font-weight: 700; color: var(--primary); background: var(--primary-light);
                 padding: .1rem .4rem; border-radius: var(--radius-sm); display: inline-block; }
.cron-desc { font-size: .75rem; font-weight: 600; color: var(--gray-700); }
.cron-cmd  { font-size: .72rem; color: var(--gray-500); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cron-toggle { position: relative; display: inline-block; width: 28px; height: 16px; flex-shrink: 0; }
.cron-toggle input { opacity: 0; width: 0; height: 0; }
.cron-toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 999px; cursor: pointer; transition: background .2s; }
.cron-toggle-slider::before { content: ''; position: absolute; width: 10px; height: 10px; left: 3px; top: 3px;
    background: white; border-radius: 50%; transition: transform .2s; }
.cron-toggle input:checked + .cron-toggle-slider { background: var(--success); }
.cron-toggle input:checked + .cron-toggle-slider::before { transform: translateX(12px); }

.cron-add-form  { border-top: 1px solid var(--gray-200); padding-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.cron-add-title { font-size: .75rem; font-weight: 600; color: var(--gray-600); }
.cron-add-row   { display: flex; gap: .4rem; }
.cron-custom-row { display: flex; align-items: center; gap: .4rem; }
.cron-input-desc { flex: 1; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .8rem; }
.cron-input-expr { flex: 1; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .8rem; font-family: monospace; }
.cron-input-cmd  { width: 100%; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .8rem; font-family: monospace; }
.cron-help-link  { font-size: .72rem; color: var(--primary); white-space: nowrap; }

/* ─── Section Backups ────────────────────────────────────────────────────── */
.backup-section { border-bottom: 1px solid var(--gray-100); }
.backup-body { padding: .5rem .75rem .75rem; }

.backup-badge { font-size: .68rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; }
.backup-badge-on  { background: #D1FAE5; color: #065F46; }
.backup-badge-off { background: var(--gray-100); color: var(--gray-500); }

.backup-list { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .5rem; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
              background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
              padding: .4rem .6rem; flex-wrap: wrap; }
.backup-row-info { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.backup-date  { font-size: .78rem; color: var(--gray-700); font-weight: 500; }
.backup-sizes { font-size: .72rem; color: var(--gray-400); }
.backup-type-badge { font-size: .65rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; flex-shrink: 0; }
.backup-type-auto   { background: #EDE9FE; color: #5B21B6; }
.backup-type-manual { background: #FEF3C7; color: #92400E; }
.backup-row-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.backup-auto-info { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--gray-500); margin-bottom: .5rem; }
.backup-create-row { border-top: 1px solid var(--gray-200); padding-top: .5rem; }

/* ─── Historique ─────────────────────────────────────────────────────────── */
.history-filters {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .625rem 1.5rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
.history-body { max-height: 65vh; overflow-y: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.history-table thead th {
    position: sticky; top: 0; background: var(--gray-50); z-index: 1;
    padding: .5rem .75rem; text-align: left; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}
.history-table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background .1s; }
.history-table tbody tr:hover { background: var(--gray-50); }
.history-table td { padding: .45rem .75rem; vertical-align: middle; }
.history-empty { text-align: center; color: var(--gray-400); padding: 2rem !important; font-style: italic; }

.history-date  { color: var(--gray-400); white-space: nowrap; font-family: monospace; font-size: .75rem; }
.history-user  { font-weight: 600; }
.history-action-badge {
    display: inline-block; font-size: .68rem; font-weight: 700; padding: .1rem .45rem;
    border-radius: .25rem; white-space: nowrap;
}
.action-create_project, .action-install_wordpress, .action-create_subdb, .action-create_user
    { background: #DCFCE7; color: #15803D; }
.action-delete_project, .action-delete_subdb, .action-delete_user
    { background: var(--danger-light); color: var(--danger); }
.action-enable_project  { background: #DBEAFE; color: #1D4ED8; }
.action-disable_project { background: var(--gray-100); color: var(--gray-500); }
.action-change_php, .action-change_db_password, .action-change_user_password, .action-toggle_user
    { background: #FEF3C7; color: #92400E; }
.action-login           { background: #F0FDF4; color: #166534; }
.action-default         { background: var(--gray-100); color: var(--gray-600); }

.history-subject { font-family: monospace; font-size: .78rem; color: var(--gray-700); }
.history-ip      { font-family: monospace; font-size: .72rem; color: var(--gray-400); }

/* ─── Modal logs ─────────────────────────────────────────────────────────── */
.modal-wide { max-width: min(80vw, 1200px); width: 80vw; }

.logs-controls {
    display: flex; align-items: center; gap: .5rem; margin-left: auto; margin-right: .75rem;
}
.select-sm { width: auto; padding: .25rem .5rem; font-size: .8rem; }

.logs-search-bar {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem 1.5rem; background: #1e293b; border-bottom: 1px solid #334155;
}
.logs-search-bar input {
    flex: 1; background: #0f172a; border: 1px solid #334155; border-radius: var(--radius-sm);
    color: #e2e8f0; padding: .35rem .75rem; font-size: .8rem; font-family: monospace;
}
.logs-search-bar input::placeholder { color: #475569; }
.logs-search-bar input:focus { outline: none; border-color: var(--primary); }
.logs-match-count { font-size: .75rem; color: #64748b; white-space: nowrap; }
.logs-search-bar .btn-xs { border-color: #334155; color: #94a3b8; }
.logs-search-bar .btn-xs:hover { background: #1e293b; color: #e2e8f0; }

.logs-meta {
    display: flex; align-items: center; justify-content: space-between;
    padding: .4rem 1.5rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
    font-size: .75rem; color: var(--gray-400); font-family: monospace;
}
.logs-body {
    max-height: 60vh; overflow-y: auto; background: #0f172a;
}
.logs-pre {
    margin: 0; padding: 1rem; font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    font-size: .75rem; line-height: 1.6; color: #94a3b8; white-space: pre-wrap; word-break: break-all;
}
.logs-pre .log-error  { color: #f87171; }
.logs-pre .log-warn   { color: #fbbf24; }
.logs-pre .log-info   { color: #60a5fa; }
.logs-pre .log-access { color: #6ee7b7; }
.logs-empty { padding: 2rem; text-align: center; color: var(--gray-400); font-style: italic; }

/* ─── Alert success ──────────────────────────────────────────────────────── */
.alert-success { background:#dcfce7; border-color:#86efac; color:#166534; }

/* ─── Expiration cert ────────────────────────────────────────────────────── */
.cert-expiry      { font-size:.7rem; font-weight:600; border-radius:999px; padding:.1rem .4rem; }
.cert-expiry-ok   { background:#dcfce7; color:#166534; }
.cert-expiry-soon { background:#fef9c3; color:#854d0e; }
.cert-expiry-warn { background:#fee2e2; color:#991b1b; }

/* ─── Domaines (aliases) ─────────────────────────────────────────────────── */
.alias-section { border-top: 1px solid var(--gray-100); }
.alias-body    { padding: .25rem .75rem .5rem; }
.alias-badge   { font-size: .7rem; font-weight: 600; background: var(--gray-100); color: var(--gray-500); border-radius: 999px; padding: .1rem .45rem; }
.alias-badge-on { background: #dbeafe; color: #1d4ed8; }

.alias-list { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .25rem; }
.alias-row  { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .25rem; border-radius: var(--radius-sm); }
.alias-row:hover { background: var(--gray-50); }
.alias-row-info    { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1; }
.alias-row-actions { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.alias-domain { font-size: .82rem; font-weight: 600; color: var(--gray-800); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alias-www    { font-size: .7rem; color: var(--gray-400); margin-left: .25rem; }

.alias-status { font-size: .7rem; font-weight: 600; border-radius: 999px; padding: .1rem .45rem; white-space: nowrap; }
.alias-status-pending { background: #fef9c3; color: #854d0e; }
.alias-status-issuing { background: #dbeafe; color: #1e40af; }
.alias-status-active  { background: #dcfce7; color: #166534; }
.alias-status-failed  { background: #fee2e2; color: #991b1b; cursor: help; }

/* ─── CMS badges ─────────────────────────────────────────────────────────── */
.cms-badge { display:inline-flex; align-items:center; font-size:.7rem; font-weight:700; border-radius:999px; padding:.15rem .5rem; white-space:nowrap; }
.cms-badge-wordpress  { background:#e8f4fd; color:#21759b; }
.cms-badge-nextcloud  { background:#e8f0fe; color:#1a56db; }
.cms-badge-matomo     { background:#fdf0e8; color:#c25a00; }
.cms-badge-drupal     { background:#e8f5e9; color:#1e7e34; }
.cms-badge-prestashop { background:#fce8f3; color:#a32b6b; }
.cms-badge-joomla     { background:#fff3e0; color:#e65100; }
.cms-badge-grav       { background:#f3e8ff; color:#6d28d9; }

/* ─── Section Applications ───────────────────────────────────────────────── */
.apps-section { border-bottom: 1px solid var(--gray-100); }
.apps-badge   { font-size:.7rem; font-weight:600; background:var(--gray-100); color:var(--gray-500); border-radius:999px; padding:.1rem .45rem; }
.apps-badge-on { background:#dbeafe; color:#1d4ed8; }
.apps-body-inner { padding:.25rem .75rem .25rem; }
.app-row { display:flex; align-items:center; gap:.5rem; padding:.3rem .25rem; border-radius:var(--radius-sm); }
.app-row:hover { background:var(--gray-50); }
.app-row-main { border-bottom:1px solid var(--gray-100); margin-bottom:.25rem; padding-bottom:.4rem; }
.app-path { font-size:.8rem; font-family:monospace; color:var(--primary); }
.app-meta { font-size:.75rem; color:var(--gray-400); margin-left:auto; }
.app-actions { display:flex; gap:.25rem; margin-left:auto; }
.apps-actions { padding:.4rem .75rem .6rem; display:flex; gap:.5rem; flex-wrap:wrap; }

/* ─── Barre de recherche ─────────────────────────────────────────────────── */
.search-bar {
    display: flex; align-items: center; gap: .75rem;
    background: #fff; border-radius: var(--radius); padding: .625rem 1rem;
    box-shadow: var(--shadow); margin-bottom: 1.25rem; flex-wrap: wrap;
}
.search-input-wrap {
    position: relative; flex: 1; min-width: 200px;
}
.search-icon {
    position: absolute; left: .625rem; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--gray-400); pointer-events: none;
}
#project-search {
    width: 100%; padding: .4rem .625rem .4rem 2rem; border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: .875rem; outline: none; background: var(--gray-50);
    transition: border-color .15s, box-shadow .15s;
}
#project-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); background: #fff; }
.search-clear {
    position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--gray-400); font-size: .875rem;
    cursor: pointer; padding: .1rem .25rem; line-height: 1;
}
.search-clear:hover { color: var(--gray-700); }
.filter-group { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.select-sm { font-size: .8rem; padding: .35rem .625rem; }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: .375rem; margin-top: 1.25rem; flex-wrap: wrap;
}
.page-btn {
    min-width: 2rem; height: 2rem; padding: 0 .5rem;
    border: 1px solid var(--gray-200); background: #fff;
    border-radius: var(--radius-sm); font-size: .875rem;
    color: var(--gray-700); cursor: pointer; transition: background .15s, border-color .15s;
}
.page-btn:hover:not(.disabled):not(.active) { background: var(--gray-100); border-color: var(--gray-300); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-btn.disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis { color: var(--gray-400); font-size: .875rem; padding: 0 .125rem; line-height: 2rem; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .projects-grid { grid-template-columns: 1fr; }
    .header { padding: 0 1rem; }
    .main { padding: 1rem; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .search-bar { flex-direction: column; align-items: stretch; }
    .filter-group { justify-content: flex-start; }
}
