/* ==========================================================================
   School Management System — feuille de style unique
   Direction artistique : Swiss / minimal, densité « dashboard ».
   Palette navy #0F172A + accent #0369A1, typographie Plus Jakarta Sans / Inter.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Jetons de design
   -------------------------------------------------------------------------- */

:root {
    /* Couleurs */
    --primary: #0f172a;
    --primary-600: #1e293b;
    --on-primary: #ffffff;
    --secondary: #334155;
    --accent: #0369a1;
    --accent-600: #075985;
    --accent-soft: #e0f2fe;
    --on-accent: #ffffff;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --fg: #020617;
    --muted: #e8ecf1;
    --muted-fg: #475569;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --success: #047857;
    --success-soft: #d1fae5;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0369a1;
    --info-soft: #e0f2fe;

    /* Espacements — échelle dense (dashboard) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* Typographie */
    --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;

    /* Divers */
    --radius: 8px;
    --radius-sm: 5px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 24px -12px rgba(15, 23, 42, 0.25);
    --sidebar-w: 244px;
    --topbar-h: 56px;
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   2. Réinitialisation
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, p, figure, ul, ol, dl {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

img, svg {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Lien d'évitement pour la navigation au clavier */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    background: var(--accent);
    color: #fff;
    padding: var(--space-3) var(--space-4);
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    left: 0;
}

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

/* --------------------------------------------------------------------------
   3. Structure applicative
   -------------------------------------------------------------------------- */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--primary);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topbar-h);
}

.sidebar__logo {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sidebar__title {
    color: #fff;
    font-weight: 700;
    font-size: var(--text-base);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__subtitle {
    color: #64748b;
    font-size: var(--text-xs);
}

.sidebar__nav {
    padding: var(--space-3) var(--space-3) var(--space-8);
    flex: 1;
}

.sidebar__group {
    margin-top: var(--space-5);
}

.sidebar__group-label {
    color: #64748b;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 var(--space-3) var(--space-2);
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: var(--text-base);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}

.sidebar__link.is-active {
    background: var(--accent);
    color: #fff;
}

.sidebar__link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke-width: 1.7;
}

.sidebar__badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 6px;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    min-height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar__spacer {
    flex: 1;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.content {
    padding: var(--space-6);
    flex: 1;
    max-width: 1560px;
    width: 100%;
}

/* --------------------------------------------------------------------------
   4. En-tête de page
   -------------------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.page-head__text {
    flex: 1;
    min-width: 220px;
}

.page-title {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--fg);
}

.page-subtitle {
    color: var(--muted-fg);
    font-size: var(--text-base);
    margin-top: 2px;
}

.page-head__actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   5. Cartes et grilles
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.card__title {
    font-size: var(--text-md);
    font-weight: 650;
    letter-spacing: -0.01em;
}

.card__actions {
    margin-left: auto;
    display: flex;
    gap: var(--space-2);
}

.card__body {
    padding: var(--space-5);
}

.card__body--flush {
    padding: 0;
}

.card__foot {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

.grid {
    display: grid;
    gap: var(--space-4);
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

@media (max-width: 1100px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
    .grid--2,
    .grid--3,
    .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   6. Indicateurs (KPI)
   -------------------------------------------------------------------------- */

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat__label {
    color: var(--muted-fg);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat__value {
    font-size: var(--text-2xl);
    font-weight: 750;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.stat__meta {
    color: var(--muted-fg);
    font-size: var(--text-xs);
}

.stat--accent { border-left: 3px solid var(--accent); }
.stat--success { border-left: 3px solid var(--success); }
.stat--warning { border-left: 3px solid var(--warning); }
.stat--danger { border-left: 3px solid var(--danger); }

/* --------------------------------------------------------------------------
   7. Tableaux
   -------------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    font-size: var(--text-base);
    min-width: 100%;
}

.table th {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-fg);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fafbfd;
}

.table--compact td,
.table--compact th {
    padding: var(--space-2) var(--space-3);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.table__empty {
    text-align: center;
    color: var(--muted-fg);
    padding: var(--space-10) var(--space-4);
}

/* --------------------------------------------------------------------------
   8. Badges et pastilles
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 650;
    line-height: 1.6;
    white-space: nowrap;
}

.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--muted   { background: var(--muted);        color: var(--muted-fg); }

/* Point coloré : le statut ne repose jamais sur la seule couleur */
.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-600);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: var(--text-xs);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar--lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-md);
}

.person {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.person__name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person__meta {
    color: var(--muted-fg);
    font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
   9. Boutons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 7px 14px;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.9;
}

.btn--primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn--primary:hover {
    background: var(--accent-600);
}

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

.btn--dark:hover {
    background: var(--primary-600);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--secondary);
}

.btn--ghost:hover {
    background: var(--surface-2);
    color: var(--fg);
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--danger:hover {
    background: #b91c1c;
}

.btn--sm {
    padding: 4px 10px;
    min-height: 28px;
    font-size: var(--text-sm);
}

.btn--icon {
    padding: 6px;
    min-width: 32px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-group {
    display: inline-flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   10. Formulaires
   -------------------------------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field__label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--secondary);
}

.field__label .req {
    color: var(--danger);
    margin-left: 2px;
}

.field__hint {
    font-size: var(--text-xs);
    color: var(--muted-fg);
}

.field__error {
    font-size: var(--text-xs);
    color: var(--danger);
    font-weight: 600;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 7px 10px;
    min-height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--text-base);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
    outline: none;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

.textarea {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23475569'%3E%3Cpath d='M5.2 7.5 10 12.3l4.8-4.8'  stroke='%23475569' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

.checkbox,
.radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    cursor: pointer;
    min-height: 30px;
}

.checkbox input,
.radio input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 var(--space-6);
}

.fieldset__legend {
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-fg);
    padding: 0 0 var(--space-3);
    width: 100%;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

/* Barre de filtres */
.filters {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius) var(--radius) 0 0;
}

.filters .field {
    min-width: 160px;
}

/* --------------------------------------------------------------------------
   11. Alertes
   -------------------------------------------------------------------------- */

.alerts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: var(--text-base);
}

.alert svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert--success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert--error   { background: var(--danger-soft);  border-color: #fecaca; color: #991b1b; }
.alert--warning { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }
.alert--info    { background: var(--info-soft);    border-color: #bae6fd; color: #075985; }

.alert__close {
    margin-left: auto;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 2px;
}

.alert__close:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   12. Pagination
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.pagination__info {
    color: var(--muted-fg);
    font-size: var(--text-sm);
    margin-right: auto;
}

.pagination__link {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--surface);
}

.pagination__link:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.pagination__link.is-current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* --------------------------------------------------------------------------
   13. Graphiques (SVG / CSS, sans dépendance)
   -------------------------------------------------------------------------- */

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    height: 168px;
    padding-top: var(--space-4);
}

.chart-bars__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.chart-bars__bar {
    width: 100%;
    max-width: 46px;
    background: linear-gradient(180deg, var(--accent) 0%, #0284c7 100%);
    border-radius: 3px 3px 0 0;
    min-height: 3px;
    transition: filter var(--transition);
}

.chart-bars__item:hover .chart-bars__bar {
    filter: brightness(1.15);
}

.chart-bars__label {
    font-size: var(--text-xs);
    color: var(--muted-fg);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.chart-bars__value {
    font-size: var(--text-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chart-legend {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    color: var(--muted-fg);
    margin-top: var(--space-3);
}

.chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend__swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.progress {
    height: 6px;
    background: var(--muted);
    border-radius: 999px;
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

.progress__fill--warning { background: var(--warning); }
.progress__fill--danger { background: var(--danger); }
.progress__fill--success { background: var(--success); }

/* --------------------------------------------------------------------------
   14. Emploi du temps
   -------------------------------------------------------------------------- */

.timetable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    min-width: 780px;
}

.timetable th {
    background: var(--surface-2);
    padding: var(--space-2);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-fg);
    border-radius: var(--radius-sm);
}

.timetable td {
    padding: 0;
    vertical-align: top;
    width: 16%;
}

.timetable__time {
    width: 76px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--muted-fg);
    text-align: center;
    padding: var(--space-2) 0;
    white-space: nowrap;
}

.slot {
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    min-height: 56px;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    font-size: var(--text-xs);
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100%;
}

.slot__subject {
    font-weight: 700;
    color: var(--primary);
    line-height: 1.25;
}

.slot__meta {
    color: var(--muted-fg);
}

.slot__delete {
    align-self: flex-end;
    margin-top: auto;
    background: none;
    border: 0;
    color: var(--danger);
    cursor: pointer;
    font-size: var(--text-xs);
    padding: 0;
}

.slot--empty {
    background: var(--surface-2);
    border-left-color: var(--border-strong);
    color: var(--border-strong);
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------------------------
   15. Divers
   -------------------------------------------------------------------------- */

.definition-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.definition {
    min-width: 0;
}

.definition__label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-fg);
    font-weight: 600;
}

.definition__value {
    font-weight: 600;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
}

.tabs__link {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--muted-fg);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tabs__link:hover {
    color: var(--fg);
    text-decoration: none;
}

.tabs__link.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    color: var(--muted-fg);
}

.empty-state svg {
    width: 36px;
    height: 36px;
    margin: 0 auto var(--space-3);
    color: var(--border-strong);
}

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.muted { color: var(--muted-fg); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }

.timeline {
    position: relative;
    padding-left: var(--space-5);
}

.timeline__item {
    position: relative;
    padding-bottom: var(--space-5);
    border-left: 2px solid var(--border);
    padding-left: var(--space-4);
    margin-left: 4px;
}

.timeline__item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline__dot {
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border-strong);
}

.timeline__item.is-done .timeline__dot {
    background: var(--success);
    border-color: var(--success);
}

.timeline__item.is-current .timeline__dot {
    background: var(--accent);
    border-color: var(--accent);
}

/* Messagerie */
.thread {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.thread:hover {
    background: var(--surface-2);
}

.bubble {
    max-width: 68ch;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    font-size: var(--text-base);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.bubble--own {
    background: var(--accent-soft);
    margin-left: auto;
}

/* --------------------------------------------------------------------------
   16. Authentification et pages publiques
   -------------------------------------------------------------------------- */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth__aside {
    background: var(--primary);
    color: #e2e8f0;
    padding: var(--space-10);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-image: radial-gradient(circle at 20% 15%, rgba(3, 105, 161, 0.45) 0%, transparent 55%);
}

.auth__aside h1 {
    color: #fff;
    font-size: 2rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
    max-width: 18ch;
}

.auth__features {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font-size: var(--text-base);
}

.auth__feature {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.auth__feature svg {
    width: 17px;
    height: 17px;
    color: #38bdf8;
    flex-shrink: 0;
    margin-top: 2px;
}

.auth__panel {
    display: grid;
    place-items: center;
    padding: var(--space-8);
    background: var(--surface);
}

.auth__form {
    width: 100%;
    max-width: 380px;
}

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
}

.public-page {
    max-width: 880px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-5) var(--space-10);
}

.public-header {
    background: var(--primary);
    color: #fff;
    padding: var(--space-6) var(--space-5);
}

.public-header__inner {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* --------------------------------------------------------------------------
   17. Responsive : la barre latérale devient un tiroir
   -------------------------------------------------------------------------- */

.sidebar__toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
}

.sidebar__toggle svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform var(--transition);
        z-index: 60;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open { transform: translateX(0); }

    .sidebar__toggle { display: inline-grid; place-items: center; }

    .content { padding: var(--space-4); }

    .scrim {
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.45);
        z-index: 50;
    }
}

/* --------------------------------------------------------------------------
   18. Impression
   -------------------------------------------------------------------------- */

@media print {
    .sidebar,
    .topbar,
    .page-head__actions,
    .filters,
    .form-actions,
    .pagination,
    .no-print {
        display: none !important;
    }

    .app { grid-template-columns: 1fr; }
    body { background: #fff; font-size: 11pt; }
    .card { border: 1px solid #d0d7de; box-shadow: none; break-inside: avoid; }
    .content { padding: 0; }
    a { color: inherit; text-decoration: none; }
}
