/* ==========================================================================
   Web Authenticator — feuille de styles
   ========================================================================== */

:root {
    --bg:          #eef1f8;
    --bg-grad-1:   #eef2ff;
    --bg-grad-2:   #f6f7fb;
    --surface:     #ffffff;
    --surface-2:   #f6f7fb;
    --border:      #e6e8f0;
    --text:        #1f2430;
    --text-muted:  #6b7280;
    --primary:     #4f46e5;
    --primary-600: #4338ca;
    --primary-soft:#eef0ff;
    --success:     #16a34a;
    --warning:     #f59e0b;
    --danger:      #ef4444;
    --ring-track:  #e9ebf2;
    --shadow-sm:   0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
    --shadow-md:   0 6px 18px rgba(16,24,40,.10);
    --shadow-lg:   0 18px 40px rgba(16,24,40,.16);
    --radius:      16px;
    --radius-sm:   10px;
    --font:        'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --mono:        'SF Mono', ui-monospace, 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #0f1117;
        --bg-grad-1:   #14172210;
        --bg-grad-2:   #0f1117;
        --surface:     #1a1d27;
        --surface-2:   #222633;
        --border:      #2a2f3d;
        --text:        #e8eaf0;
        --text-muted:  #9aa1b2;
        --primary:     #6366f1;
        --primary-600: #818cf8;
        --primary-soft:#1e2235;
        --ring-track:  #2a2f3d;
        --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
        --shadow-md:   0 6px 18px rgba(0,0,0,.45);
        --shadow-lg:   0 18px 40px rgba(0,0,0,.55);
    }
}

* { box-sizing: border-box; }

body.app-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 100% -10%, var(--bg-grad-1), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

/* ----- Barre d'application ------------------------------------------------ */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.app-bar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }

.app-bar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 1.1rem;
    transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    max-width: 200px;
}
.user-avatar {
    width: 28px; height: 28px; flex: 0 0 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff; font-weight: 700; font-size: .8rem;
}
.user-name {
    font-size: .9rem; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ----- Contenu principal -------------------------------------------------- */
.app-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 22px 18px calc(96px + env(safe-area-inset-bottom));
}

.impersonate-banner {
    display: flex; align-items: center; gap: 10px;
    background: #fff7ed; color: #9a3412;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: .92rem;
}

/* ----- Barre d'outils ----------------------------------------------------- */
.toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-field {
    position: relative;
    flex: 1 1 240px;
    min-width: 180px;
    display: flex; align-items: center;
}
.search-field > .bi-search {
    position: absolute; left: 14px;
    color: var(--text-muted); font-size: .95rem; pointer-events: none;
}
.search-field input {
    width: 100%;
    padding: 11px 38px 11px 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: .95rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.search-clear {
    position: absolute; right: 10px;
    border: none; background: none; cursor: pointer;
    color: var(--text-muted); font-size: 1rem; padding: 4px;
    display: inline-flex;
}

.toolbar-actions { display: flex; gap: 8px; }

/* ----- Boutons ------------------------------------------------------------ */
.btn {
    --bs-btn-focus-box-shadow: none;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 16px;
    transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }

.btn-ghost {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ----- Grille de codes ---------------------------------------------------- */
.codes-grid {
    display: grid;
    /* min(290px, 100%) : une colonne ne dépasse jamais la largeur disponible */
    grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
    gap: 14px;
}

.grid-loading { grid-column: 1 / -1; text-align: center; padding: 60px 0; }

.code-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    overflow: hidden;
}
.code-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.code-card-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 6px;
}
.code-name {
    font-weight: 600; font-size: .95rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text);
}
.code-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s ease; }
.code-card:hover .code-actions,
.code-card:focus-within .code-actions { opacity: 1; }
.code-action {
    border: none; background: none; cursor: pointer;
    width: 30px; height: 30px; border-radius: 8px;
    color: var(--text-muted); font-size: .9rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.code-action:hover { background: var(--surface-2); color: var(--text); }
.code-action.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.code-card-main {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}

.code-value {
    font-family: var(--mono);
    /* Taille fluide : se réduit sur les petits écrans, plafonnée sur grand écran */
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--text);
    cursor: pointer;
    /* Clic = copie : pas de sélection de texte disgracieuse */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.1;
    white-space: nowrap;
    min-width: 0;
    transition: color .15s ease;
}
.code-value:hover { color: var(--primary); }
/* La coloration du décompte reste sur l'anneau uniquement, pas sur les chiffres */

.code-copied-flash {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    background: color-mix(in srgb, var(--success) 92%, transparent);
    color: #fff; font-weight: 600;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
}
.code-card.copied .code-copied-flash { opacity: 1; }

/* Anneau de décompte circulaire */
.totp-ring {
    position: relative;
    width: 46px; height: 46px;
    flex: 0 0 46px;
}
.totp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
    fill: none; stroke: var(--ring-track); stroke-width: 3;
}
.ring-progress {
    fill: none; stroke: var(--success); stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100.53;
    stroke-dashoffset: 0;
}
.code-card.is-warning .ring-progress { stroke: var(--warning); }
.code-card.is-danger  .ring-progress { stroke: var(--danger); }
.ring-count {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.code-card.is-danger .ring-count { color: var(--danger); }

/* ----- États vides -------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}
.empty-state > .bi { font-size: 3rem; color: var(--primary); opacity: .6; }
.empty-state h3 { margin: 14px 0 6px; color: var(--text); font-size: 1.2rem; }
.empty-state p { margin: 0 0 18px; }

/* ----- Bouton flottant (PWA) --------------------------------------------- */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: 54px; height: 54px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff; font-size: 1.4rem;
    box-shadow: var(--shadow-lg);
    display: inline-flex; align-items: center; justify-content: center;
    z-index: 1010;
    transition: transform .12s ease;
}
.fab:hover { transform: scale(1.06); }

/* ----- Modales (sheets) --------------------------------------------------- */
.modal-content.sheet {
    border: none;
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.sheet .modal-header { border-bottom: 1px solid var(--border); padding: 18px 20px; }
.sheet .modal-title { font-weight: 700; font-size: 1.05rem; }
.sheet .modal-body { padding: 20px; }

/* Sélecteur segmenté */
.segmented {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}
.segmented-btn {
    flex: 1;
    border: none; background: none; cursor: pointer;
    padding: 9px 10px;
    border-radius: 9px;
    font-weight: 600; font-size: .9rem;
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.segmented-sm .segmented-btn { padding: 7px 8px; font-size: .85rem; }

/* Formulaire empilé */
.stacked-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text); }
.field-hint { color: var(--text-muted); font-size: .8rem; }
.stacked-form .form-control,
.stacked-form .form-select {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 11px 13px;
}
.stacked-form .form-control:focus,
.stacked-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.stacked-form .mono { font-family: var(--mono); letter-spacing: .04em; }

.advanced { border-top: 1px solid var(--border); padding-top: 12px; }
.advanced summary {
    cursor: pointer; font-size: .88rem; font-weight: 600;
    color: var(--text-muted); list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "\F282"; font-family: "bootstrap-icons"; margin-right: 6px; font-size: .8rem; }
.advanced[open] summary::before { content: "\F286"; }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

/* Zone de dépôt de fichier */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 26px 16px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    cursor: pointer;
    text-align: center;
    color: var(--text-muted);
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone > .bi { font-size: 1.8rem; color: var(--primary); }
.dropzone span { font-weight: 600; color: var(--text); font-size: .92rem; }
.dropzone small { font-size: .78rem; }

.qr-preview { margin-top: 14px; text-align: center; }
.qr-preview img { max-width: 100%; max-height: 280px; border-radius: 12px; }

#qr-reader { width: 100%; max-width: 360px; margin: 0 auto; border-radius: 14px; overflow: hidden; }

.modal-hint { color: var(--text-muted); font-size: .82rem; text-align: center; margin: 16px 0 0; }

.import-format {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}
.import-format-title { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.import-format pre { margin: 8px 0 0; background: none; padding: 0; font-size: .78rem; color: var(--text); }

#qr-reader-error ul { padding-left: 18px; margin-bottom: 0; }
#qr-reader-error li { margin-bottom: 4px; }

/* ----- Codes de récupération ----------------------------------------------- */
.recovery-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 260px; overflow-y: auto;
    margin-bottom: 16px;
}
.recovery-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}
.recovery-row code {
    flex: 1; font-family: var(--mono); font-size: .92rem; color: var(--text);
    letter-spacing: .03em;
}
.recovery-row.is-used code { color: var(--text-muted); text-decoration: line-through; }
.recovery-row .form-check { margin: 0; display: flex; align-items: center; gap: 6px; }
.recovery-row .form-check-label { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }

.recovery-group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.recovery-group-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recovery-group-card .recovery-group-name {
    font-weight: 600; font-size: .95rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recovery-group-badge {
    font-size: .76rem; font-weight: 600; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.recovery-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: .95rem; font-weight: 700; color: var(--text);
    margin: 26px 0 12px;
}

.recovery-list-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
}
.recovery-list-head-actions { display: flex; align-items: center; gap: 6px; }

.recovery-subtitle {
    font-size: 1rem; font-weight: 700; color: var(--text);
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.recovery-group-card { position: relative; }
.recovery-group-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* Zone d'ajout de codes : repliée par défaut, la liste existante reste
   l'élément mis en avant (même composant que les "Options avancées"). */
.recovery-add { margin-top: 16px; }
.recovery-add .stacked-form { margin-top: 14px; }

/* ----- Pop-ups SweetAlert (renommer, supprimer, toasts, scan…) ------------ */
.swal2-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow-lg) !important;
}
.swal2-title { color: var(--text) !important; font-weight: 700 !important; }
.swal2-html-container { color: var(--text-muted) !important; }
.swal2-html-container strong { color: var(--text) !important; }
.swal2-input, .swal2-select, .swal2-textarea {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}
.swal2-input:focus, .swal2-textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-soft) !important;
}
.swal2-input-label, .swal2-label { color: var(--text-muted) !important; }

.swal2-styled.swal2-confirm {
    background: var(--primary) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 35%, transparent) !important;
}
.swal2-styled.swal2-confirm.swal2-danger-btn {
    background: var(--danger) !important;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--danger) 35%, transparent) !important;
}
.swal2-styled.swal2-cancel {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
}
.swal2-validation-message {
    background: var(--surface-2) !important;
    color: var(--danger) !important;
    border-radius: 8px !important;
}
.swal2-toast {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-md) !important;
}
.swal2-toast .swal2-title { font-size: .9rem !important; }
.swal2-loader { border-color: var(--primary) transparent var(--primary) transparent !important; }

/* ----- Responsive --------------------------------------------------------- */
@media (max-width: 640px) {
    .codes-grid { grid-template-columns: 1fr; }
    .btn-label { display: none; }               /* boutons en icônes seules */
    .toolbar-actions .btn { padding: 10px 12px; }
    .user-name { display: none; }               /* on garde juste l'avatar */
    .user-chip { padding: 4px; }
    .code-actions { opacity: 1; }               /* actions toujours visibles (pas de survol au doigt) */
    .app-main { padding-left: 14px; padding-right: 14px; }
}

/* ==========================================================================
   Styles partagés : pages de connexion / réinitialisation / admin
   ========================================================================== */
.login-container { max-width: 400px; margin: 100px auto; }
.login-logo { font-size: 2rem; margin-bottom: 30px; text-align: center; }

pre {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

.toggle-password { cursor: pointer; }
.toggle-password:focus { box-shadow: none; }
.input-group > .form-control:focus { z-index: 1; }

/* ==========================================================================
   Champs de formulaire thématisés (modales .sheet + cartes d'auth)
   ========================================================================== */
.sheet .form-control, .sheet .form-select,
.auth-card .form-control, .auth-card .form-select {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 11px 13px;
}
.sheet .form-control:focus, .sheet .form-select:focus,
.auth-card .form-control:focus, .auth-card .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
    background: var(--surface);
}
.sheet .form-control::placeholder,
.auth-card .form-control::placeholder { color: var(--text-muted); opacity: .8; }
.sheet .form-label, .auth-card .form-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.sheet .form-text, .auth-card .form-text { color: var(--text-muted); }
.sheet .form-check-input:checked,
.auth-card .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

.toggle-password {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
}
.toggle-password:hover { background: var(--surface); color: var(--text); }

/* ==========================================================================
   Pages d'authentification (connexion / mot de passe)
   ========================================================================== */
.auth-shell {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
}
.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 4px;
}
.auth-brand img { width: 38px; height: 38px; border-radius: 10px; }
.auth-brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; }
.auth-title { text-align: center; font-weight: 700; font-size: 1.15rem; margin: 14px 0 4px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 22px; }
.auth-card .btn { width: 100%; justify-content: center; }
.auth-card .btn + .btn { margin-top: 10px; }
/* Les boutons d'un input-group (œil afficher/masquer) restent à droite du champ */
.auth-card .input-group .btn { width: auto; flex: 0 0 auto; margin-top: 0; }
.auth-card .alert { border-radius: 10px; border: none; font-size: .9rem; }
.auth-foot { text-align: center; margin-top: 16px; font-size: .9rem; }
.auth-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }

.auth-sep {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0; color: var(--text-muted); font-size: .82rem;
}
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 11px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    font-weight: 600; text-decoration: none;
    transition: background .15s ease;
}
.btn-google:hover { background: var(--surface-2); color: var(--text); }
.btn-google img { width: 20px; height: 20px; }

/* ==========================================================================
   Page d'administration
   ========================================================================== */
.admin-table { width: 100%; margin: 0; color: var(--text); border-collapse: collapse; }
.admin-table th, .admin-table td {
    padding: 12px 14px; text-align: left; vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
.admin-table thead th {
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
}
.admin-table tbody tr { transition: background .12s ease; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table tbody tr:last-child td { border-bottom: none; }

.role-badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .76rem; font-weight: 600;
}
.role-badge.admin { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.role-badge.user  { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.admin-actions { display: flex; gap: 6px; }
.admin-action {
    width: 34px; height: 34px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); cursor: pointer; text-decoration: none;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.admin-action:hover { background: var(--surface-2); color: var(--text); }
.admin-action.impersonate:hover { color: var(--primary); border-color: var(--primary); }
.admin-action.danger:hover { color: var(--danger); border-color: var(--danger); }

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.section-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.section-card-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }

@media (max-width: 640px) {
    .auth-card { padding: 22px; }
    .admin-hide-sm { display: none; }
    .admin-table th, .admin-table td { padding: 10px 8px; font-size: .88rem; }
}
