:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .25);

  /* Statuts de commande : fond / texte */
  --s-a_commander-bg: #fef3c7; --s-a_commander-fg: #92400e;
  --s-commandee-bg: #dbeafe; --s-commandee-fg: #1e40af;
  --s-confirmee-bg: #e0e7ff; --s-confirmee-fg: #3730a3;
  --s-expediee-bg: #f3e8ff; --s-expediee-fg: #6b21a8;
  --s-livree_partielle-bg: #ecfccb; --s-livree_partielle-fg: #3f6212;
  --s-livree-bg: #dcfce7; --s-livree-fg: #166534;
  --s-annulee-bg: #f1f5f9; --s-annulee-fg: #64748b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #0f172a;
    --border: #1f2a3c;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: #172554;
    --danger: #f87171;
    --danger-soft: #2a1215;
    --warn: #fbbf24;
    --warn-soft: #2a1f0a;
    --ok: #4ade80;
    --ok-soft: #0c2416;
    --sidebar: #020617;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --s-a_commander-bg: #422006; --s-a_commander-fg: #fcd34d;
    --s-commandee-bg: #172554; --s-commandee-fg: #93c5fd;
    --s-confirmee-bg: #1e1b4b; --s-confirmee-fg: #a5b4fc;
    --s-expediee-bg: #3b0764; --s-expediee-fg: #d8b4fe;
    --s-livree_partielle-bg: #1a2e05; --s-livree_partielle-fg: #bef264;
    --s-livree-bg: #052e16; --s-livree-fg: #86efac;
    --s-annulee-bg: #1e293b; --s-annulee-fg: #94a3b8;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

/* ---- Layout ------------------------------------------------------------ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 650; font-size: 15px; }
.brand-logo { background: var(--primary); border-radius: 7px; width: 30px; height: 30px; display: grid; place-items: center; color: #fff; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(59,130,246,.18); color: #fff; }
.nav .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.sidebar-foot { padding: 14px; }
.main { flex: 1; min-width: 0; }
.view { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; z-index: 20; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 10px 14px; }
  .brand span:last-child { display: none; }
  .nav { flex-direction: row; overflow-x: auto; padding: 6px; flex: 1 1 0; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .nav a svg { display: none; }
  .sidebar-foot { padding: 4px 8px; }
  .sidebar-foot #btn-nouveau-dossier { display: none; }
  .view { padding: 16px 16px 50px; }
}

/* ---- En-têtes de page ---------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }

/* ---- Boutons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #cbd5e1; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-block { width: 100%; }
.icon-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font: inherit; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---- Cartes ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 310px; align-items: start; }
@media (max-width: 1200px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---- KPI --------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; display: block; color: inherit; border-left: 4px solid var(--border); }
.kpi:hover { text-decoration: none; border-color: var(--primary); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 28px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi.warn { border-left-color: #f59e0b; }
.kpi.danger { border-left-color: var(--danger); }
.kpi.ok { border-left-color: #22c55e; }
.kpi.info { border-left-color: var(--primary); }
.kpi.danger .value { color: var(--danger); }

/* ---- Badges ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.st { background: var(--s-bg); color: var(--s-fg); }
.st-a_commander { --s-bg: var(--s-a_commander-bg); --s-fg: var(--s-a_commander-fg); }
.st-commandee { --s-bg: var(--s-commandee-bg); --s-fg: var(--s-commandee-fg); }
.st-confirmee { --s-bg: var(--s-confirmee-bg); --s-fg: var(--s-confirmee-fg); }
.st-expediee { --s-bg: var(--s-expediee-bg); --s-fg: var(--s-expediee-fg); }
.st-livree_partielle { --s-bg: var(--s-livree_partielle-bg); --s-fg: var(--s-livree_partielle-fg); }
.st-livree { --s-bg: var(--s-livree-bg); --s-fg: var(--s-livree-fg); }
.st-annulee { --s-bg: var(--s-annulee-bg); --s-fg: var(--s-annulee-fg); text-decoration: line-through; }

.ph { border: 1px solid currentColor; background: transparent; }
.ph-a_preparer, .ph-en_pause, .ph-termine, .ph-annule { color: var(--muted); }
.ph-commandes_a_passer { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.ph-attente_livraisons { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.ph-pret_a_planifier { color: #0f766e; background: #ccfbf1; border-color: transparent; }
.ph-planifie { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
@media (prefers-color-scheme: dark) { .ph-pret_a_planifier { color: #5eead4; background: #042f2e; } }

/* Pastilles fournisseurs dans la liste des dossiers */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; font-weight: 600; white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.chip.late { box-shadow: inset 0 0 0 1.5px var(--danger); }

/* ---- Tableaux ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
tr.row-late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* Sélecteur de statut intégré */
select.status-select {
  appearance: none; -webkit-appearance: none; border: none; border-radius: 99px; padding: 3px 24px 3px 10px;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; background-color: var(--s-bg); color: var(--s-fg);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 8px) 55%; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
select.status-select option { background: var(--surface); color: var(--text); }

/* ---- Barre de progression --------------------------------------------- */
.progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress-bar { flex: 1; height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; display: flex; }
.progress-bar span { display: block; height: 100%; }
.progress-bar .p-livre { background: #22c55e; }
.progress-bar .p-cours { background: #60a5fa; }
.progress-label { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Étapes du dossier -------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 4px 0 18px; }
.step { position: relative; padding: 0 8px; text-align: center; }
.step::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: #22c55e; }
.step .dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface); border: 3px solid var(--border); color: var(--muted); }
.step.done .dot { background: #22c55e; border-color: #22c55e; color: #fff; }
.step.current .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.warning .dot { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.step .lbl { font-weight: 600; font-size: 13px; }
.step .val { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .step .lbl { font-size: 11px; } .step .val { display: none; } }

/* ---- Alertes ----------------------------------------------------------- */
.alert { border-radius: var(--radius); padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; }
.alert + .alert { margin-top: 8px; }
.alert-danger { background: var(--danger-soft); border-color: rgba(220, 38, 38, .25); color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: rgba(180, 83, 9, .25); color: var(--warn); }
.alert-ok { background: var(--ok-soft); border-color: rgba(21, 128, 61, .25); color: var(--ok); }
.alert-info { background: var(--primary-soft); border-color: rgba(37, 99, 235, .2); color: var(--primary); }
.alert b { font-weight: 650; }
.alerts { margin-bottom: 16px; }

/* ---- Listes compactes (tableau de bord) ------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list li .grow { flex: 1; min-width: 0; }
.list li .grow > div { overflow: hidden; text-overflow: ellipsis; }
.list li.clickable { cursor: pointer; }
.list li.clickable:hover { background: var(--surface-2); }
.date-pill { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-align: right; }
.date-pill.late { color: var(--danger); font-weight: 600; }

.supplier-group { border-bottom: 1px solid var(--border); }
.supplier-group:last-child { border-bottom: none; }
.supplier-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; flex-wrap: wrap; }
.supplier-group-head .name { font-weight: 650; }
.supplier-group-head .contact { color: var(--muted); font-size: 12.5px; }
.supplier-group .list li { padding: 7px 16px 7px 28px; border-bottom: none; }
.supplier-group { padding-bottom: 8px; }

/* ---- Filtres ----------------------------------------------------------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.input, select.input, textarea.input {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px;
  padding: 7px 10px; font: inherit; min-width: 0;
}
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.search { min-width: 240px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.tab:hover { border-color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .n { opacity: .7; margin-left: 3px; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

/* ---- Fiches info -------------------------------------------------------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 20px; }
.info .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.info .v { margin-top: 2px; font-weight: 500; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; }

/* ---- Commandes dans le dossier ----------------------------------------- */
.lines-row td { background: var(--surface-2); padding: 0 12px 12px 12px; }
.lines-table { width: 100%; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lines-table th, .lines-table td { padding: 6px 10px; }
.toggle-lines { color: var(--muted); font-size: 12px; cursor: pointer; border: none; background: none; padding: 0; font: inherit; font-size: 12px; }
.toggle-lines:hover { color: var(--primary); }

/* ---- Journal ----------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.t-note::before { background: #f59e0b; }
.timeline li.t-statut::before { background: var(--primary); }
.timeline li.t-planning::before { background: #22c55e; }
.timeline li.t-commande::before { background: #a855f7; }
.timeline .when { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.timeline .msg { margin-top: 1px; }
.timeline li.t-note .msg { background: var(--warn-soft); padding: 6px 9px; border-radius: 7px; white-space: pre-wrap; }
.note-form { display: flex; gap: 8px; margin-bottom: 14px; }
.note-form textarea { flex: 1; resize: vertical; min-height: 38px; }

/* ---- Planning ---------------------------------------------------------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { min-width: 170px; text-transform: capitalize; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 110px; padding: 5px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .num { opacity: .45; }
.cal-day.weekend { background: var(--surface-2); }
.cal-day .num { font-size: 12px; font-weight: 600; color: var(--muted); padding: 1px 3px; }
.cal-day.today .num { background: var(--primary); color: #fff; border-radius: 6px; align-self: flex-start; padding: 1px 6px; }
.ev { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; overflow: hidden; word-break: break-word; cursor: pointer; border-left: 3px solid; color: var(--text); }
.ev:hover { filter: brightness(.96); text-decoration: none; }
.ev-intervention { background: var(--ok-soft); border-color: #22c55e; font-weight: 600; }
.ev-intervention.not-ready { background: var(--warn-soft); border-color: #f59e0b; }
.ev-livraison { background: var(--primary-soft); border-color: var(--primary); }
.ev-livraison.done { background: var(--surface-2); border-color: #94a3b8; color: var(--muted); }
.ev-livraison.late { background: var(--danger-soft); border-color: var(--danger); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
@media (max-width: 860px) {
  .cal-day { min-height: 70px; }
  .ev { font-size: 10px; padding: 1px 3px; }
}

/* ---- Modale ------------------------------------------------------------ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; animation: pop .15s ease-out; }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.field label .req { color: var(--danger); }
.field .input { width: 100%; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin: 6px 0 -2px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.checklist label { display: flex; gap: 7px; align-items: flex-start; font-weight: 400; font-size: 13px; cursor: pointer; padding: 3px; }
.checklist label small { color: var(--muted); display: block; }

.lines-editor { width: 100%; }
.lines-editor th { padding: 6px; font-size: 11px; }
.lines-editor td { padding: 4px; border-bottom: none; }
.lines-editor .input { width: 100%; padding: 6px 8px; }
.lines-editor .c-qte { width: 80px; }
.lines-editor .c-pu { width: 110px; }
.lines-editor .c-total { width: 100px; text-align: right; font-variant-numeric: tabular-nums; }
.lines-total { text-align: right; font-weight: 650; padding: 8px 6px 0; }

/* ---- Toast ------------------------------------------------------------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; max-width: 380px; }
.toast.error { background: var(--danger); }

/* ---- Comptes ----------------------------------------------------------- */
.auth-screen { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 40px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px; }
.auth-card h1 { margin: 18px 0 6px; }
.auth-card > p { margin: 0 0 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.auth-brand .brand-logo { color: #fff; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); }
.user-box { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 6px; border-radius: 8px; font: inherit; text-align: left; }
.user-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.user-txt { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; opacity: .7; }
.logout-btn { color: var(--sidebar-text); }
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-weight: 650; font-size: 12.5px; letter-spacing: .02em; }
@media (max-width: 860px) {
  .user-box { margin: 0; padding: 0; border: none; }
  .user-txt { display: none !important; }
  .list li { flex-wrap: wrap; }
}
