/* ─────────────────────────────────────────────────────────────────────────────
   DocSecure — Design system « Trust & Authority »
   Ardoise / marine, un seul bleu d'action, aplats (pas de dégradés), rayons sobres.
   Titres : Lexend · Texte : Source Sans 3 · Références : IBM Plex Mono (chiffres tabulaires)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Neutres (ardoise) */
    --ink-950: #020617;
    --ink-900: #0F172A;
    --ink-800: #1E293B;
    --ink-700: #334155;
    --ink-600: #475569;
    --ink-500: #64748B;
    --ink-400: #94A3B8;
    --ink-300: #CBD5E1;
    --ink-200: #E2E8F0;
    --ink-100: #F1F5F9;
    --ink-50:  #F8FAFC;

    /* Action */
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-active: #1E40AF;
    --accent-soft: #EFF6FF;
    --accent-ring: rgba(37, 99, 235, .35);

    /* Sémantiques (texte ≥ 4.5:1 sur leur fond doux) */
    --success: #15803D; --success-soft: #F0FDF4; --success-line: #BBF7D0;
    --danger:  #B91C1C; --danger-soft:  #FEF2F2; --danger-line:  #FECACA;
    --warning: #B45309; --warning-soft: #FFFBEB; --warning-line: #FDE68A;
    --info:    #0369A1; --info-soft:    #F0F9FF; --info-line:    #BAE6FD;

    /* Surfaces */
    --bg: var(--ink-50);
    --surface: #FFFFFF;
    --line: var(--ink-200);
    --text: var(--ink-900);
    --text-2: var(--ink-600);
    --text-3: var(--ink-500);

    /* Échelles */
    --r-sm: 4px; --r-md: 6px; --r-lg: 8px;
    --shadow-1: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-2: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-3: 0 16px 40px rgba(15, 23, 42, .16);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --t-fast: 150ms; --t-base: 200ms;
    --sidebar-w: 256px;
    --topbar-h: 60px;

    --font-head: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

    /* Raccord Bootstrap */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: .9375rem;
    --bs-body-line-height: 1.55;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 37, 99, 235;
    --bs-link-hover-color: var(--accent-hover);
    --bs-border-radius: var(--r-md);
    --bs-border-radius-lg: var(--r-lg);
    --bs-secondary-color: var(--text-3);
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { font-family: var(--font-head); color: var(--ink-900); letter-spacing: -.01em; }
[v-cloak] { display: none !important; }
a { text-decoration: none; }
/* Soulignement au survol réservé aux liens de texte : jamais sur les boutons, menus, codes ou la marque */
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a.btn, a.btn:hover, a.btn:focus,
.app-nav-item:hover, .app-brand:hover, .dropdown-item:hover,
a.ref:hover, .skip-link:hover { text-decoration: none; }
.text-muted { color: var(--text-3) !important; }
.text-secondary-emphasis { color: var(--text-2) !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }

/* Focus visibles partout (clavier) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 3000; background: var(--ink-900); color: #fff;
    padding: 10px 16px; border-radius: var(--r-md); font-weight: 600; transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 12px; color: #fff; }
.visually-hidden-focusable:not(:focus) { position: absolute !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ─── Boutons ───────────────────────────────────────────────────────────── */
.btn {
    --bs-btn-font-weight: 600; --bs-btn-font-size: .9rem; --bs-btn-padding-y: .5rem; --bs-btn-padding-x: 1rem;
    --bs-btn-border-radius: var(--r-md);
    min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn i { font-size: 1.1em; line-height: 1; }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .85rem; min-height: 34px; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: 1rem; min-height: 48px; }
.btn-primary {
    --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-active); --bs-btn-active-border-color: var(--accent-active);
    --bs-btn-disabled-bg: var(--ink-300); --bs-btn-disabled-border-color: var(--ink-300); --bs-btn-disabled-color: #fff;
    box-shadow: var(--shadow-1);
}
.btn-secondary, .btn-outline-secondary, .btn-light {
    --bs-btn-color: var(--ink-800); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--ink-300);
    --bs-btn-hover-color: var(--ink-900); --bs-btn-hover-bg: var(--ink-50); --bs-btn-hover-border-color: var(--ink-400);
    --bs-btn-active-color: var(--ink-900); --bs-btn-active-bg: var(--ink-100); --bs-btn-active-border-color: var(--ink-400);
    --bs-btn-disabled-color: var(--ink-400); --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-border-color: var(--ink-200);
    box-shadow: var(--shadow-1);
}
.btn-ghost {
    --bs-btn-color: var(--ink-600); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--ink-900); --bs-btn-hover-bg: var(--ink-100); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: var(--ink-200); --bs-btn-active-border-color: transparent;
}
.btn-danger {
    --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #991B1B; --bs-btn-hover-border-color: #991B1B; --bs-btn-active-bg: #7F1D1D;
}
.btn-icon { width: 36px; min-height: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; min-height: 32px; height: 32px; }
.btn:disabled, .btn.disabled { cursor: not-allowed; }

/* ─── Formulaires ───────────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: .875rem; color: var(--ink-800); margin-bottom: .375rem; }
.form-label .optional { font-weight: 400; color: var(--text-3); }
.form-text { color: var(--text-3); font-size: .8125rem; }
.form-control, .form-select {
    min-height: 40px; border-color: var(--ink-300); border-radius: var(--r-md); color: var(--ink-900); font-size: .9375rem;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.form-control::placeholder { color: var(--ink-400); }
.form-control:hover, .form-select:hover { border-color: var(--ink-400); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-control-lg { min-height: 48px; font-size: 1rem; }
.input-group-text { background: var(--ink-50); border-color: var(--ink-300); color: var(--text-3); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.invalid-feedback { color: var(--danger); font-size: .8125rem; font-weight: 500; }
textarea.form-control { min-height: 80px; }

.segmented { display: flex; padding: 3px; gap: 3px; background: var(--ink-100); border: 1px solid var(--ink-200); border-radius: var(--r-md); }
.segmented button {
    flex: 1; min-height: 36px; border: 0; background: transparent; border-radius: var(--r-sm); font-weight: 600; font-size: .875rem;
    color: var(--ink-600); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.segmented button:hover { color: var(--ink-900); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink-900); box-shadow: var(--shadow-1), 0 0 0 1px var(--ink-200); }

/* ─── Coquille : sidebar ────────────────────────────────────────────────── */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: var(--ink-900); color: var(--ink-300); display: flex; flex-direction: column;
    border-right: 1px solid var(--ink-800); transition: transform var(--t-base) var(--ease);
}
.app-brand { display: flex; align-items: center; gap: .75rem; height: var(--topbar-h); padding: 0 1.25rem; border-bottom: 1px solid var(--ink-800); }
.brand-mark {
    width: 32px; height: 32px; border-radius: var(--r-md); background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0;
}
.brand-name { font-family: var(--font-head); font-weight: 600; color: #fff; font-size: 1rem; line-height: 1.1; }
.brand-org { font-size: .75rem; color: var(--ink-400); line-height: 1.2; }

.app-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; }
.app-nav-cta { margin-bottom: 1.25rem; }
.app-nav-cta .btn { width: 100%; justify-content: flex-start; }
.btn-sidebar {
    --bs-btn-color: #fff; --bs-btn-bg: var(--ink-800); --bs-btn-border-color: var(--ink-700);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ink-700); --bs-btn-hover-border-color: var(--ink-600);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--ink-700); --bs-btn-active-border-color: var(--ink-600);
}
.btn-sidebar i { color: #93C5FD; }
.btn-sidebar.active { --bs-btn-bg: var(--ink-700); --bs-btn-border-color: #60A5FA; }
.app-nav-section { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-500); padding: 0 .75rem .5rem; margin-top: .25rem; }
.app-nav-section + .app-nav-list { margin-bottom: 1.25rem; }
.app-nav-list { list-style: none; margin: 0; padding: 0; }
.app-nav-item {
    position: relative; display: flex; align-items: center; gap: .75rem; min-height: 40px; padding: 0 .75rem;
    border-radius: var(--r-md); color: var(--ink-300); font-weight: 500; font-size: .9375rem;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.app-nav-item i { font-size: 1.15rem; color: var(--ink-400); transition: color var(--t-fast) var(--ease); }
.app-nav-item:hover { background: var(--ink-800); color: #fff; }
.app-nav-item:hover i { color: #fff; }
.app-nav-item.active { background: var(--ink-800); color: #fff; }
.app-nav-item.active i { color: #93C5FD; }
.app-nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #60A5FA; }
.app-nav-item .ext { margin-left: auto; font-size: .9rem; opacity: .6; }

.app-sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--ink-800); font-size: .75rem; color: var(--ink-500); display: flex; align-items: center; gap: .5rem; }
.app-sidebar-foot i { color: var(--ink-400); }

/* ─── Coquille : topbar & contenu ───────────────────────────────────────── */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: 0 2rem;
}
.app-burger { display: none; }
.app-breadcrumb { margin: 0; font-size: .875rem; }
.app-breadcrumb .breadcrumb { margin: 0; --bs-breadcrumb-divider-color: var(--ink-300); --bs-breadcrumb-item-active-color: var(--ink-900); }
.app-breadcrumb a { color: var(--text-3); }
.app-breadcrumb a:hover { color: var(--ink-900); }
.app-breadcrumb .active { font-weight: 600; }
@media (max-width: 575.98px) { .app-breadcrumb .breadcrumb-item.active { padding-left: 0; } .app-breadcrumb .breadcrumb-item.active::before { display: none; } }

.user-menu-btn {
    display: flex; align-items: center; gap: .625rem; padding: .25rem .5rem .25rem .25rem; border-radius: var(--r-md);
    border: 1px solid transparent; background: transparent; min-height: 44px; cursor: pointer;
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.user-menu-btn:hover, .user-menu-btn[aria-expanded="true"] { background: var(--ink-50); border-color: var(--line); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--ink-800); color: #fff;
    display: grid; place-items: center; font-weight: 600; font-size: .8125rem; font-family: var(--font-head); flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: .875rem; color: var(--ink-900); line-height: 1.2; }
.user-role { font-size: .75rem; color: var(--text-3); line-height: 1.2; }

.dropdown-menu { --bs-dropdown-border-color: var(--line); --bs-dropdown-border-radius: var(--r-lg); --bs-dropdown-box-shadow: var(--shadow-2); --bs-dropdown-link-active-bg: var(--accent); --bs-dropdown-font-size: .9rem; --bs-dropdown-item-padding-y: .5rem; padding: .375rem; box-shadow: var(--shadow-2); }
.dropdown-item { border-radius: var(--r-sm); display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { color: var(--text-3); font-size: 1.05rem; }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-header { font-size: .75rem; }

.app-content { flex: 1; width: 100%; max-width: 1440px; padding: 2rem; }

/* En-tête de page */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0; line-height: 1.25; }
.page-subtitle { color: var(--text-2); margin: .25rem 0 0; font-size: .9375rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .5); }
    .app-main { margin-left: 0; }
    .app-burger { display: inline-flex; }
    .app-topbar { padding: 0 1rem; }
    .app-content { padding: 1.25rem 1rem 2rem; }
    .page-title { font-size: 1.3rem; }
}

.cell-wrap { max-width: 200px; min-width: 140px; white-space: normal; }

/* ─── Panneaux (cartes) ─────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 1.5rem; }
.panel-header { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); min-height: 60px; }
.panel-title { font-family: var(--font-head); font-size: 1rem; font-weight: 600; margin: 0; color: var(--ink-900); }
.panel-subtitle { font-size: .8125rem; color: var(--text-3); margin: 0; }
.panel-body { padding: 1.25rem; }
.panel-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--line); background: var(--ink-50); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.panel-step {
    width: 24px; height: 24px; border-radius: 50%; background: var(--ink-100); color: var(--ink-700); border: 1px solid var(--ink-200);
    display: grid; place-items: center; font-size: .75rem; font-weight: 700; font-family: var(--font-head); flex-shrink: 0;
}

/* KPI */
.kpi { padding: 1.25rem; height: 100%; display: flex; flex-direction: column; gap: .75rem; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: .8125rem; font-weight: 600; color: var(--text-2); }
.kpi-icon { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; font-size: 1.15rem; background: var(--ink-100); color: var(--ink-700); }
.kpi-value { font-family: var(--font-head); font-size: 1.875rem; font-weight: 600; color: var(--ink-900); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-meta { font-size: .8125rem; color: var(--text-3); }
.kpi-meta strong { color: var(--ink-700); font-weight: 600; }

/* ─── Tableaux ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.data-table thead th {
    position: sticky; top: 0; background: var(--ink-50); color: var(--text-2); font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; padding: .75rem .875rem; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left;
}
.data-table tbody td { padding: .75rem .875rem; border-bottom: 1px solid var(--ink-100); vertical-align: middle; color: var(--ink-800); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--ink-50); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-sub { display: block; font-size: .8125rem; color: var(--text-3); }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table tr.is-muted td { color: var(--text-3); }
.cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ref { font-family: var(--font-mono); font-weight: 600; font-size: .875rem; color: var(--ink-900); white-space: nowrap; letter-spacing: 0; }
a.ref:hover { color: var(--accent); }

/* Statuts : point + libellé (jamais la couleur seule) */
.status {
    display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem .2rem .5rem; border-radius: 999px;
    font-size: .8125rem; font-weight: 600; line-height: 1.4; border: 1px solid transparent; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-actif   { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.status-annule  { color: var(--danger);  background: var(--danger-soft);  border-color: var(--danger-line); }
.status-archive { color: var(--ink-600); background: var(--ink-100);      border-color: var(--ink-200); }
.status-inactive { color: var(--ink-600); background: var(--ink-100); border-color: var(--ink-200); }

.tag {
    display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: var(--r-sm);
    font-size: .8125rem; font-weight: 600; background: var(--ink-100); color: var(--ink-700); white-space: nowrap;
}
.tag i { font-size: .95rem; }
.tag-sortant { background: var(--warning-soft); color: var(--warning); }
.tag-entrant { background: var(--info-soft); color: var(--info); }
.tag-accent { background: var(--accent-soft); color: var(--accent-active); }

.empty-state { text-align: center; padding: 3.5rem 1.5rem; }
.empty-state-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--ink-100); color: var(--ink-500); display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto 1rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.empty-state p { color: var(--text-3); margin: 0 auto 1rem; max-width: 380px; }

.skeleton { background: linear-gradient(90deg, var(--ink-100) 0, var(--ink-200) 50%, var(--ink-100) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-sm); height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.25rem; border-top: 1px solid var(--line); font-size: .875rem; color: var(--text-2); }

/* Filtres */
.filters { display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(110px, 1fr)) minmax(270px, 1.9fr) auto; gap: .75rem; align-items: end; }
.filters fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.filters legend { float: none; width: auto; padding: 0; }
.filters .form-label { font-size: .8125rem; }
.period { display: flex; align-items: center; gap: .375rem; }
.period .form-control { min-width: 0; }
.period-sep { color: var(--ink-400); }
@media (max-width: 1199.98px) {
    .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filters .f-search { grid-column: 1 / -1; }
    .filters .f-period { grid-column: span 2; }
}
@media (max-width: 767.98px) {
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters .f-period { grid-column: 1 / -1; }
}
.filter-chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Listes de définitions */
.meta-list { display: grid; grid-template-columns: 150px 1fr; margin: 0; }
.meta-list dt, .meta-list dd { padding: .7rem 0; border-bottom: 1px solid var(--ink-100); margin: 0; line-height: 1.5rem; }
.meta-list dt { color: var(--text-2); font-weight: 600; font-size: .8125rem; padding-right: 1rem; }
.meta-list dd { color: var(--ink-900); word-break: break-word; }
.meta-list dt:last-of-type, .meta-list dd:last-of-type { border-bottom: 0; }
@media (max-width: 575.98px) { .meta-list { grid-template-columns: 1fr; } .meta-list dt { border-bottom: 0; padding-bottom: 0; } }
.hash { font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); word-break: break-all; line-height: 1.5; }

/* Journal */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; display: flex; gap: .875rem; padding-bottom: 1.125rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 1px; background: var(--line); }
.timeline-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-100); color: var(--ink-600); font-size: .95rem; flex-shrink: 0; }
.timeline-icon.is-success { background: var(--success-soft); color: var(--success); }
.timeline-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.timeline-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.timeline-title { font-weight: 600; font-size: .875rem; color: var(--ink-900); }
.timeline-meta { font-size: .8125rem; color: var(--text-3); }

/* Alertes */
.alert { border-radius: var(--r-md); border-width: 1px; font-size: .9rem; display: flex; gap: .625rem; align-items: flex-start; }
.alert > i { font-size: 1.15rem; line-height: 1.3; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-line); color: #7F1D1D; }
.alert-success { background: var(--success-soft); border-color: var(--success-line); color: #14532D; }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-line); color: #78350F; }
.alert-info { background: var(--accent-soft); border-color: #BFDBFE; color: #1E3A8A; }

/* Modales */
.modal-content { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.modal-header { padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: var(--ink-50); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal-backdrop.show { opacity: .55; }

/* ─── Traitement d'un document ──────────────────────────────────────────── */
.stepper { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; list-style: none; padding: 0; }
.stepper li { display: flex; align-items: center; gap: .6rem; font-size: .875rem; font-weight: 600; color: var(--text-3); }
.stepper li + li::before { content: ""; width: 32px; height: 1px; background: var(--ink-300); margin-right: .15rem; }
.stepper .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--ink-300); background: var(--surface); font-size: .75rem; font-family: var(--font-head); }
.stepper li.current { color: var(--ink-900); }
.stepper li.current .num { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.done { color: var(--ink-700); }
.stepper li.done .num { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }
@media (max-width: 575.98px) { .stepper { display: none; } }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%;
    min-height: 240px; padding: 2rem 1.5rem; border: 1.5px dashed var(--ink-300); border-radius: var(--r-lg); background: var(--ink-50);
    cursor: pointer; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { width: 52px; height: 52px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--accent); display: grid; place-items: center; font-size: 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow-1); }
.dropzone-title { font-weight: 600; color: var(--ink-900); }
.dropzone-hint { font-size: .8125rem; color: var(--text-3); margin-top: .25rem; }
.dropzone .btn { margin-top: 1rem; pointer-events: none; }

.file-card { display: flex; align-items: center; gap: .875rem; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.file-card-icon { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.file-card-name { font-weight: 600; color: var(--ink-900); }
.file-card-meta { font-size: .8125rem; color: var(--text-3); }

.note { display: flex; gap: .75rem; padding: .875rem 1rem; border-radius: var(--r-md); background: var(--ink-50); border: 1px solid var(--line); font-size: .875rem; color: var(--text-2); }
.note i { color: var(--accent); font-size: 1.15rem; line-height: 1.3; }

.result-head { display: flex; align-items: flex-start; gap: .875rem; }
.result-head .seal { width: 40px; height: 40px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; border: 1px solid var(--success-line); }
.ref-box { display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem .5rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-50); }
.ref-box .ref { font-size: 1.125rem; flex: 1; }
.ref-label { font-size: .75rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .375rem; }

.pdf-frame { display: block; width: 100%; height: 75vh; min-height: 480px; border: 0; background: var(--ink-200); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.progress { height: 4px; background: var(--ink-100); border-radius: 2px; }
.progress-bar { background: var(--accent); }

/* ─── Toasts ────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast-item {
    pointer-events: auto; min-width: 280px; max-width: 400px; background: var(--ink-900); color: #fff; border-radius: var(--r-md);
    padding: .75rem 1rem; box-shadow: var(--shadow-3); display: flex; gap: .625rem; align-items: flex-start; font-size: .9rem;
    animation: toast-in var(--t-base) var(--ease);
}
.toast-item i { font-size: 1.1rem; line-height: 1.3; }
.toast-item.success i { color: #4ADE80; }
.toast-item.danger i { color: #F87171; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ─── Connexion ─────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); background: var(--surface); }
.auth-aside { background: var(--ink-900); color: var(--ink-300); padding: 2.5rem 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
    background-image: linear-gradient(var(--ink-800) 1px, transparent 1px), linear-gradient(90deg, var(--ink-800) 1px, transparent 1px);
    background-size: 40px 40px; mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { color: #fff; font-size: 1.875rem; font-weight: 600; line-height: 1.25; max-width: 440px; margin-bottom: 1rem; }
.auth-aside .lead { color: var(--ink-400); font-size: 1rem; max-width: 440px; margin-bottom: 2rem; }
.auth-feature { display: flex; gap: .875rem; align-items: flex-start; padding: .875rem 0; border-top: 1px solid var(--ink-800); max-width: 440px; }
.auth-feature i { width: 32px; height: 32px; border-radius: var(--r-md); background: var(--ink-800); color: #93C5FD; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }
.auth-feature strong { display: block; color: #fff; font-weight: 600; font-size: .9375rem; }
.auth-feature span { font-size: .875rem; color: var(--ink-400); }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2.5rem 1.5rem; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 1.625rem; font-weight: 600; margin-bottom: .375rem; }
.auth-foot { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .875rem; text-align: center; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 3rem; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--text-3); border-radius: var(--r-sm); cursor: pointer; }
.password-toggle:hover { color: var(--ink-900); }
@media (max-width: 991.98px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ─── Vérification publique ─────────────────────────────────────────────── */
.verify-page { min-height: 100vh; min-height: 100dvh; background: var(--bg); display: flex; flex-direction: column; }
.verify-bar { background: var(--ink-900); color: #fff; }
.verify-bar-inner { max-width: 640px; margin: 0 auto; padding: .875rem 1rem; display: flex; align-items: center; gap: .75rem; }
.verify-bar .brand-org { color: var(--ink-400); }
.verify-bar .secure { margin-left: auto; font-size: .75rem; color: var(--ink-400); display: flex; align-items: center; gap: .35rem; }
.verify-wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.cert { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.cert-head { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid var(--line); border-top: 4px solid var(--ink-400); }
.cert-seal { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.75rem; flex-shrink: 0; border: 2px solid currentColor; }
.cert-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.cert-title { font-size: 1.375rem; font-weight: 600; margin: .125rem 0; }
.cert-desc { font-size: .9rem; color: var(--text-2); margin: 0; }
.cert.is-ok .cert-head { border-top-color: var(--success); } .cert.is-ok .cert-seal { color: var(--success); background: var(--success-soft); }
.cert.is-ko .cert-head { border-top-color: var(--danger); } .cert.is-ko .cert-seal { color: var(--danger); background: var(--danger-soft); }
.cert.is-warn .cert-head { border-top-color: var(--warning); } .cert.is-warn .cert-seal { color: var(--warning); background: var(--warning-soft); }
.cert.is-muted .cert-head { border-top-color: var(--ink-500); } .cert.is-muted .cert-seal { color: var(--ink-600); background: var(--ink-100); }
.cert-ref { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 1.5rem; background: var(--ink-50); border-bottom: 1px solid var(--line); }
.cert-body { padding: .5rem 1.5rem 1rem; }
.or-sep { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0 1rem; color: var(--text-3); font-size: .8125rem; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Lecteur QR (plein écran sur mobile, fenêtre centrée sur desktop) */
.qr-overlay { position: fixed; inset: 0; z-index: 2500; background: rgba(15, 23, 42, .72); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.qr-overlay[hidden] { display: none; }
.qr-sheet { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; animation: toast-in var(--t-base) var(--ease); }
.qr-head { display: flex; align-items: center; justify-content: space-between; padding: .75rem .75rem .75rem 1.25rem; border-bottom: 1px solid var(--line); }
.qr-title { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .5rem; }
.qr-title i { color: var(--accent); }
.qr-reader { width: 100%; aspect-ratio: 1 / 1; background: var(--ink-900); position: relative; }
.qr-reader { overflow: hidden; }
.qr-reader video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qr-frame {
    position: absolute; z-index: 1; left: 50%; top: 50%; width: 64%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%);
    border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .45); pointer-events: none;
    background:
        linear-gradient(#fff, #fff) top left / 28px 3px no-repeat, linear-gradient(#fff, #fff) top left / 3px 28px no-repeat,
        linear-gradient(#fff, #fff) top right / 28px 3px no-repeat, linear-gradient(#fff, #fff) top right / 3px 28px no-repeat,
        linear-gradient(#fff, #fff) bottom left / 28px 3px no-repeat, linear-gradient(#fff, #fff) bottom left / 3px 28px no-repeat,
        linear-gradient(#fff, #fff) bottom right / 28px 3px no-repeat, linear-gradient(#fff, #fff) bottom right / 3px 28px no-repeat;
}
.qr-status { margin: 0; padding: .875rem 1.25rem 0; font-size: .875rem; color: var(--text-2); min-height: 2.5rem; }
.qr-status-error { color: var(--danger); font-weight: 600; }
.qr-status-ok { color: var(--success); font-weight: 600; }
.qr-actions { display: flex; gap: .5rem; padding: .875rem 1.25rem 1.25rem; }
@media (max-width: 575.98px) {
    .qr-overlay { padding: 0; align-items: stretch; }
    .qr-sheet { max-width: none; border-radius: 0; display: flex; flex-direction: column; }
    .qr-reader { flex: 1; aspect-ratio: auto; min-height: 0; }
}

.verify-foot { text-align: center; font-size: .8125rem; color: var(--text-3); margin-top: 2rem; }

/* Erreurs */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; text-align: center; }
.error-code { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; color: var(--accent); letter-spacing: .1em; }
