/*
 * Épicerie — feuille de style unique (application mobile + console INVEXCAM).
 * Polices système : rien à télécharger, affichage immédiat même hors ligne.
 * Contraste élevé : écrans lus en plein jour, au comptoir.
 */
:root {
  color-scheme: light;
  --ink: #16211c;
  --muted: #56635c;
  --line: #d3dcd6;
  --canvas: #eef3ef;
  --surface: #ffffff;
  --brand: #0b6b44;
  --brand-deep: #08432c;
  --brand-soft: #e1efe7;
  --tag: #f6c344;
  --tag-deep: #8a6400;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a4600;
  --warn-soft: #fff1d6;
  --info: #0b4f8a;
  --info-soft: #e5f0fa;
  --focus: #f6c344;
  --c-sales: #0b6b44;
  --c-margin: #eb6834;
  --c-stock: #2a78d6;
  --grid: #e3e9e5;
  --radius: 12px;
  --radius-small: 8px;
  --tap: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.45 var(--font);
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Structure ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--brand-deep);
  color: #fff;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back {
  background: transparent; border: 0; color: #fff; font: inherit; font-size: 26px; line-height: 1;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; margin-left: -8px;
}
.content { padding: 16px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }

/* ---------- Pastilles et bandeaux ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; white-space: nowrap;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5fd38d; }
.pill.offline::before { background: var(--tag); }
.banner { border-radius: var(--radius); padding: 12px 14px; font-size: 16px; border: 1px solid transparent; }
.banner.info { background: var(--info-soft); color: var(--info); border-color: #bcd6ee; }
.banner.warning { background: var(--warn-soft); color: var(--warn); border-color: #f2cf8f; }
.banner.blocked { background: var(--danger-soft); color: var(--danger); border-color: #f1b5ae; font-weight: 600; }
.banner.danger { background: var(--danger-soft); color: var(--danger); border-color: #f1b5ae; }
.badge {
  display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-deep); white-space: nowrap;
}
.badge.grey { background: #e8ece9; color: var(--muted); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.badge.blue { background: var(--info-soft); color: var(--info); }

/* ---------- Cartes et listes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.item { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-head h3 { flex: 1; min-width: 0; }
.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 12px 16px;
  background: var(--surface); border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.link-row .chev { margin-left: auto; color: var(--muted); font-size: 22px; }
.link-row:disabled { color: var(--muted); cursor: default; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 16px; }
.field .hint { font-size: 14px; color: var(--muted); }
.field .error { font-size: 14px; color: var(--danger); font-weight: 600; }
input, select, textarea {
  font: inherit; font-size: 18px; color: var(--ink);
  min-height: var(--tap); padding: 10px 14px;
  border: 2px solid var(--line); border-radius: var(--radius-small); background: #fff; width: 100%;
}
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(246,195,68,.55); }
input[aria-invalid="true"] { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: var(--radius);
  font: inherit; font-weight: 700; font-size: 18px; cursor: pointer;
  border: 2px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.secondary { background: #fff; color: var(--brand-deep); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); font-weight: 600; }
.btn.small { min-height: 44px; font-size: 16px; padding: 6px 14px; }
.btn.block { width: 100%; }
.btn.busy { position: relative; color: transparent; }
.btn.busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .8s linear infinite;
}
.btn.secondary.busy::after, .btn.danger.busy::after, .btn.ghost.busy::after { border-color: rgba(11,107,68,.3); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Accueil : rayon de modules ---------- */
.greeting h2 { font-size: 24px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 104px; padding: 12px 6px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--line); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; text-align: center; cursor: pointer;
}
.tile .icon { font-size: 30px; line-height: 1; }
.tile .note { font-size: 12px; font-weight: 600; color: var(--muted); }
.tile:disabled { cursor: default; background: #f6f8f6; color: var(--muted); border-style: dashed; }
.tile:disabled .icon { filter: grayscale(1); opacity: .6; }
.tile.blocked { border-color: var(--danger); border-style: solid; }
.tile.blocked .note { color: var(--danger); }
.tile.primary:not(:disabled) { border-color: var(--brand); }

/* ---------- Étiquettes utilisateurs (changement de vendeur) ---------- */
.tags { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tag {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 96px; padding: 14px 14px 14px 30px; text-align: left; cursor: pointer;
  background: var(--tag); color: #2b2100; border: 0; font: inherit;
  border-radius: 6px 14px 14px 6px;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
}
.tag::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: var(--canvas);
}
.tag .who { font-size: 18px; font-weight: 800; line-height: 1.15; }
.tag .role { font-size: 14px; font-weight: 600; color: #5c4600; }
.tag:disabled { background: #e8ece9; color: var(--muted); cursor: default; }
.tag:disabled .role { color: var(--muted); }
.tag.large { min-height: 0; padding: 12px 18px 12px 34px; width: max-content; max-width: 100%; }

/* ---------- Pavé numérique ---------- */
.pin-pad { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.dots { display: flex; gap: 14px; height: 22px; align-items: center; }
.dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); }
.dots span.on { background: var(--ink); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.key {
  width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 28px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.key:active { background: var(--brand-soft); }
.key.action { font-size: 22px; border-color: transparent; background: transparent; }
.key.ok { background: var(--brand); color: #fff; border-color: var(--brand); font-size: 26px; }
.key.ok:disabled { opacity: .35; }

.error-text { color: var(--danger); font-weight: 600; min-height: 1.45em; }
.hero-tag { display: flex; justify-content: center; }
.topbar-user { font-size: 15px; opacity: .85; white-space: nowrap; }
.link-row .label { display: flex; flex-direction: column; }
.link-row .label .small { font-weight: 400; }

/* ---------- Mot de passe provisoire ---------- */
.secret {
  font: 700 26px/1.2 ui-monospace, "Roboto Mono", Menlo, Consolas, monospace; letter-spacing: 2px;
  background: var(--canvas); border: 2px dashed var(--brand); border-radius: var(--radius-small);
  padding: 12px; text-align: center; user-select: all;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius);
  font-size: 16px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  /* Simple message : un toucher le traverse (le bouton « Valider la vente » reste utilisable dessous) */
  pointer-events: none;
}
.toast.error { background: var(--danger); }

/* ---------- Écrans d'accueil (connexion) ---------- */
.welcome { padding: 32px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.welcome .mark {
  width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 30px;
}
.welcome h1 { font-size: 26px; }

/* ---------- Console INVEXCAM (ordinateur) ---------- */
.console .app { max-width: 1180px; }
.console .topbar nav { display: flex; gap: 4px; }
.console .topbar nav button {
  background: transparent; color: #fff; border: 0; font: inherit; font-weight: 600; padding: 8px 12px;
  border-radius: 8px; cursor: pointer; min-height: 40px;
}
.console .topbar nav button[aria-current="page"] { background: rgba(255,255,255,.16); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--muted); background: #f6f8f6; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f6f8f6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 200px; }
.panel-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-title h2 { flex: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; padding: 0 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.console .login-app { max-width: 480px; }

/* =====================================================================
   Phase 3 : synchronisation, stocks, installation
   ===================================================================== */

/* ---------- Bandeau de synchronisation (sous la barre de titre) ---------- */
.sync-strip {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line);
  font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
  background: var(--brand-soft); color: var(--brand-deep);
}
.chrome { position: sticky; top: 0; z-index: 5; }
.chrome .topbar { position: static; }
.sync-strip .dot, .status-line .dot { width: 10px; height: 10px; border-radius: 50%; background: #1e9e5a; flex: none; }
.sync-strip.offline { background: var(--warn-soft); color: var(--warn); }
.sync-strip.offline .dot, .status-line.offline .dot { background: #d98a00; }
.sync-strip.busy { background: var(--info-soft); color: var(--info); }
.sync-strip.busy .dot, .status-line.busy .dot { background: transparent; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
.sync-strip.error { background: var(--danger-soft); color: var(--danger); }
.sync-strip.error .dot, .status-line.error .dot { background: var(--danger); }
.sync-strip.done .dot, .status-line.done .dot { background: #1e9e5a; box-shadow: 0 0 0 3px rgba(30,158,90,.25); }
.status-line { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }

/* ---------- Recherche et filtres ---------- */
.search-bar { display: flex; gap: 8px; }
.search-bar input { flex: 1; min-width: 0; }
.scan-btn { flex: none; padding: 10px 14px; }
.scan-btn span { font-size: 20px; letter-spacing: -2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.chip .count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.chip[aria-pressed="true"] .count { color: #cfe5d8; }
.chip.out[aria-pressed="false"] .count { color: var(--danger); }
.chip.low[aria-pressed="false"] .count { color: var(--warn); }

/* ---------- Liste des produits : comme une étiquette de rayon ---------- */
.product-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px;
  background: var(--surface); border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  border-left: 5px solid transparent;
}
.product-row.out { border-left-color: var(--danger); }
.product-row.low { border-left-color: #e3a21a; }
.product-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.product-row .name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.product-row .meta { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-row .flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.product-row .flags:empty { display: none; }
.product-row .qty { flex: none; display: flex; flex-direction: column; align-items: flex-end; min-width: 64px; }
.product-row .qty strong { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.product-row .qty span { font-size: 13px; color: var(--muted); }
.product-row.out .qty strong { color: var(--danger); }
.product-row.low .qty strong { color: var(--warn); }
.item.empty { align-items: flex-start; }
.link-row.more { justify-content: center; color: var(--brand); font-weight: 600; }

/* ---------- Fiche produit ---------- */
.stock-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 6px solid var(--brand); }
.stock-hero.out { border-top-color: var(--danger); }
.stock-hero.low { border-top-color: #e3a21a; }
.stock-hero .label { color: var(--muted); font-size: 15px; font-weight: 600; }
.stock-hero .big { font-size: 44px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.stock-hero .big span { font-size: 20px; font-weight: 600; color: var(--muted); }
.stock-hero.out .big { color: var(--danger); }
.pending-note { color: var(--warn); font-weight: 600; margin-top: 8px; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row .btn { flex: 1 1 auto; }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.figure { background: var(--surface); padding: 12px 14px; }
.figure dt { font-size: 14px; color: var(--muted); }
.figure dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.figure.neg dd { color: var(--danger); }
.kv.card { padding: 14px 16px; }
.history-item .item-head h3 { font-size: 16px; }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 18px; }
.delta.pos { color: #137a43; }
.delta.neg { color: var(--danger); }

/* ---------- Formulaires de stock ---------- */
.field > .label { font-weight: 600; font-size: 16px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented button {
  min-height: 52px; border-radius: var(--radius-small); border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; padding: 6px;
}
.segmented button.in[aria-checked="true"] { border-color: #137a43; background: #e2f4ea; color: #0d5c32; }
.segmented button.out[aria-checked="true"] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.preview { font-size: 18px; font-weight: 700; padding: 10px 14px; border-radius: var(--radius-small); background: var(--canvas); border: 1px dashed var(--line); }
.preview.neg { color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; cursor: pointer; font-weight: 600; }
.check input { width: 26px; height: 26px; min-height: 0; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.big-input { font-size: 30px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; min-height: 68px; }
.count-check.neg .diff { color: var(--danger); font-weight: 700; }
.count-check.pos .diff { color: #137a43; font-weight: 700; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 14px; }
.steps li { padding-left: 4px; }
.steps li p { margin-bottom: 8px; }
label.btn { cursor: pointer; }

/* ---------- Accueil ---------- */
.tile.warn .note { color: var(--danger); }
.welcome .mark { background: none; width: 56px; height: 56px; }
.welcome .mark img { width: 56px; height: 56px; border-radius: 14px; display: block; }

/* ---------- Lecture du code-barres ---------- */
.scanner { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 24px 16px max(24px, env(safe-area-inset-bottom)); gap: 16px; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; left: 10%; right: 10%; top: 35%; height: 22%; border: 3px solid var(--tag); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner-hint { position: relative; color: #fff; font-weight: 600; }
.scanner .btn { position: relative; }

/* ---------- Nouvelle version disponible ---------- */
.update-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 55;
  width: min(528px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--brand-deep); color: #fff; padding: 12px 14px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.update-banner .btn { background: var(--tag); border-color: var(--tag); color: #2b2100; }

.figure dd small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.figure.neg dd small { color: var(--danger); }

/* =====================================================================
   Phase 4 : ventes, clients et crédits, tickets
   ===================================================================== */

/* ---------- Bouton d'action dans la barre de titre ---------- */
.top-action {
  flex: none; min-height: 40px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
}

/* ---------- Écran de vente : recherche, panier, barre d'encaissement ---------- */
.sale-screen .content { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
.results { max-height: 50vh; overflow-y: auto; }
.result-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  min-height: var(--tap); padding: 10px 16px; background: var(--surface); border: 0;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.result-row:active { background: var(--brand-soft); }
.result-row .name { font-weight: 700; }
.result-row .meta { font-size: 14px; color: var(--muted); }
.favorites { display: flex; flex-direction: column; gap: 6px; }
.fav-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.fav {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  max-width: 150px; min-height: 60px; padding: 8px 12px; border-radius: var(--radius-small);
  background: var(--tag); border: 0; color: #2b2100; font: inherit; font-size: 15px; font-weight: 700; text-align: left; cursor: pointer;
}
.fav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 126px; }
.fav small { font-size: 13px; font-weight: 600; color: #5c4600; }

.cart { display: flex; flex-direction: column; gap: 8px; }
.cart-empty {
  padding: 28px 16px; text-align: center; color: var(--muted);
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.cart-line {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.cart-line.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: #fff6d6; border-color: var(--tag); } }
.cart-name { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; }
.cart-name > span:first-child { font-weight: 700; line-height: 1.25; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--brand); background: #fff;
  color: var(--brand-deep); font: inherit; font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer; flex: none;
}
.stepper button:active { background: var(--brand-soft); }
.qty-input { width: 76px; min-height: 48px; padding: 6px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-total { font-size: 19px; font-variant-numeric: tabular-nums; text-align: right; }
.stock-warn { grid-column: 1 / -1; font-size: 14px; color: var(--warn); font-weight: 600; }
.clear-cart { align-self: center; color: var(--danger); }

.checkout-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 12px;
  max-width: 560px; margin: 0 auto;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--brand-deep); color: #fff; box-shadow: 0 -4px 18px rgba(0,0,0,.18);
}
.checkout-bar .sum { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.checkout-bar .sum span { font-size: 14px; opacity: .85; }
.checkout-bar .sum strong { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-btn { background: var(--tag); border-color: var(--tag); color: #2b2100; font-size: 20px; min-height: 60px; }
.checkout-bar .pay-btn { flex: none; min-width: 150px; }
.checkout-bar .pay-btn:disabled { opacity: .45; }
.btn.pay-btn.busy::after { border-color: rgba(43,33,0,.3); border-top-color: #2b2100; }

/* ---------- Encaissement ---------- */
.pay-total {
  background: var(--brand-deep); color: #fff; border-radius: var(--radius); padding: 16px; text-align: center;
}
.pay-total .label { font-size: 15px; opacity: .85; }
.pay-total .big { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 2px; }
.pay-total .muted { color: #cfe5d8; }
.methods { grid-template-columns: repeat(3, 1fr); }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.customer-box { padding: 12px 14px; }
.customer-box .spacer { min-width: 0; }
.quick-amounts { display: flex; gap: 8px; flex-wrap: wrap; }
.preview.change { font-size: 22px; text-align: center; }
.preview.change.ok { color: #0d5c32; background: #e2f4ea; border-color: #9fd6b5; border-style: solid; }
.preview.change.neg { color: var(--danger); background: var(--danger-soft); border-color: #f1b5ae; border-style: solid; }

/* ---------- Vente enregistrée ---------- */
.done-banner {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: #e2f4ea; color: #0d5c32; border: 2px solid #9fd6b5; border-radius: var(--radius); padding: 16px;
}
.done-banner strong { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.done-banner span { font-weight: 600; }

/* ---------- Ticket (écran et impression) ---------- */
.ticket-preview { display: flex; justify-content: center; padding: 8px 0; }
.ticket {
  width: 100%; max-width: 340px; background: #fff; color: #000; padding: 18px 16px 22px;
  font: 14px/1.35 ui-monospace, "Roboto Mono", "Noto Sans Mono", Menlo, Consolas, monospace;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); border-top: 1px dashed #bbb; border-bottom: 1px dashed #bbb;
}
.ticket > * + * { margin-top: 8px; }
.t-head { text-align: center; display: flex; flex-direction: column; gap: 1px; }
.t-head strong { font-size: 17px; text-transform: uppercase; letter-spacing: .5px; }
.t-void { text-align: center; font-weight: 800; border: 2px solid #000; padding: 4px; letter-spacing: 1px; }
.t-meta { border-top: 1px dashed #000; padding-top: 6px; }
.t-items { border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.t-name { font-weight: 700; }
.t-row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.t-row > span:last-child { white-space: nowrap; text-align: right; }
.t-total { font-size: 18px; font-weight: 800; }
.t-strong { font-weight: 800; }
.t-foot { text-align: center; border-top: 1px dashed #000; padding-top: 6px; }
.item .t-row { font-family: inherit; }

#print-area { position: absolute; left: -10000px; top: 0; width: 72mm; }
#print-area.w58 { width: 48mm; }
.t-logo { display: block; max-width: 60%; max-height: 30mm; margin: 0 auto 4px; object-fit: contain; }
#print-area .ticket { max-width: none; box-shadow: none; border: 0; padding: 0; font-size: 12px; }
#print-area .t-head strong { font-size: 14px; }
#print-area .t-total { font-size: 15px; }

/* Journal des actions */
.journal-day { font-size: 15px; color: var(--muted); margin-top: 8px; text-transform: capitalize; }
.journal-item .item-head { align-items: baseline; }
.journal-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; min-width: 3em; }
.journal-detail { margin: 0; overflow-wrap: anywhere; }

/* Aperçu du ticket tel que l'imprimante thermique le sortira (48 ou 32 colonnes) */
pre.paper {
  margin: 0; align-self: center; width: max-content; max-width: 100%; overflow-x: auto;
  background: #fff; color: #000; border: 1px solid var(--line); border-radius: var(--radius-small);
  padding: 12px 10px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; line-height: 1.35;
  /* 48 colonnes (80 mm) ou 32 (58 mm) qui tiennent dans la largeur de l'écran */
  font-size: min(12px, calc((min(100vw, 560px) - 58px) / 29.5));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
pre.paper.w58 { font-size: min(13px, calc((min(100vw, 560px) - 58px) / 20)); }
.plain-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.install-card p { margin: 0; }
.logo-card .logo-preview {
  display: block; max-width: 100%; max-height: 96px; object-fit: contain; align-self: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-small); padding: 8px;
}

@media print {
  body.printing { background: #fff; margin: 0; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { position: static; width: 72mm; margin: 0 auto; padding: 2mm 0; }
  body.printing #print-area.w58 { width: 48mm; }
}

/* ---------- Ventes du jour ---------- */
.sale-row, .customer-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px;
  background: var(--surface); border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  border-left: 5px solid transparent;
}
.sale-row .main, .customer-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.sale-row .name, .customer-row .name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.sale-row .meta, .customer-row .meta { font-size: 14px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-row .flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sale-row .amount, .customer-row .amount { flex: none; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.sale-row.voided .amount { text-decoration: line-through; color: var(--muted); }
.sale-row.voided { border-left-color: var(--danger); }

/* ---------- Clients et créances ---------- */
.receivables { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.receivables > div { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; }
.receivables .label { font-size: 14px; color: var(--muted); }
.receivables strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.receivables .late strong { color: var(--danger); }
.customer-row.owes { border-left-color: #e3a21a; }
.customer-row.owes .amount { color: var(--warn); }
.customer-row .badge { margin-top: 4px; }
.balance-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 6px solid var(--brand); }
.balance-hero.owes { border-top-color: #e3a21a; }
.balance-hero .label { color: var(--muted); font-size: 15px; font-weight: 600; }
.balance-hero .big { font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.balance-hero.owes .big { color: var(--warn); }
.picker h2 { font-size: 18px; }
.picker .list { max-height: 45vh; overflow-y: auto; }

@media (max-width: 360px) {
  .methods { grid-template-columns: repeat(2, 1fr); }
  .checkout-bar .pay-btn { min-width: 120px; }
  .pay-total .big { font-size: 34px; }
}

/* =====================================================================
   Phase 5 : achats, fournisseurs et dettes
   ===================================================================== */

strong.block { display: block; font-size: 17px; line-height: 1.25; }
.receivables.payables > .wide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; }
.receivables.payables > .wide strong { font-size: 19px; }
.receivables .soon strong { color: var(--warn); }
.supplier-box .spacer { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Ligne de réception : nom, quantité, prix unitaire ou total, marge */
.purchase-line { grid-template-columns: 1fr auto; }
.purchase-line .remove { justify-self: end; color: var(--danger); }
.purchase-line .cost-grid, .purchase-line .margin-line, .purchase-line > .field { grid-column: 1 / -1; }
.purchase-line .cost-grid { gap: 8px; }
.purchase-line .cost-grid input { font-variant-numeric: tabular-nums; }
.purchase-line .field .hint { font-size: 13px; }
.margin-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (min-width: 380px) { .purchase-line .cost-grid { grid-template-columns: 1fr 1fr; } }

.segmented button.credit[aria-checked="true"] { border-color: #b26a00; background: var(--warn-soft); color: var(--warn); }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.done-banner.out { background: var(--info-soft); color: var(--info); border-color: #bcd6ee; }

/* Répartition d'un paiement fournisseur avant validation */
.preview.plan { font-size: 15px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.preview.plan .t-strong { font-size: 17px; font-weight: 800; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }

/* Bon d'achat, reçu fournisseur, états */
.t-sign { display: flex; justify-content: space-between; gap: 12px; padding-top: 28px; font-size: 12px; }
.t-sign span { flex: 1; border-top: 1px solid #000; padding-top: 4px; text-align: center; }
.t-detail { font-size: 12px; }
.t-late { font-weight: 700; }

/* =====================================================================
   Phase 6 : caisse, trésorerie et dépenses
   ===================================================================== */

/* Caisse en cours : le montant d'espèces attendu, en grand */
.cash-hero { background: var(--brand-deep); color: #fff; border-radius: var(--radius); padding: 18px 16px; }
.cash-hero .label { font-size: 15px; opacity: .85; }
.cash-hero .big { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.cash-hero .big.neg { color: #ffb4a8; }
.cash-hero .muted { color: #cfe5d8; }
.cash-hero .pending-note { color: var(--tag); }
.cash-hero.closed { background: var(--surface); color: var(--ink); border: 2px dashed var(--line); }
.cash-hero.closed .big { color: var(--muted); }
.cash-hero.closed .muted { color: var(--muted); }
.last-close { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; width: 100%; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.last-close .link { color: var(--brand); font-weight: 600; }
.cash-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.cash-entry .item-head h3 { font-size: 16px; }

/* Billetage : une ligne par billet ou pièce */
.billetage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.den-row { display: grid; grid-template-columns: 1fr auto 92px; gap: 8px; align-items: center; padding: 6px 12px; }
.den-row + .den-row { border-top: 1px solid var(--line); }
.den-label { display: flex; flex-direction: column; line-height: 1.15; }
.den-label strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.den-label small { font-size: 13px; color: var(--muted); }
.den-sub { text-align: right; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stepper.small button { width: 40px; height: 40px; font-size: 22px; }
.den-input { width: 64px; min-height: 40px; padding: 4px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.den-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px; background: var(--brand-soft); border-top: 2px solid var(--brand); }
.den-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.billetage input:disabled, .billetage button:disabled { opacity: .6; }

/* Résultat du comptage */
.close-figures .figure.wide { grid-column: 1 / -1; }
.close-figures .figure.wide dd { font-size: 28px; }
.close-figures .figure.neg dd { color: var(--danger); }
.close-figures .figure.pos dd { color: var(--warn); }
.close-figures .figure.ok dd { color: #137a43; }

/* Journal : solde initial + entrées − sorties = solde final */
.equation { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.equation > div { padding: 10px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.equation > div + div { border-top: 1px solid var(--line); }
.equation span { font-size: 16px; color: var(--muted); font-weight: 600; }
.equation strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.equation .pos strong { color: #137a43; }
.equation .neg strong { color: var(--danger); }
.equation .result { background: var(--brand-deep); }
.equation .result span { color: #cfe5d8; }
.equation .result strong { color: #fff; font-size: 24px; }
table.accounts { font-size: 14px; }
table.accounts td.neg strong { color: var(--danger); }
table.accounts th, table.accounts td { padding: 8px 10px; }

/* Dépenses */
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 400px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
.cat-chip {
  min-height: 52px; padding: 8px; border-radius: var(--radius-small); border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.cat-chip[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.cat-chip.add { border-style: dashed; color: var(--brand); }
.expense-total { background: #7a3d00; }
.kinds { grid-template-columns: repeat(3, 1fr); }

/* =====================================================================
   Phase 7 : tableau de bord et rapports
   ===================================================================== */

/* Accueil : chiffres du jour (gérant) */
.today-card {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--brand); border-radius: var(--radius);
  padding: 12px 14px; font: inherit; color: var(--ink);
}
.today-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.today-head h2 { font-size: 18px; }
.link-btn { background: none; border: 0; padding: 6px 0; font: inherit; font-size: 15px; font-weight: 600; color: var(--brand); cursor: pointer; }
.today-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.today-kpis > div { display: flex; flex-direction: column; }
.today-kpis span { font-size: 13px; color: var(--muted); }
.today-kpis strong { font-size: 18px; line-height: 1.2; }

/* Chiffres clés */
.kpi-hero { background: var(--brand-deep); color: #fff; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi-hero .label { font-size: 15px; opacity: .85; }
.kpi-hero strong { font-size: 36px; font-weight: 800; line-height: 1.1; }
.kpi-hero .sub { font-size: 15px; color: #cfe5d8; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; font: inherit; color: var(--ink);
}
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi strong { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi.warn { border-left: 4px solid #e3a21a; }
.kpi.bad strong { color: var(--danger); }
.kpi.link { cursor: pointer; }

/* Graphiques */
.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chart figcaption h3 { font-size: 16px; }
.chart-readout { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; min-height: 22px; align-items: center; }
.chart-readout .when { color: var(--muted); font-weight: 600; }
.chart-readout .val { display: inline-flex; align-items: center; gap: 6px; }
.chart-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart-svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: #9aa8a0; stroke-width: 1; }
.chart-svg .tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart-svg .hl { fill: var(--canvas); }
.chart-svg .cursor { stroke: #9aa8a0; stroke-width: 1; }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .wash { opacity: .1; }
.fill-sales { fill: var(--c-sales); }
.fill-margin { fill: var(--c-margin); }
.fill-stock { fill: var(--c-stock); }
.stroke-sales { stroke: var(--c-sales); }
.stroke-margin { stroke: var(--c-margin); }
.stroke-stock { stroke: var(--c-stock); }
.bg-sales { background: var(--c-sales); }
.bg-margin { background: var(--c-margin); }
.bg-stock { background: var(--c-stock); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; flex: none; }
.swatch.box { width: 12px; height: 12px; border-radius: 3px; }
.swatch.line { width: 16px; height: 3px; border-radius: 2px; }
.chart-table summary, details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 15px; padding: 4px 0; }
.chart-table table { width: 100%; }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-list li { display: flex; flex-direction: column; gap: 3px; }
.bar-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.bar-head .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-head strong { font-variant-numeric: tabular-nums; flex: none; }
.bar-track { height: 10px; background: var(--canvas); border-radius: 5px; overflow: hidden; }
.bar-track .bar { display: block; height: 100%; border-radius: 0 5px 5px 0; }

/* Rapport : période, lignes « libellé … montant » */
.period-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.period-nav .btn { min-width: 52px; font-size: 24px; line-height: 1; }
.period-label { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.period-label strong { font-size: 18px; }
.date-pick { max-width: 200px; min-height: 44px; padding: 4px 8px; font-size: 16px; }
.report-section h2 { font-size: 18px; }
.report-section h3 { font-size: 16px; color: var(--muted); }
.ledger { display: flex; flex-direction: column; }
.l-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 15px; }
.l-row span { min-width: 0; }
.l-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.l-row.sub { font-weight: 700; }
.l-row.sub strong { font-weight: 800; }
.l-row.total { background: var(--brand-soft); border-bottom: 0; padding: 9px 10px; margin: 4px -10px 0; border-radius: var(--radius-small); font-weight: 700; }
.l-row.total strong { font-weight: 800; font-size: 17px; }
.l-row.bad strong { color: var(--danger); }
.l-row.warn strong { color: var(--warn); }
.l-row.note { color: var(--muted); font-size: 14px; border-bottom: 0; }
.l-row.tight { border-bottom: 0; padding-bottom: 0; }
.l-row.detail { color: var(--muted); font-size: 14px; padding-top: 2px; }
.ledger > .l-row:last-child:not(.total) { border-bottom: 0; }
details.more { border-top: 1px solid var(--line); padding-top: 6px; }
details.more .ledger { margin-top: 4px; }
table.accounts tfoot th, table.accounts tfoot td { border-top: 2px solid var(--line); }


/* =====================================================================
   Phase 8 : centre d'alertes, réapprovisionnement, paramètres
   ===================================================================== */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }
h2 .count { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.alert-card { border-left: 4px solid var(--line); }
.alert-card.red { border-left-color: var(--danger); }
.alert-card.orange { border-left-color: #e3a21a; }
.alert-card.seen { background: #f8faf8; }
.alert-card.seen .item-head h3 { color: var(--muted); }
.alert-card p { overflow-wrap: anywhere; }
.big-check { font-size: 40px; line-height: 1; color: var(--brand); font-weight: 700; }
.day-title { font-size: 16px; color: var(--muted); }
.item.event { gap: 4px; }
.item.event h3 { font-size: 16px; }
.restock-item { border-left: 4px solid transparent; }
.restock-item.out { border-left-color: var(--danger); }
.restock-item.low { border-left-color: #e3a21a; }
.restock-item .item-head strong { font-variant-numeric: tabular-nums; white-space: nowrap; }

.settings-section { margin: 0; min-width: 0; }
.settings-section legend { font-weight: 700; font-size: 18px; padding: 0 6px; }
.field.check { gap: 2px; }
.field.check .check-label { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.field.check input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; padding: 0; flex: none; accent-color: var(--brand); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > * { min-width: 0; }
.preview { background: var(--canvas); border-radius: var(--radius-small); padding: 8px 10px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(rgba(238, 243, 239, 0), var(--canvas) 35%); }

/* Console : rubrique Système */
.badge.green { background: var(--brand-soft); color: var(--brand-deep); }
.inline-check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.inline-check input { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; accent-color: var(--brand); }
code.copy { display: inline-block; font-size: 14px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-small); padding: 4px 8px; user-select: all; overflow-wrap: anywhere; }
code.secret-url { display: block; font-size: 15px; background: #fff; }
ul.plain { margin: 0; padding-left: 18px; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.toolbar > input { width: auto; flex: 1 1 260px; max-width: 420px; }
.stack.tight { gap: 4px; }

/* =====================================================================
   Phase 9 : redevances INVEXCAM (console et Mon abonnement)
   ===================================================================== */
.figure.warn dd { color: var(--warn); }
@media (min-width: 720px) { .console-figures { grid-template-columns: repeat(4, 1fr); } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; text-align: left; }
tbody tr.muted td { color: var(--muted); }
.invoice-line { padding: 12px 14px; }
.row > a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn.ghost.danger { color: var(--danger); }
td.num { white-space: nowrap; }
.toolbar > select { width: auto; flex: 0 1 280px; }
