/* assets/css/core.css */
:root {
    --navy-950: #090E1A;
    --navy-900: #0F172A;
    --navy-800: #1E293B;
    --navy-700: #334155;
    --slate-500: #64748B;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --white: #FFFFFF;

    --emerald-600: #059669;
    --emerald-500: #10B981;
    --emerald-100: #D1FAE5;

    --gold-600: #D97706;
    --gold-500: #F59E0B;
    --gold-100: #FEF3C7;

    --red-600: #DC2626;
    --red-500: #EF4444;
    --red-100: #FEE2E2;

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-xl: 0 20px 35px -10px rgba(9, 14, 26, 0.45);
    --transition: all 0.22s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.bg-slate {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at top right, #1E293B 0%, #0F172A 65%, #090E1A 100%);
    color: var(--navy-900);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.25rem;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Conteneur Principal d'Authentification */
.auth-wrapper {
    width: 100%;
    max-width: 490px;
    margin: 0 auto;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2rem 1.75rem;
    border-top: 5px solid var(--emerald-500);
    position: relative;
    overflow: hidden;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.4rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.app-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: 14px;
}

.logo-fallback {
    display: none;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--navy-900), var(--emerald-600));
    color: var(--white);
    font-weight: 800;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.25);
}

.institution-badge {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--emerald-600);
    background: var(--emerald-100);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    margin-bottom: 0.45rem;
}

.auth-header h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--navy-900);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.88rem;
    color: var(--slate-500);
    margin-top: 0.25rem;
}

/* Bannière de sécurité */
.security-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--slate-100);
    border-left: 4px solid var(--navy-800);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.82rem;
    color: var(--navy-800);
}

.notice-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.notice-text strong {
    display: block;
    margin-bottom: 0.15rem;
}

/* Boîte d'alerte */
.alert-box {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 1.15rem;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--red-100);
    color: var(--red-600);
    border-color: #FCA5A5;
}

.alert-warning {
    background: var(--gold-100);
    color: var(--gold-600);
    border-color: #FCD34D;
}

/* Indicateur d'étape */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.step-badge {
    background: var(--navy-900);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
}

.step-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--navy-800);
}

/* Formulaire Étape 1 */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-800);
    margin-bottom: 0.45rem;
}

.form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-md);
    transition: var(--transition);
    color: var(--navy-900);
}

.form-group input:focus {
    outline: none;
    border-color: var(--emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--slate-500);
}

/* Grille des 6 Prénoms (Étape 2) */
.challenge-instruction {
    font-size: 0.88rem;
    color: var(--navy-700);
    margin-bottom: 1rem;
}

.prenoms-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.prenom-btn {
    background: var(--slate-100);
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 0.9rem 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy-900);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    word-break: break-word;
}

.prenom-btn:hover,
.prenom-btn:focus {
    background: var(--emerald-100);
    border-color: var(--emerald-500);
    color: var(--navy-950);
    transform: translateY(-2px);
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.88rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--navy-900);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--navy-800);
}

.btn-emerald {
    background: var(--emerald-600);
    color: var(--white);
}

.btn-emerald:hover {
    background: var(--emerald-500);
}

.btn-gold {
    background: var(--gold-500);
    color: var(--navy-950);
}

.btn-danger {
    background: var(--red-600);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--slate-200);
    color: var(--slate-500);
}

.mt-1 {
    margin-top: 0.75rem;
}

/* Écran de blocage d'appareil */
.blocked-screen {
    text-align: center;
    padding: 1.5rem 0.5rem;
}

.blocked-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.blocked-screen h2 {
    color: var(--red-600);
    margin-bottom: 0.5rem;
}

.blocked-meta {
    font-size: 0.84rem;
    color: var(--slate-500);
    margin: 0.75rem 0 1.1rem;
}

.device-tag {
    display: inline-block;
    background: var(--navy-900);
    color: var(--gold-500);
    font-family: monospace;
    font-size: 0.78rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
}

/* Pied de carte */
.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--slate-200);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--slate-500);
}

/* POPUP MODAL CONFIDENTIEL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 14, 26, 0.86);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal-card {
    background: var(--white);
    width: 100%;
    max-width: 520px;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-xl);
    border-top: 6px solid var(--gold-500);
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    text-align: center;
    margin-bottom: 1.15rem;
}

.badge-verified {
    display: inline-block;
    background: var(--emerald-100);
    color: var(--emerald-600);
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.agent-identity {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--navy-800);
    margin-top: 0.2rem;
}

.agent-meta {
    font-size: 0.82rem;
    color: var(--slate-500);
}

.one-time-warning {
    background: var(--red-100);
    border-left: 4px solid var(--red-600);
    color: #991B1B;
    padding: 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 1.2rem;
}

.one-time-warning strong {
    display: block;
    margin-bottom: 0.25rem;
}

.credentials-box {
    background: var(--navy-900);
    color: var(--white);
    padding: 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.cred-item + .cred-item {
    margin-top: 0.95rem;
    padding-top: 0.95rem;
    border-top: 1px solid var(--navy-700);
}

.cred-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate-200);
    margin-bottom: 0.35rem;
}

.cred-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cred-value {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--emerald-500);
    word-break: break-all;
}

.cred-password {
    font-size: 1.35rem;
    color: var(--gold-500);
    letter-spacing: 0.12em;
}

.btn-copy-single {
    background: var(--navy-700);
    color: var(--white);
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-copy-single:hover {
    background: var(--emerald-600);
}

.copy-feedback {
    background: var(--emerald-100);
    color: var(--emerald-600);
    text-align: center;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

@media (max-width: 420px) {
    .prenoms-grid {
        grid-template-columns: 1fr;
    }
    .auth-card, .modal-card {
        padding: 1.4rem 1.15rem;
    }
}

/* === STYLES ADMINISTRATION (À ajouter à la fin de assets/css/core.css) === */
body.bg-admin {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--slate-100);
    color: var(--navy-900);
    min-height: 100vh;
}

.admin-topbar {
    background: var(--navy-900);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 4px solid var(--emerald-500);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-fallback.sm {
    display: flex;
    width: 46px;
    height: 46px;
    font-size: 1rem;
    border-radius: 10px;
}

.admin-brand h1 {
    font-size: 1.2rem;
    font-weight: 800;
}

.admin-brand p {
    font-size: 0.82rem;
    color: var(--slate-200);
}

.admin-top-actions {
    display: flex;
    gap: 0.65rem;
}

.btn-sm {
    padding: 0.5rem 0.9rem;
    font-size: 0.84rem;
}

.btn-outline-light {
    background: transparent;
    border: 1px solid var(--slate-200);
    color: var(--white);
}

.admin-container {
    max-width: 1440px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.15rem;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--navy-800);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.stat-card.emerald { border-left-color: var(--emerald-500); }
.stat-card.gold { border-left-color: var(--gold-500); }
.stat-card.danger { border-left-color: var(--red-600); }

.stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--slate-500);
}

.stat-value {
    display: block;
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0.2rem 0;
}

.stat-sub {
    font-size: 0.76rem;
    color: var(--slate-500);
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--slate-200);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: var(--white);
    border: 1px solid var(--slate-200);
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--navy-800);
    cursor: pointer;
}

.tab-btn.active {
    background: var(--navy-900);
    color: var(--white);
    border-color: var(--navy-900);
}

.panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    min-width: 260px;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.toolbar-buttons {
    display: flex;
    gap: 0.6rem;
}

.table-responsive {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--slate-200);
    vertical-align: middle;
}

.admin-table th {
    background: var(--navy-900);
    color: var(--white);
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: #F8FAFC;
}

.mono-sm {
    font-family: Consolas, monospace;
    font-size: 0.8rem;
}

.pass-badge {
    display: inline-block;
    background: var(--navy-900);
    color: var(--gold-500);
    font-family: monospace;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    letter-spacing: 0.08em;
}

.pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.pill-emerald { background: var(--emerald-100); color: var(--emerald-600); }
.pill-danger { background: var(--red-100); color: var(--red-600); }
.pill-gold { background: var(--gold-100); color: var(--gold-600); }

.actions-cell {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.btn-xs {
    border: none;
    padding: 0.32rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-ok { background: var(--emerald-600); color: var(--white); }
.btn-warn { background: var(--gold-500); color: var(--navy-950); }
.btn-edit { background: var(--navy-800); color: var(--white); }
.btn-del { background: var(--red-600); color: var(--white); }

.card-panel {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
}

.inline-form select,
.form-grid-3 select {
    width: 100%;
    padding: 0.75rem;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--white);
}

.modal-lg {
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header-row,
.modal-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-footer-row {
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-close-x {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.hw-json-viewer {
    background: var(--navy-950);
    color: var(--emerald-500);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 60vh;
}

.text-muted { color: var(--slate-500); }
.text-danger { color: var(--red-600); }
.truncate-col {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}