/*
 * METEORA : système de design de l'espace client et de l'admin.
 * Jetons en variables CSS, thème Nuit par défaut (maquettes), thème Jour via [data-theme="jour"].
 * Règles : jamais la couleur seule (toujours un texte ou une flèche), un seul bouton principal par écran,
 * contraste 4,5:1, cibles de 44 px, focus visible, pas d'emoji.
 */

:root {
    --font-display: Sora, "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
    --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
    --radius-sm: 8px; --radius-md: 16px; --radius-lg: 24px; --radius-full: 9999px;
    --target: 44px;
    --sidebar: 248px;

    /* Nuit (par défaut) */
    --bg: #1b003e;
    --bg-sidebar: #13002c;
    --surface: #24094b;
    --surface-2: #2a1052;
    --surface-3: #34176a;
    --line: #3d2470;
    --line-strong: #6b5a94;
    --ink: #f3fbfc;
    --ink-muted: #b9b2cc;
    --ink-soft: #9a90b5;
    --accent: #69f7f3;
    --accent-ink: #1b003e;
    --accent-soft: #103a52;
    --brand: #16b3bd;
    --link: #69f7f3;
    --good: #68f9d5;
    --good-bg: #0f3b45;
    --warn: #ffc66b;
    --warn-bg: #3d2a14;
    --bad: #ff8fa0;
    --bad-bg: #4a1430;
    --info: #9fc7ff;
    --info-bg: #1d2a5c;
    --chart-line: #69f7f3;
    --chart-prev: #8a7fa6;
    --chart-area: rgba(105, 247, 243, .14);
    --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -8px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

[data-theme="jour"] {
    --bg: #f4f9fa;
    --bg-sidebar: #ffffff;
    --surface: #ffffff;
    --surface-2: #f4f9fa;
    --surface-3: #e3f6f7;
    --line: #cfe3e7;
    --line-strong: #7d8fa3;
    --ink: #1b003e;
    --ink-muted: #4e4566;
    --ink-soft: #5f5778;
    --accent: #0b6f78;
    --accent-ink: #ffffff;
    --accent-soft: #e3f6f7;
    --brand: #16b3bd;
    --link: #0b6f78;
    --good: #0f7a52;
    --good-bg: #e2f5ec;
    --warn: #9a5800;
    --warn-bg: #fdf0dc;
    --bad: #c2253d;
    --bad-bg: #fde7ea;
    --info: #2b4fa8;
    --info-bg: #e6edfb;
    --chart-line: #0b6f78;
    --chart-prev: #7d8fa3;
    --chart-area: rgba(22, 179, 189, .14);
    --focus: 0 0 0 2px #ffffff, 0 0 0 4px #1b003e;
    --shadow: 0 1px 2px #1b003e14, 0 2px 6px #1b003e0f;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/24px var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
/* Icônes dans un lien ou un bouton : taille du texte par défaut (les composants précisent la leur). */
:where(a, button, span, h1, h2, h3) > svg { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; line-height: 38px; font-weight: 600; }
h2 { font-size: 21px; line-height: 28px; font-weight: 600; }
h3 { font-size: 17px; line-height: 24px; font-weight: 600; }
p { margin: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-4) 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: var(--space-4); top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: var(--space-4); }
.muted { color: var(--ink-muted); }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; line-height: 18px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font: 600 12px/20px var(--font-display); letter-spacing: .32em; text-transform: uppercase; color: var(--accent); }
.lead { font-size: 17px; line-height: 28px; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.span-all { grid-column: 1 / -1; }

/* ---------- Mise en page ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    flex: 0 0 var(--sidebar);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    padding: var(--space-6) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.logo { display: inline-flex; align-items: center; min-height: var(--target); }
/* Barre latérale : le logo occupe toute la largeur disponible. */
.sidebar .logo { display: block; width: 100%; padding: 0 6px; }
.sidebar .logo img { width: 100%; height: auto; }
/* Un seul logo visible selon le thème (sélecteurs plus forts que les règles de taille ci-dessus). */
.logo img.logo-nuit { display: block; }
.logo img.logo-jour { display: none; }
[data-theme="jour"] .logo img.logo-nuit { display: none; }
[data-theme="jour"] .logo img.logo-jour { display: block; }
.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav a {
    display: flex; align-items: center; gap: var(--space-3);
    min-height: var(--target); padding: 0 14px; border-radius: var(--radius-full);
    text-decoration: none; font-weight: 600; color: var(--ink-muted);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav .count {
    margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-full);
    background: var(--surface-3); color: var(--ink); font-size: 12px; line-height: 22px; font-weight: 700; text-align: center;
}
.nav .count.is-alert { background: var(--bad-bg); color: var(--bad); }
.sidebar-foot { margin-top: auto; padding: var(--space-4) 6px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 20px; display: flex; flex-direction: column; gap: var(--space-3); }
.site-switch {
    display: flex; flex-direction: column; justify-content: center; width: 100%;
    min-height: 52px; padding: 6px 14px; border-radius: var(--radius-md);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.site-switch .label { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.site-switch select, .site-switch strong { font: 600 15px/20px var(--font-sans); color: var(--ink); background: transparent; border: 0; padding: 0; width: 100%; }
.site-switch select:focus-visible { box-shadow: none; outline: none; }
.site-switch:focus-within { box-shadow: var(--focus); }

.main { flex: 1 1 auto; min-width: 0; padding: var(--space-8) var(--space-10) var(--space-16); display: flex; flex-direction: column; gap: var(--space-6); }
.main-narrow { max-width: 1180px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.topbar-mobile { display: none; }
.bottom-nav { display: none; }

@media (max-width: 767px) {
    .app { display: block; }
    .sidebar { display: none; }
    .topbar-mobile {
        display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
        position: sticky; top: 0; z-index: 20;
        padding: var(--space-2) var(--space-4); background: var(--bg-sidebar); border-bottom: 1px solid var(--line);
    }
    .topbar-mobile .logo img { height: 22px; width: auto; }
    .main { padding: var(--space-5) var(--space-4) calc(88px + env(safe-area-inset-bottom)); gap: var(--space-5); }
    h1 { font-size: 24px; line-height: 32px; }
    .bottom-nav {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        background: var(--bg-sidebar); border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav a {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 52px; padding: 4px 2px; border-radius: var(--radius-sm);
        color: var(--ink-muted); text-decoration: none; font-size: 11px; line-height: 14px; font-weight: 600; text-align: center;
        position: relative;
    }
    .bottom-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
    .bottom-nav svg { width: 22px; height: 22px; }
    .bottom-nav .dot { position: absolute; top: 4px; right: calc(50% - 18px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--surface-3); color: var(--ink); font-size: 11px; line-height: 18px; }
    .hide-mobile { display: none !important; }
}
@media (min-width: 768px) { .show-mobile { display: none !important; } }

/* Bandeau « Voir comme le client » : permanent, au-dessus de tout */
.view-as-banner {
    position: sticky; top: 0; z-index: 50;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--warn-bg); color: var(--warn); border-bottom: 2px solid var(--warn);
    font-weight: 600; font-size: 14px; text-align: center;
}
.view-as-banner form { display: inline; }
.view-as-banner .btn { min-height: 36px; }

/* ---------- Composants ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0;
}
.card-tight { padding: var(--space-4); gap: var(--space-3); border-radius: var(--radius-md); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.card-foot { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.card.is-internal { border-style: dashed; }
.internal-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--target); padding: 0 20px; border-radius: var(--radius-full);
    border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
    font: 600 15px/20px var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; color: var(--link); padding: 0 12px; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; text-decoration: underline; cursor: pointer; min-height: var(--target); }

/* Pastilles d'état : toujours un texte, la couleur ne fait que doubler l'information */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: var(--radius-full);
    font-size: 13px; line-height: 20px; font-weight: 600; white-space: nowrap;
    background: var(--surface-3); color: var(--ink);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before { display: none; }
.tone-good, .tone-success { background: var(--good-bg); color: var(--good); }
.tone-warn, .tone-warning { background: var(--warn-bg); color: var(--warn); }
.tone-bad, .tone-danger { background: var(--bad-bg); color: var(--bad); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-neutral { background: var(--surface-3); color: var(--ink-muted); }
.tag { display: inline-flex; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; line-height: 20px; font-weight: 600; background: var(--surface-3); color: var(--ink-muted); white-space: nowrap; }

/* Indicateurs */
.kpi { display: flex; flex-direction: column; gap: var(--space-2); }
.kpi .kpi-label { font-size: 14px; line-height: 20px; color: var(--ink-muted); font-weight: 500; }
.kpi .kpi-value { font: 700 40px/44px var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-value.is-sm { font-size: 30px; line-height: 36px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; line-height: 20px; font-weight: 600; }
.delta.tone-good { background: none; color: var(--good); }
.delta.tone-bad { background: none; color: var(--bad); }
.delta.tone-neutral { background: none; color: var(--ink-muted); }
.delta .arrow { font-family: var(--font-sans); }
.provisional { font-size: 12px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .06em; }

/* Barre de progression (budget) */
.meter { height: 10px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; position: relative; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter .marker { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }

/* Barres horizontales (origine des demandes) */
.bars { display: flex; flex-direction: column; gap: var(--space-3); }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); align-items: center; }
.bar-row .bar { grid-column: 1 / -1; height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* Sélecteur de période */
.segmented { display: inline-flex; padding: 4px; border-radius: var(--radius-full); background: var(--bg-sidebar); border: 1px solid var(--line); }
.segmented a {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: var(--radius-full);
    color: var(--ink-muted); text-decoration: none; font-weight: 600; font-size: 14px;
}
.segmented a[aria-current="true"] { background: var(--surface-3); color: var(--ink); }

/* Onglets */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs a {
    display: inline-flex; align-items: center; min-height: var(--target); padding: 0 var(--space-4);
    color: var(--ink-muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-2)); padding: 0 var(--space-2); }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
.table td.num, .table th.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
@media (max-width: 767px) {
    .table-stack thead { display: none; }
    .table-stack tr { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
    .table-stack td { border: 0; padding: 0; }
    .table-stack td[data-label]::before { content: attr(data-label) " : "; color: var(--ink-muted); font-size: 13px; }
    .table-stack tr:last-child { border-bottom: 0; }
}

/* Listes */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); display: flex; gap: var(--space-3); align-items: flex-start; justify-content: space-between; }
.list > li:last-child { border-bottom: 0; }
.list .item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list .item-title { font-weight: 600; }
.list .item-meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: var(--space-3); }
.timeline li::before { content: ""; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field legend, .form label.required, .form-label { font-weight: 600; font-size: 14px; line-height: 20px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], select, textarea {
    width: 100%; min-height: var(--target); padding: 10px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--bg-sidebar); color: var(--ink); font: 400 15px/22px var(--font-sans);
}
textarea { resize: vertical; min-height: 96px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: var(--focus); border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); cursor: pointer; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--space-2); }
.choice-grid > div, .choice-grid label.choice { display: flex; }
.choice-grid label {
    flex: 1; display: flex; align-items: center; gap: var(--space-2);
    min-height: var(--target); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; font-weight: 500;
}
.choice-grid input:checked + label, .choice-grid label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.help, .form-help { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.form-error, .field ul { color: var(--bad); font-size: 13px; line-height: 18px; margin: 0; padding: 0; list-style: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Messages */
.flash { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid currentColor; font-weight: 500; }
.flash.tone-good { background: var(--good-bg); color: var(--good); }
.flash strong { font-weight: 700; }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border-left: 4px solid var(--accent); }
.notice.tone-warn { background: var(--warn-bg); border-left-color: var(--warn); color: var(--ink); }
.notice.tone-bad { background: var(--bad-bg); border-left-color: var(--bad); color: var(--ink); }

/* États vides */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-6); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); }
.empty strong { color: var(--ink); font-size: 16px; }

/* Graphiques SVG (ChartBuilder) */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-muted); font: 500 11px var(--font-sans); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-prev { fill: none; stroke: var(--chart-prev); stroke-width: 2; stroke-dasharray: 5 5; }
.chart .area { fill: var(--chart-area); }
.chart .dot { fill: var(--chart-line); }
.chart .marker-line { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .marker-flag { fill: var(--warn); }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 13px; color: var(--ink-muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 18px; height: 0; border-top: 3px solid var(--chart-line); }
.chart-legend .swatch.prev { border-top: 2px dashed var(--chart-prev); }
.chart-legend .swatch.marker { border-top: 2px dashed var(--warn); }

/* Écrans de connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.auth-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: var(--space-6); }
.auth-card .logo img { height: 30px; width: auto; }
.auth-foot { font-size: 13px; color: var(--ink-muted); text-align: center; }
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--ink-muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Interrupteur de thème Nuit / Jour */
.theme-toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); background: none; border: 0; padding: 0; color: var(--ink-muted); font: 500 14px var(--font-sans); cursor: pointer; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-switch {
    display: inline-flex; align-items: center; gap: var(--space-3);
    min-height: var(--target); padding: 0; background: none; border: 0; cursor: pointer;
    color: var(--ink-muted); font: 500 14px/20px var(--font-sans); text-align: left;
}
.theme-switch.is-centered { margin: 0 auto; }
.theme-switch-track {
    position: relative; flex: none; width: 52px; height: 28px; border-radius: var(--radius-full);
    background: var(--surface-3); border: 1px solid var(--line-strong);
    display: inline-flex; align-items: center; justify-content: space-between; padding: 0 6px;
}
.theme-switch-icon { display: inline-flex; color: var(--ink-soft); }
.theme-switch-icon svg { width: 14px; height: 14px; }
.theme-switch-thumb {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
[data-theme="jour"] .theme-switch-thumb { transform: translateX(24px); }
.theme-switch-label.is-jour { display: none; }
[data-theme="jour"] .theme-switch-label.is-nuit { display: none; }
[data-theme="jour"] .theme-switch-label.is-jour { display: inline; }
.theme-switch:hover .theme-switch-track { border-color: var(--accent); }
.theme-switch:focus-visible { box-shadow: none; }
.theme-switch:focus-visible .theme-switch-track { box-shadow: var(--focus); }

@media (prefers-reduced-motion: no-preference) {
    .btn, .nav a, .tabs a, .segmented a { transition: background-color .15s ease, color .15s ease; }
    .theme-switch-thumb { transition: transform .2s ease; }
}
@media print {
    .sidebar, .bottom-nav, .topbar-mobile, .view-as-banner, .btn { display: none !important; }
    body { background: #fff; color: #000; }
}
