/* ==========================================================================
   BO LDDP — feuille de style du socle
   Palettes : « Identité » (sombre) · gris intermédiaire · « Décision » (clair)
   Typo : EB Garamond (titres) · Space Mono (labels, métadonnées, UI)
   ========================================================================== */

@font-face {
    font-family: "EB Garamond";
    src: url("../fonts/eb-garamond.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Space Mono";
    src: url("../fonts/space-mono.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Space Mono";
    src: url("../fonts/space-mono-bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

/* ---------- Thèmes ---------- */
:root,
[data-theme="dark"] {
    --bg: #12100E;
    --surface: #1C1917;
    --surface-2: #24201D;
    --border: #322D28;
    --text: #F1EDE4;
    --text-2: #A69C8D;
    --accent: #D98E3B;
    --accent-hover: #8C3B2E;
    --accent-ink: #12100E;
    --danger: #C4543F;
    --success: #7FA36B;
    --warning: #D98E3B;
    color-scheme: dark;
}
[data-theme="gray"] {
    --bg: #2A2622;
    --surface: #35302B;
    --surface-2: #3E3833;
    --border: #4B443D;
    --text: #EDE7DC;
    --text-2: #B3A898;
    --accent: #D98E3B;
    --accent-hover: #B5581E;
    --accent-ink: #1C1917;
    --danger: #D0644E;
    --success: #8DB179;
    --warning: #E0A055;
    color-scheme: dark;
}
[data-theme="light"] {
    --bg: #F3EDE1;
    --surface: #FBF7EE;
    --surface-2: #F6F0E4;
    --border: #E4DBC9;
    --text: #221D18;
    --text-2: #7A7166;
    --accent: #8C3B2E;
    --accent-hover: #B5581E;
    --accent-ink: #FBF7EE;
    --danger: #A8321F;
    --success: #4E7A3A;
    --warning: #B5581E;
    color-scheme: light;
}

:root {
    --font-display: "EB Garamond", Garamond, "Times New Roman", serif;
    --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --radius: 4px;
    --gap: 1.25rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font-body);
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 .6em;
}
h1 { font-size: 2.3rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

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

.mono, .label, .tag, .btn, .nav-link, .crumbs, .stat-label, .hint, th {
    font-family: var(--font-mono);
}
.muted { color: var(--text-2); }
.small { font-size: .82rem; }
.right { text-align: right; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

/* ---------- Barre de navigation ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .7rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: .5rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: .04em;
}
.brand-sub {
    font-family: var(--font-mono);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-2);
}
.nav { display: flex; align-items: center; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav-spacer { flex: 1; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .7rem;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: .8rem;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--accent); background: var(--surface-2); }
.avatar {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    font-size: .75rem;
}
.nav-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: .3rem .6rem;
    font-size: 1.1rem;
    cursor: pointer;
}

@media (max-width: 820px) {
    .topbar { flex-wrap: wrap; }
    .nav-toggle { display: block; }
    .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
    .nav.is-open { display: flex; }
    .nav-spacer { display: none; }
}

/* ---------- Blocs ---------- */
.page-head { margin-bottom: 2rem; }
.page-head h1 { margin-bottom: .2rem; }
.crumbs { margin: 0 0 .3rem; font-size: .8rem; }
.section-title { margin-top: 2.5rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: var(--gap);
}
.card > :last-child { margin-bottom: 0; }
.card-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
}
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .card + .grid-2 { margin-top: var(--gap); }

/* ---------- Tuiles du dashboard ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--gap);
}
.tile {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color .15s, transform .15s;
}
.tile:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }
.tile-icon { font-size: 1.9rem; }
.tile-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; }
.tile-desc { color: var(--text-2); font-size: .88rem; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}
.stat {
    padding: 1.2rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat-value { display: block; font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { display: block; margin-top: .4rem; font-size: .75rem; color: var(--text-2); }
.stat-warn .stat-value { color: var(--danger); }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .72rem; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-disabled td { opacity: .5; }
.card > .table { margin: -.4rem 0; }
@media (max-width: 820px) {
    .card:has(> .table) { overflow-x: auto; }
}

/* ---------- Formulaires ---------- */
.field { display: block; margin: 0 0 1.1rem; border: 0; padding: 0; min-width: 0; }
.label {
    display: block;
    margin-bottom: .35rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-2);
}
legend.label { padding: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
    width: 100%;
    padding: .6rem .75rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
select:disabled, input:disabled { opacity: .6; }
.field .btn-ghost { margin-top: .4rem; }
.hint { margin: .3rem 0 0; font-size: .75rem; color: var(--text-2); }

.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; margin-right: 1rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 1rem; height: 1rem; }
fieldset.is-dimmed { opacity: .45; pointer-events: none; }

.theme-picker { display: flex; gap: 1rem; flex-wrap: wrap; }
.theme-option { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.theme-option input { accent-color: var(--accent); }
.theme-swatch { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--border); }
.theme-swatch[data-swatch="dark"]  { background: linear-gradient(135deg, #12100E 50%, #D98E3B 50%); }
.theme-swatch[data-swatch="gray"]  { background: linear-gradient(135deg, #35302B 50%, #D98E3B 50%); }
.theme-swatch[data-swatch="light"] { background: linear-gradient(135deg, #F3EDE1 50%, #8C3B2E 50%); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-size: .8rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { color: var(--text); border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #F1EDE4; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-small { padding: .35rem .7rem; font-size: .72rem; }
.btn-block { width: 100%; }

/* ---------- Étiquettes, alertes ---------- */
.tag {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-size: .68rem;
    vertical-align: middle;
}
.tag-muted { background: var(--surface-2); color: var(--text-2); }

.alert {
    padding: .85rem 1.1rem;
    margin-bottom: var(--gap);
    border-radius: var(--radius);
    border-left: 3px solid;
    background: var(--surface);
}
.alert-success { border-color: var(--success); }
.alert-error   { border-color: var(--danger); }
.alert-warning { border-color: var(--warning); }

.empty { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { font-size: 3rem; margin-bottom: .5rem; }

/* ---------- Connexion ---------- */
.login { max-width: 380px; margin: 10vh auto 0; }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand .brand-mark { font-size: 3rem; display: block; line-height: 1; }
.login-card { padding: 2rem; }

/* ==========================================================================
   Composants de module (onglets, barres d'outils, tableaux chiffrés, filtres)
   ========================================================================== */
.tabs {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    margin: -1rem 0 1.75rem;
    border-bottom: 1px solid var(--border);
}
.tab {
    padding: .55rem .9rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: .78rem;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: var(--gap);
}
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.card-head h3 { margin: 0; }
.card-head input[type="search"] { max-width: 260px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 var(--gap); }
.grid-2.tight { gap: 0 var(--gap); }

.table-wrap { overflow-x: auto; margin: -.4rem 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { border-top: 2px solid var(--border); border-bottom: 0; font-weight: 700; }
.nowrap { white-space: nowrap; }
form.inline { display: inline; }

.badge {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .7rem;
    background: var(--surface-2);
}
.badge-depot   { color: var(--accent); }
.badge-retour  { color: var(--text-2); }
.badge-facture { color: var(--success); }
.tag-warn { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0 1rem;
    align-items: end;
}
.filters-actions { display: flex; gap: .5rem; margin-bottom: 1.1rem; }
.pagination { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; }

/* Choix segmenté (type de mouvement) */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: .55rem .9rem; font-family: var(--font-mono); font-size: .78rem; color: var(--text-2); border-right: 1px solid var(--border); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Sélecteur de références avec quantités */
.picker-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 .6rem; }
.picker-head .label { margin: 0; }
.picker-head input[type="search"] { flex: 1; min-width: 200px; }
.picker {
    max-height: 26rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.picker-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr auto 5.5rem;
    align-items: center;
    gap: .75rem;
    padding: .45rem .75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: var(--surface-2); }
.picker-row.is-selected { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.picker-row.is-over { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.picker-code { color: var(--accent); }
.picker-stock { color: var(--text-2); white-space: nowrap; }
.picker-stock.is-zero { opacity: .5; }
.picker-qty { text-align: right; padding: .35rem .5rem !important; }
@media (max-width: 640px) {
    .picker-row { grid-template-columns: 1fr 5rem; }
    .picker-code, .picker-stock { grid-column: 1; }
}
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---------- Modulor : barres, contrôles d'import, dépôt de fichiers ---------- */
.bar-cell { width: 22%; min-width: 80px; }
.bar { display: block; height: .5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.table td.strong { font-weight: 700; }
.table td.neg { color: var(--danger); }
.table td.pos { color: var(--success); }
.presets { gap: .3rem; flex-wrap: wrap; }

.checks-list { list-style: none; padding: 0; margin: 0 0 1rem; font-size: .88rem; }
.checks-list li { padding: .2rem 0; }
.checks-list .ok { color: var(--success); }
.checks-list .ko { color: var(--danger); font-weight: 700; }
.checks-list .warn { color: var(--warning); }
details summary { cursor: pointer; color: var(--text-2); margin: .5rem 0; }

.dropzone { border-style: dashed; text-align: center; transition: border-color .15s, background .15s; }
.dropzone.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.dropzone input[type="file"] { display: block; margin: 1rem auto; color: var(--text-2); font-family: var(--font-mono); font-size: .8rem; }
.row-edit > td { background: var(--surface-2); }

/* ==========================================================================
   Sorties : cartes, pochettes, fiche, frise des dates, charte, impression
   ========================================================================== */
.accent { color: var(--accent); }
.sortie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--gap); }
.sortie-card {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); overflow: hidden; transition: border-color .15s, transform .15s;
}
.sortie-card:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }
.sortie-body { display: flex; flex-direction: column; gap: .25rem; padding: .9rem 1rem 1rem; }
.sortie-artiste { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; line-height: 1.1; }
.sortie-album { color: var(--text-2); font-style: italic; }
.formats { display: flex; flex-wrap: wrap; gap: .25rem; margin: .2rem 0; }
.next-event { color: var(--text-2); }
.ventes-mini { color: var(--text-2); border-top: 1px solid var(--border); padding-top: .4rem; margin-top: .2rem; }

.cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.cover-empty { display: grid; place-items: center; font-family: var(--font-mono); color: var(--text-2); font-size: .85rem; }
.cover-large { width: 260px; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

.fiche-head { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 2rem; }
.fiche-titles { flex: 1; min-width: 260px; }
.fiche-titles p { margin: 0 0 .5rem; }
.fiche-artiste { font-size: 2.8rem; margin: 0 0 .2rem; }
.fiche-album { font-family: var(--font-display); font-size: 1.6rem; font-style: italic; color: var(--text-2); }
.infos { display: grid; gap: .7rem; }
.info { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; align-items: baseline; }
.info .label { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    display: grid; grid-template-columns: 7.5rem 1fr auto auto; gap: 1rem; align-items: start;
    padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 0; }
.timeline li.is-past { opacity: .55; }
.timeline li.is-pending .timeline-date { color: var(--warning); }
.agenda-mini .timeline li { grid-template-columns: 9rem 1fr auto; padding: .45rem 0; }
.timeline-body { display: flex; flex-direction: column; gap: .2rem; }
.single-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }

.swatches { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.swatch { display: flex; flex-direction: column; gap: .2rem; width: 120px; }
.swatch-color { display: block; height: 64px; border-radius: var(--radius); border: 1px solid var(--border); }
.swatch-font { display: grid; place-items: center; height: 64px; border-radius: var(--radius); border: 1px solid var(--border); font-size: .8rem; text-align: center; padding: .3rem; }
.charte-form { align-items: end; margin-top: .8rem; }
.inline-fields { display: flex; gap: .4rem; }
.inline-fields input[type="number"] { width: 5rem; }
input[type="color"] { width: 3rem; height: 2.4rem; padding: .15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }

.edit-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--gap); }
.edit-cover input[type="file"] { margin-top: .6rem; font-size: .8rem; }
@media (max-width: 820px) { .edit-layout { grid-template-columns: 1fr; } .timeline li { grid-template-columns: 6rem 1fr auto; } }

.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 4.5rem; }
.perm-scroll { max-height: 32rem; overflow-y: auto; margin-top: .6rem; }

.print-only { display: none; }
@media print {
    body { background: #fff; color: #000; font-size: 11pt; }
    .topbar, .tabs, .no-print, .alert, details summary, .toolbar-actions { display: none !important; }
    details { display: block; } details > * { display: block; }
    .container { max-width: none; padding: 0; }
    .card { border: 0; padding: 0; margin: 0 0 1.2rem; break-inside: avoid; background: none; }
    .print-only { display: block; }
    .cover-large { width: 160px; }
    a { color: #000; text-decoration: underline; }
    .table th, .table td { border-color: #ccc; }
}

/* ---------- Alertes d'échéances (tableau de bord) ---------- */
.alertes { border-left: 3px solid var(--warning); }
.alertes-list { list-style: none; margin: 0; padding: 0; }
.alerte {
    display: grid; grid-template-columns: 10rem 1fr auto; gap: 1rem; align-items: center;
    padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.alerte:last-child { border-bottom: 0; }
.alerte-when { display: flex; flex-direction: column; font-weight: 700; }
.alerte-retard .alerte-when { color: var(--danger); }
.alerte-proche .alerte-when { color: var(--warning); }
.alerte-bientot .alerte-when { color: var(--text-2); }
.alerte-action { display: flex; gap: .4rem; align-items: center; }
.alerte-action input[type="date"] { width: auto; padding: .3rem .5rem; font-size: .8rem; }
.neg { color: var(--danger); }
@media (max-width: 820px) { .alerte { grid-template-columns: 1fr; gap: .4rem; } }

/* ---------- Graphiques SVG (Lddp\Chart) ---------- */
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-mono); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .tick, .chart .legend text { fill: var(--text-2); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 1.5; cursor: help; }
.chart .dot:hover { r: 6; }
.chart .serie-a.line { stroke: var(--accent); }
.chart .serie-a.dot, .chart text.serie-a { fill: var(--accent); }
.chart .serie-b.line { stroke: var(--success); stroke-dasharray: 6 4; }
.chart .serie-b.dot, .chart text.serie-b { fill: var(--success); }
.chart .legend .line { stroke-width: 3; }
.chart .grid.zero { stroke: var(--text-2); stroke-opacity: .5; }

/* ---------- Budget des sorties ---------- */
.badge.statut-paye, .badge.statut-encaisse, .badge.statut-verse { color: var(--success); }
.badge.statut-accorde, .badge.statut-facture, .badge.statut-engage { color: var(--accent); }
.badge.statut-refuse { color: var(--danger); }
.row-auto td { background: var(--surface-2); }
.input-num { width: 6rem; text-align: right; }
.liens-date { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; }
/* Saisie de ventes : colonne prix dans le sélecteur d'articles */
.picker.avec-prix .picker-row { grid-template-columns: 7.5rem 1fr auto 5.5rem 6rem; }
.picker-prix { text-align: right; padding: .35rem .5rem !important; }
@media (max-width: 640px) { .picker.avec-prix .picker-row { grid-template-columns: 1fr 4.5rem 5rem; } }

/* ==========================================================================
   Sorties : planning semestriel
   ========================================================================== */
.planning-card { overflow-x: auto; padding: .5rem 1rem 1rem; }
.planning { min-width: 980px; }
.plan-row { display: grid; grid-template-columns: 15rem 1fr; border-bottom: 1px solid var(--border); }
.plan-row:last-child { border-bottom: 0; }
.plan-label { display: flex; flex-direction: column; justify-content: center; gap: .1rem; padding: .5rem .8rem .5rem 0; min-width: 0; }
.plan-label a { color: var(--text); }
.plan-label a:hover { color: var(--accent); }
.plan-label .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-track { position: relative; height: 3.2rem; }
.avec-libelles .plan-row:not(.plan-head) .plan-track { height: 6.2rem; }

.plan-head .plan-track { height: 2.6rem; }
.plan-month {
    position: absolute; top: .3rem; text-align: center;
    font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2);
    border-left: 1px solid var(--border);
}
.plan-week { position: absolute; bottom: .15rem; transform: translateX(-50%); font-family: var(--font-mono); font-size: .55rem; color: var(--text-2); opacity: .6; }
.plan-week::before { content: ""; position: absolute; left: 50%; top: -.35rem; height: .3rem; border-left: 1px solid var(--border); }
.plan-sep { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); opacity: .6; }
.plan-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); opacity: .7; z-index: 1; }

.plan-bar {
    position: absolute; top: 50%; height: 6px; transform: translateY(-50%);
    background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 999px;
}
.plan-bar.depuis-avant { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.plan-bar.continue-apres { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.plan-bar.continue-apres::after { content: "▸"; position: absolute; right: -.7rem; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: .8rem; }
.plan-bar.depuis-avant::before { content: "◂"; position: absolute; left: -.7rem; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: .8rem; }

.plan-ev {
    position: absolute; top: 50%; z-index: 2;
    transform: translate(calc(-50% + var(--decal, 0) * 1.7rem), -50%);
    display: flex; flex-direction: column; align-items: center; color: var(--text);
}
.plan-ev:hover { z-index: 5; color: var(--text); }
.plan-dot {
    display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--accent); font-size: .78rem; line-height: 1;
}
.plan-ev:hover .plan-dot { transform: scale(1.2); }
.plan-ev.principal .plan-dot { width: 2rem; height: 2rem; background: var(--accent); font-size: .95rem; }
.plan-ev.is-pending .plan-dot { border-style: dashed; border-color: var(--text-2); }
.plan-txt {
    display: none; position: absolute; top: 100%; margin-top: .15rem;
    font-family: var(--font-mono); font-size: .6rem; white-space: nowrap; color: var(--text-2);
}
.plan-ev.niveau-0 .plan-txt { top: auto; bottom: 100%; margin: 0 0 .15rem; }
.plan-ev.niveau-1 .plan-txt { top: 100%; margin-top: .15rem; }
.plan-ev.niveau-2 .plan-txt { top: auto; bottom: 100%; margin: 0 0 1.05rem; }
.plan-ev.niveau-3 .plan-txt { top: 100%; margin-top: 1.05rem; }
.avec-libelles .plan-txt, .plan-ev:hover .plan-txt { display: block; }
.plan-ev:hover .plan-txt { color: var(--text); background: var(--surface); padding: 0 .2rem; border-radius: 2px; }

.plan-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .8rem; color: var(--text-2); font-family: var(--font-mono); }
.legend-pending { display: inline-grid !important; width: 1rem !important; height: 1rem !important; border-style: dashed !important; border-color: var(--text-2) !important; font-size: .6rem !important; vertical-align: middle; }
.legend-today { display: inline-block; width: 0; height: .9rem; border-left: 2px solid var(--danger); vertical-align: middle; margin-right: .2rem; }

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    .planning-card { overflow: visible; }
    .planning { min-width: 0; }
    .plan-dot { border-color: #000 !important; background: #fff !important; }
    .plan-bar { background: #ddd !important; }
    .plan-txt { display: block !important; color: #000 !important; }
}
.plan-ev.bord-droit .plan-txt { right: 0; }
.plan-ev.bord-gauche .plan-txt { left: 0; }
.plan-ev.bord-droit { transform: translate(calc(-50% - var(--decal, 0) * 1.7rem), -50%); }
