/* =====================================================================
   Awalon · système de design V2 (remplacement complet de app.css)
   Terrain : Android bas de gamme, soleil, mains mouillées, 4G faible.
   Règles : cibles >= 48 px, texte >= 15 px (14 px pour les mentions),
   contrastes AA vérifiés (valeurs dans le rapport), mode sombre auto.
   Toutes les classes de la V1 sont conservées (aucune vue ne casse),
   les nouvelles sont marquées « NOUVEAU ».
   ===================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  color-scheme: light dark;
  /* surfaces */
  --bg: #f4f7f5;            /* fond de page, légèrement vert */
  --surface: #ffffff;       /* cartes, modales */
  --surface-2: #eaf1ed;     /* zones secondaires, champs désactivés, puces */
  --surface-3: #dbe7e1;     /* survol, appui */
  --line: #d5dfda;          /* séparateurs décoratifs */
  --line-strong: #7d8e88;   /* bord des champs (3:1 sur blanc) */
  /* texte */
  --ink: #14211d;           /* 15.6:1 sur --bg */
  --ink-2: #46534e;         /* texte secondaire 7.5:1 (remplace --muted 5.2:1) */
  --ink-3: #5f6d68;         /* mentions, jamais < 14 px */
  /* marque */
  --brand: #0f6b57;         /* vert profond Awalon, boutons principaux */
  --on-brand: #ffffff;      /* 6.4:1 */
  --brand-ink: #0b5a48;     /* liens 7.6:1 */
  --brand-soft: #dcf2ea;    /* fonds d'état actif */
  --accent: #15c39a;        /* turquoise EGBE : décor, focus, jamais texte sur blanc */
  --rust: #9d341e;          /* rouille : identité, montants dus, titres de documents */
  --on-rust: #ffffff;       /* 7.1:1 */
  --rust-soft: #f7e6e1;
  /* états (texte sur fond doux, tous >= 5.6:1) */
  --ok: #0b6b50;   --ok-soft: #dff3ea;   --ok-strong: #0e7a5c;
  --warn: #7a4100; --warn-soft: #fcebd2; --warn-strong: #8a4b00;
  --err: #9f1f18;  --err-soft: #fbe4e2;  --err-strong: #b3261e; --on-err: #ffffff;
  --info: #1a54a0; --info-soft: #e2ecf8;
  --violet: #5e3592; --violet-soft: #eee6f7;
  --grey: #46534e; --grey-soft: #e6ece9;
  /* compatibilité V1 */
  --card: var(--surface); --muted: var(--ink-2); --brand-2: var(--accent); --blue: var(--info);
  /* typographie : polices système (0 octet), chiffres tabulaires */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-num: var(--font);
  --fs-xs: .875rem;   /* 14 px : mentions uniquement */
  --fs-sm: .9375rem;  /* 15 px : texte secondaire */
  --fs-md: 1rem;      /* 16 px : texte courant, champs (évite le zoom iOS) */
  --fs-lg: 1.125rem;  /* 18 px : titres de carte */
  --fs-xl: 1.375rem;  /* 22 px : titres de page */
  --fs-2xl: 1.75rem;  /* 28 px : chiffres clés */
  --fs-3xl: 2.5rem;   /* 40 px : solde, total à encaisser */
  --lh: 1.45;
  /* espacements (base 4) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  /* rayons */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  /* ombres */
  --sh-1: 0 1px 2px rgba(16, 40, 33, .06), 0 1px 1px rgba(16, 40, 33, .04);
  --sh-2: 0 2px 6px rgba(16, 40, 33, .08), 0 8px 24px rgba(16, 40, 33, .06);
  --sh-3: 0 12px 40px rgba(10, 25, 20, .22);
  --shadow: var(--sh-1);
  /* cibles */
  --tap: 48px; --tap-lg: 56px;
  --topbar: 56px; --tabbar: 64px;
  --focus: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --r-legacy: var(--r);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --surface: #16201d; --surface-2: #1e2a26; --surface-3: #263430;
    --line: #2a3833; --line-strong: #5d6f69;
    --ink: #e8f0ed; --ink-2: #a9bab4; --ink-3: #93a59f;
    --brand: #3dd1a8; --on-brand: #04261c; --brand-ink: #5fe0b6; --brand-soft: #143a30;
    --accent: #3dd1a8;
    --rust: #ff9f80; --on-rust: #2a0d05; --rust-soft: #3a1d15;
    --ok: #5fe0b6; --ok-soft: #123329; --ok-strong: #3dd1a8;
    --warn: #ffc670; --warn-soft: #3a2a10; --warn-strong: #ffc670;
    --err: #ffb4ab; --err-soft: #3d1714; --err-strong: #ffb4ab; --on-err: #2a0905;
    --info: #a8c8ff; --info-soft: #162a45;
    --violet: #d4bbf5; --violet-soft: #2c2140;
    --grey: #a9bab4; --grey-soft: #23302c;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4); --sh-2: 0 4px 16px rgba(0, 0, 0, .45); --sh-3: 0 16px 48px rgba(0, 0, 0, .6);
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 100%; line-height: var(--lh); }
body { font-size: var(--fs-md); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
body.noscroll { overflow: hidden; }
a { color: var(--brand-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.card, a.btn, a.kpi, .side a, .tabs a, .tabbar a, a.row { text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s3); letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s3); }
small, .small { font-size: var(--fs-sm); } .muted { color: var(--ink-2); }
.pos { color: var(--ok); } .neg { color: var(--err); }
.num, .money, .solde, .kpi b, .tbl td.num { font-variant-numeric: tabular-nums; }
code, .code { font-family: ui-monospace, "Roboto Mono", Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.code { display: block; padding: var(--s3); line-height: 1.8; }
img { max-width: 100%; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* icônes SVG inline (NOUVEAU) : <svg class="ico"><use href="#i-bus"/></svg> */
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.lg { width: 28px; height: 28px; }

/* ---------- 3. Champs ---------- */
input, select, textarea {
  font: inherit; font-size: var(--fs-md); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--r); padding: 12px 14px; width: 100%; min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); outline: none; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--err-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err-strong) 25%, transparent); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[data-money] { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
input[type=date], input[type=month] { min-width: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
input[type=checkbox], input[type=radio] { width: 26px; height: 26px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
.field { display: block; margin-bottom: var(--s4); min-width: 0; }
.field > span { display: block; font-weight: 650; font-size: var(--fs-sm); margin-bottom: 6px; color: var(--ink); }
.field small { display: block; color: var(--ink-2); margin-top: 6px; font-size: var(--fs-xs); }
.field .err-msg { color: var(--err); font-weight: 600; font-size: var(--fs-sm); margin-top: 6px; }
fieldset { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: var(--s3) var(--s4) var(--s2); margin: 0 0 var(--s4); min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.check { display: flex; gap: var(--s3); align-items: center; min-height: var(--tap); margin: var(--s1) 0 var(--s3); cursor: pointer; }
.form { max-width: 720px; }

/* ---------- 4. Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); min-width: var(--tap); padding: 10px 20px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-md); font-weight: 650; line-height: 1.2; cursor: pointer;
  text-align: center; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background-color .15s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err-strong) 55%, transparent); background: var(--surface); }
.btn.primary.danger, .btn.danger.solid { background: var(--err-strong); border-color: var(--err-strong); color: var(--on-err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: var(--fs-sm); }
@media (pointer: coarse) { .btn.small { min-height: var(--tap); } }
.btn.big { min-height: var(--tap-lg); padding: 14px 24px; font-size: var(--fs-lg); }
.btn.full { width: 100%; }
.btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; transform: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-color: var(--on-brand) var(--on-brand) transparent transparent; animation: spin .7s linear infinite; }
.icon { display: inline-grid; place-items: center; background: none; border: 0; font-size: 1.25rem; min-width: var(--tap); min-height: var(--tap); cursor: pointer; color: var(--ink); border-radius: var(--r); touch-action: manipulation; }
.icon:hover { background: var(--surface-2); }
.icon.danger { color: var(--err); }
.bar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0 0 var(--s4); }
.bar input[type=date], .bar input[type=month] { width: auto; flex: 1 1 150px; }
.bar.sticky { position: sticky; top: var(--topbar); z-index: 5; background: var(--bg); padding: var(--s2) 0; margin-inline: calc(-1 * var(--s3)); padding-inline: var(--s3); border-bottom: 1px solid var(--line); }
.actions-main { display: grid; gap: var(--s2); grid-template-columns: 1fr; margin-top: var(--s3); } /* NOUVEAU : action principale pleine largeur sur mobile */
@media (min-width: 600px) { .actions-main { display: flex; flex-wrap: wrap; } }
.seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink); padding: 8px 16px; font: inherit; font-weight: 650; min-height: 44px; cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--on-brand); }

/* ---------- 5. Coquille : barre du haut, menu latéral, barre d'onglets ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.side { width: 256px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: 30; }
.brand { display: flex; gap: var(--s3); align-items: center; padding: var(--s4); border-bottom: 1px solid var(--line); }
.brand img { border-radius: 10px; } .brand b { display: block; font-size: var(--fs-lg); } .brand small { color: var(--ink-2); font-size: var(--fs-xs); }
.side nav { padding: var(--s2); flex: 1; }
.side nav h4 { margin: var(--s4) var(--s3) var(--s1); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.side a { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: 10px var(--s3); border-radius: var(--r); color: var(--ink); font-weight: 550; }
.side a:hover { background: var(--surface-2); }
.side a span, .side a .ico { width: 24px; text-align: center; color: var(--ink-2); }
.side a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.side a.on .ico { color: var(--brand-ink); }
.side-foot { border-top: 1px solid var(--line); padding: var(--s2); }
.side-foot small { display: block; color: var(--ink-2); margin-left: auto; font-size: var(--fs-xs); }
.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s2); height: var(--topbar); padding: 0 var(--s2) 0 var(--s3); padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: 1px solid var(--line); }
.top h1 { font-size: var(--fs-lg); margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { margin-left: calc(-1 * var(--s2)); }
.burger { display: none; }
.devise { border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--r-pill); padding: 6px 14px; font: inherit; font-size: var(--fs-sm); font-weight: 700; min-height: 44px; min-width: 64px; cursor: pointer; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); min-height: 36px; padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; font-weight: 700; border: 0; }
.net::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.net.off { background: var(--ink); color: var(--bg); }
.net.wait { background: var(--warn-soft); color: var(--warn); }
/* NOUVEAU : bandeau hors ligne pleine largeur sous la barre du haut */
.offline-banner { position: sticky; top: var(--topbar); z-index: 19; display: flex; gap: var(--s2); align-items: center; padding: 10px var(--s4); background: var(--ink); color: var(--bg); font-weight: 600; font-size: var(--fs-sm); }
.offline-banner b { font-weight: 800; }
#view { padding: var(--s4); max-width: 1120px; margin: 0 auto; padding-bottom: calc(var(--s10) * 2); }
.scrim { display: none; }
/* NOUVEAU : barre d'onglets du bas (téléphone et tablette portrait) */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .22s var(--ease); box-shadow: var(--sh-3); visibility: hidden; }
  .side.open { transform: none; visibility: visible; }
  .scrim.on { display: block; position: fixed; inset: 0; background: rgba(5, 15, 12, .5); z-index: 25; }
  .burger { display: inline-grid; }
  #view { padding: var(--s3); padding-bottom: calc(var(--tabbar) + var(--s8) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 22;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar); color: var(--ink-2); font: inherit; font-size: .8125rem; font-weight: 650; background: none; border: 0; cursor: pointer; position: relative; }
  .tabbar .ico { width: 26px; height: 26px; }
  .tabbar a.on { color: var(--brand-ink); }
  .tabbar a.on::before { content: ""; position: absolute; top: 6px; width: 56px; height: 32px; border-radius: var(--r-pill); background: var(--brand-soft); z-index: -1; }
  .tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rust); color: var(--on-rust); font-size: .75rem; line-height: 20px; }
  #toasts { bottom: calc(var(--tabbar) + var(--s3) + env(safe-area-inset-bottom)); }
}
body.no-tabbar .tabbar { display: none; }
body.no-tabbar #view { padding-bottom: var(--s10); }

/* ---------- 6. Cartes, listes, KPI ---------- */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--s4); margin-bottom: var(--s3); color: var(--ink); min-width: 0; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
a.card { transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
a.card:active { background: var(--surface-2); }
.card.hilite { border-left: 6px solid var(--warn-strong); }
.card.hilite.err { border-left-color: var(--err-strong); }
.card.off, tr.off { opacity: .6; }
.card.off h3, .card.off p { color: var(--ink-2); }
.row { display: flex; align-items: center; gap: var(--s3); }
.row.between, .between { justify-content: space-between; }
.row.between { flex-wrap: wrap; row-gap: var(--s2); }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; margin-left: auto; flex: none; }
.list .card.row { margin-bottom: var(--s2); min-height: 72px; }
.card-line { display: flex; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); color: var(--ink); min-height: var(--tap); flex-wrap: wrap; }
.card-line > small { flex-basis: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s3); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 var(--s3); }
@media (max-width: 599px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } .grid3.keep2 { grid-template-columns: 1fr 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s3); }
.room { overflow: hidden; padding-top: 0; }
.room img, .room .ph { width: calc(100% + 2 * var(--s4)); margin: 0 calc(-1 * var(--s4)) var(--s3); height: 180px; object-fit: cover; display: block; }
.room .ph { display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-soft), var(--surface-2)); color: var(--ink-2); font-weight: 600; }
.date-chip { width: 56px; text-align: center; border-radius: var(--r); background: var(--surface-2); padding: 6px 0; flex: none; color: var(--ink); }
.date-chip b { display: block; font-size: var(--fs-xl); line-height: 1.1; } .date-chip small { text-transform: uppercase; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 700; }
.date-chip.today { background: var(--brand); color: var(--on-brand); } .date-chip.today small { color: var(--on-brand); }
.empty { text-align: center; color: var(--ink-2); padding: var(--s8) var(--s4); }
.empty .ico { display: block; margin: 0 auto var(--s2); width: 40px; height: 40px; color: var(--ink-3); }
.empty.err { color: var(--err); }
.note { background: var(--brand-soft); color: var(--ink); border-radius: var(--r); padding: var(--s3) var(--s4); font-size: var(--fs-sm); }
.note.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.note.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.alert-red { background: var(--err-soft); color: var(--err); border: 1.5px solid color-mix(in srgb, var(--err-strong) 45%, transparent); border-radius: var(--r); padding: var(--s3) var(--s4); font-weight: 650; }
.quote { font-style: italic; background: var(--surface-2); padding: var(--s3); border-radius: var(--r); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 750; letter-spacing: .01em; padding: 3px 10px; border-radius: var(--r-pill); background: var(--grey-soft); color: var(--grey); white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--err-soft); color: var(--err); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.grey { background: var(--grey-soft); color: var(--grey); }
.pill { display: inline-block; min-width: 22px; text-align: center; background: var(--rust); color: var(--on-rust); border-radius: var(--r-pill); font-size: .8125rem; font-weight: 700; padding: 1px 7px; }
.tabs { display: flex; gap: var(--s1); overflow-x: auto; margin: 0 calc(-1 * var(--s3)) var(--s4); padding: 0 var(--s3); border-bottom: 1px solid var(--line); scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--s4); color: var(--ink-2); font-weight: 650; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--brand-ink); border-color: var(--brand); }
.search { margin-bottom: var(--s3); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
@media (max-width: 599px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--s4); color: var(--ink); min-height: 104px; }
.kpi b { font-size: var(--fs-2xl); line-height: 1.1; } .kpi span { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.3; }
.kpi.warn { border-color: color-mix(in srgb, var(--rust) 40%, var(--line)); background: color-mix(in srgb, var(--rust-soft) 55%, var(--surface)); }
.kpi.warn b { color: var(--rust); }
.kpi.zero { box-shadow: none; background: transparent; }
.kpi.zero b { color: var(--ink-3); }
.solde { font-size: var(--fs-3xl); font-weight: 800; margin: var(--s1) 0; line-height: 1.1; letter-spacing: -.02em; }
.totals .row { padding: 6px 0; align-items: baseline; } .totals .row > span { flex: 1; min-width: 0; } .totals .row > b { white-space: nowrap; }
.totals .big { font-size: var(--fs-lg); border-top: 1.5px solid var(--line); padding-top: var(--s3); margin-top: var(--s1); }
.fin2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); } @media (max-width: 759px) { .fin2 { grid-template-columns: 1fr; } }
.tasks li.done span { text-decoration: line-through; color: var(--ink-2); }
.tasks li.done a { text-decoration: underline; }
.tasks { list-style: none; padding: 0; margin: 0; }
.tasks li { border-top: 1px solid var(--line); }
.tasks label { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; min-height: 56px; cursor: pointer; }
.tasks input[type=checkbox] { width: 32px; height: 32px; }
.money { white-space: nowrap; }

/* ---------- 7. Tableaux (empilés sur mobile) ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: var(--fs-xs); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
tr.low td { background: var(--err-soft); }
.price { width: 120px; text-align: right; min-height: var(--tap); padding: 8px 10px; }
.tbl-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); } /* NOUVEAU */
/* NOUVEAU : <table class="tbl stack"> + data-label sur chaque td */
@media (max-width: 599px) {
  .tbl.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
  .tbl.stack td { border: 0; padding: 0; }
  .tbl.stack td.full, .tbl.stack td.actions { grid-column: 1 / -1; }
  .tbl.stack td.actions { display: flex; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s2); white-space: normal; }
  .tbl.stack td[data-label]:not(.num)::before { content: attr(data-label) " "; color: var(--ink-2); font-size: var(--fs-xs); display: block; }
}

/* ---------- 8. Photos, signature ---------- */
.photo-btn { display: block; margin-bottom: var(--s3); }
.photo-btn .btn { width: 100%; min-height: var(--tap-lg); border-style: dashed; }
.photo-btn.done .btn { border-style: solid; border-color: var(--ok-strong); color: var(--ok); background: var(--ok-soft); }
.thumb { display: block; max-height: 160px; margin-top: var(--s2); border-radius: var(--r); }
.photos { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 112px; height: 112px; object-fit: cover; border-radius: var(--r); cursor: zoom-in; background: var(--surface-2); }
.photos figcaption { font-size: var(--fs-xs); color: var(--ink-2); }
.photos .icon { position: absolute; top: 4px; right: 4px; background: var(--surface); min-width: 40px; min-height: 40px; box-shadow: var(--sh-1); }
img.mini { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); cursor: zoom-in; }
img.mini.big { width: 168px; height: 112px; }
canvas.sig { width: 100%; height: 200px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: #fff; touch-action: none; display: block; margin-bottom: var(--s2); }
.sig-wrap { position: relative; }
.sig-wrap::after { content: "Signez ici avec le doigt"; position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); color: #6b7a75; font-size: var(--fs-sm); pointer-events: none; border-top: 1.5px solid #b9c6c1; padding-top: 4px; width: 70%; text-align: center; }
.sig-wrap.signed::after { content: none; }

/* ---------- 9. Modale / feuille du bas ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(5, 15, 12, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: var(--s4); animation: fade .15s var(--ease); }
.modal { background: var(--surface); border-radius: var(--r-xl); width: 100%; max-width: 540px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--sh-3); animation: pop .18s var(--ease); }
.modal.wide { max-width: 780px; }
.modal header { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s2) var(--s2) var(--s5); }
.modal header h2 { flex: 1; font-size: var(--fs-xl); margin: 0; }
.modal-body { padding: var(--s2) var(--s5) var(--s4); overflow-y: auto; overscroll-behavior: contain; }
.modal footer { display: flex; gap: var(--s2); justify-content: flex-end; padding: var(--s3) var(--s5) calc(var(--s4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-xl) var(--r-xl); }
/* alerte bloquante (solde insuffisant, suppression) */
.modal.danger { border-top: 8px solid var(--err-strong); }
.modal.danger header h2 { color: var(--err); display: flex; align-items: center; gap: var(--s2); }
.modal .alert-hero { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s2) 0 var(--s3); }
.modal .alert-hero .ico { width: 56px; height: 56px; color: var(--err-strong); }
.modal .alert-hero .amount { font-size: var(--fs-2xl); font-weight: 800; color: var(--err); font-variant-numeric: tabular-nums; }
.modal footer.stack { flex-direction: column; }
.modal footer.stack .btn { width: 100%; }
@media (max-width: 599px) {
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; animation: up .22s var(--ease); }
  .modal::before { content: ""; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin-top: var(--s2); }
  .modal footer { border-radius: 0; }
  /* boutons de pied : principal à droite, jamais renvoyé à la ligne sous l'écran */
  .modal footer { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .modal footer:has(> :nth-child(3)) { grid-auto-flow: row; }
  .modal footer .btn { width: 100%; white-space: normal; }
  .modal footer .btn.primary { order: 2; }
  .modal footer.stack { display: flex; }
  .modal footer.stack .btn.primary { order: 0; }
}
.few .burger { display: none !important; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- 10. Toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: var(--s4); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: var(--s2); width: min(calc(100vw - 24px), 480px); pointer-events: none; }
body.noscroll #toasts { top: calc(env(safe-area-inset-top) + var(--s3)); bottom: auto; } /* au-dessus d'une modale ouverte : ne cache plus ses boutons */
.toast { display: flex; gap: var(--s3); align-items: flex-start; background: var(--ink); color: var(--bg); padding: 14px var(--s4); border-radius: var(--r); box-shadow: var(--sh-3); transition: opacity .25s, transform .25s; font-weight: 600; pointer-events: auto; }
.toast::before { content: "✓"; font-weight: 900; }
.toast.err { background: var(--err-strong); color: var(--on-err); } .toast.err::before { content: "!"; }
.toast.warn { background: var(--warn-soft); color: var(--warn); border: 1.5px solid var(--warn-strong); } .toast.warn::before { content: "⏳"; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- 11. Connexion, chargement, squelettes ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); background: radial-gradient(120% 60% at 50% 0%, var(--brand-soft), var(--bg)); }
.login .card { width: 100%; max-width: 400px; text-align: center; padding: var(--s8) var(--s6); }
.login .card img { border-radius: 18px; }
.login .field { text-align: left; }
.login .btn { width: 100%; margin: var(--s2) 0 var(--s3); }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 56px; } .pw-wrap .icon { position: absolute; right: 2px; top: 0; }
.loading { display: grid; place-items: center; padding: 50px; }
.loading span { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { display: grid; gap: var(--s3); }
.skel i { display: block; height: 72px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i.short { height: 24px; width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 12. Agenda minibus ---------- */
.agenda { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ag-day { min-height: 76px; background: var(--surface-2); border-radius: var(--r-sm); padding: 4px; font-size: var(--fs-xs); overflow: hidden; }
.ag-day.today { outline: 2px solid var(--brand); } .ag-day.conflict { background: var(--err-soft); }
.ag-day em { color: var(--err); font-style: normal; font-weight: 700; display: block; }
.ag-item { display: block; background: var(--brand); color: var(--on-brand); border-radius: 5px; padding: 3px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ag-item.maison { background: var(--rust); color: var(--on-rust); }

/* ---------- 13. Occupation hôtel ---------- */
.occ { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.occ table { border-collapse: separate; border-spacing: 3px; font-size: var(--fs-xs); }
.occ th { font-weight: 700; color: var(--ink-2); padding: 2px; min-width: 36px; text-align: center; }
.occ tbody th { text-align: left; white-space: nowrap; padding-right: var(--s2); color: var(--ink); position: sticky; left: 0; background: var(--surface); z-index: 1; }
.occ th.today { color: var(--on-brand); background: var(--brand); border-radius: 6px; }
.occ td { height: 40px; background: var(--surface-2); border-radius: 6px; min-width: 36px; padding: 0; }
.occ td a { display: block; height: 100%; color: inherit; font-weight: 700; padding: 10px 3px; overflow: hidden; white-space: nowrap; text-decoration: none; }
.occ-demande, .legend i.occ-demande { background: #f0b44c !important; color: #3d2600; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.08) 6px 12px) !important; }
.occ-confirmee, .legend i.occ-confirmee { background: #2f6db8 !important; color: #fff; }
.occ-arrivee, .legend i.occ-arrivee { background: var(--ok-strong) !important; color: #fff; }
.occ-partie { background: var(--grey-soft) !important; color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; margin-top: var(--s2); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin: 0 6px 0 0; }

/* ---------- 14. Restaurant ---------- */
.zone { margin: var(--s5) 0 var(--s2); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 150px), 1fr)); gap: var(--s2); }
.tile { position: relative; min-height: 76px; border-radius: var(--r-lg); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: var(--fs-md); padding: var(--s3); cursor: pointer; text-align: left; box-shadow: var(--sh-1); touch-action: manipulation; }
.tile small { display: block; color: var(--ink-2); font-weight: 600; margin-top: 4px; font-size: var(--fs-sm); }
.tile:active { transform: scale(.97); background: var(--brand-soft); border-color: var(--brand); }
.tile.busy { border-color: var(--warn-strong); background: var(--warn-soft); } /* table avec commande en cours */
.tile .qty { position: absolute; top: -8px; right: -6px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-size: var(--fs-sm); box-shadow: var(--sh-1); }
.tile.out { opacity: 1; color: var(--ink-3); background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--surface-2) 10px 20px); }
.tile.out small::after { content: " · épuisé"; color: var(--err); font-weight: 700; }
.tile.pulse { animation: pulse .35s var(--ease); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } }
.payeurs { display: flex; flex-wrap: wrap; gap: var(--s2); padding-bottom: var(--s2); }
.payeur { flex: 1 1 140px; max-width: 220px; min-height: 72px; text-align: left; border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); padding: var(--s2) var(--s3); font: inherit; cursor: pointer; }
.payeur b, .payeur small, .payeur span { display: block; } .payeur b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.payeur small { color: var(--ink-2); font-size: var(--fs-xs); } .payeur span { font-weight: 800; margin-top: 2px; }
.payeur.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.payeur.neg { border-color: var(--err-strong); background: var(--err-soft); } .payeur.neg small { color: var(--err); font-weight: 700; }
.payeur.add { flex: 0 1 120px; display: grid; place-items: center; font-weight: 800; color: var(--brand-ink); border-style: dashed; border-color: var(--brand); }
.cart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s2) var(--s3); margin: var(--s3) 0; box-shadow: var(--sh-1); }
.cart .row { padding: 4px 0; border-bottom: 1px solid var(--line); gap: var(--s2); }
.cart .row:last-child { border: 0; }
.cart .row b { min-width: 28px; text-align: center; font-size: var(--fs-lg); }
.cart .icon { border: 1.5px solid var(--line-strong); border-radius: 50%; font-size: 1.4rem; font-weight: 700; }
.pick { width: 100%; text-align: left; border: 1px solid var(--line); font: inherit; cursor: pointer; }
.pick.sel { border-color: var(--brand); background: var(--brand-soft); }
.pick .neg { color: var(--err); font-weight: 700; }
/* NOUVEAU : barre d'envoi fixe en bas pendant la prise de commande */
.order-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 23; display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08); }
.order-bar .total { flex: 1; font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.order-bar .total small { display: block; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.order-bar .btn { min-width: 150px; }
@media (min-width: 1024px) { .order-bar { left: 256px; } }

/* ---------- 15. Cuisine (lisible à 2 m) ---------- */
body.kds { --fs-md: 1.125rem; }
body.kds .top, body.kds .devise { display: none; }
.kitchen { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--s4); align-items: start; }
.ticket { border-top: 0; border-left: 0; padding: 0; overflow: hidden; border-width: 3px; }
.ticket:not(:has(.t-head)) { padding: var(--s4); border-top-width: 10px; } /* V1 sans en-tête */
.ticket .t-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4); font-size: 1.5rem; font-weight: 800; background: var(--warn-soft); color: var(--warn); }
.ticket .t-age { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.ticket .t-body { padding: var(--s3) var(--s4) var(--s4); }
.ticket.en_cours { border-color: var(--warn-strong); }
.ticket.late { border-color: var(--err-strong); animation: late 1.6s ease-in-out infinite; }
.ticket.late .t-head { background: var(--err-strong); color: var(--on-err); }
.ticket.prete { border-color: var(--ok-strong); }
.ticket.prete .t-head { background: var(--ok-strong); color: #fff; }
.ticket.new .t-head::after { content: "NOUVEAU"; font-size: .875rem; background: var(--ink); color: var(--bg); padding: 2px 8px; border-radius: 6px; }
@keyframes late { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--err-strong) 35%, transparent); } }
.kline { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; column-gap: var(--s3); width: 100%; text-align: left; font: inherit; font-size: 1.5rem; font-weight: 800; line-height: 1.2; padding: var(--s3) var(--s4); margin: var(--s2) 0; min-height: 72px; border-radius: var(--r); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation; }
.kline::before { content: ""; width: 32px; height: 32px; flex: none; border: 3px solid var(--line-strong); border-radius: 8px; }
.kline small { grid-column: 2; display: block; color: var(--err); font-weight: 800; font-size: 1.125rem; }
.kline.pret { color: var(--ink-2); background: var(--ok-soft); border-color: var(--ok-strong); text-decoration: line-through; }
.kline.pret::before { content: "✓"; display: grid; place-items: center; background: var(--ok-strong); border-color: var(--ok-strong); color: #fff; font-size: 1.25rem; text-decoration: none; }
.ticket .kitchen-note { font-size: 1.25rem; }

/* ---------- 16. Factures et reçus ---------- */
.invoice { --ink: #14211d; --ink-2: #46534e; --line: #d5dfda; color-scheme: light; background: #fff; color: var(--ink); border-radius: var(--r-sm); box-shadow: var(--sh-2); padding: var(--s8); max-width: 820px; margin: 0 auto; }
.invoice .badge.orange { background: #fcebd2; color: #7a4100; } .invoice .badge.green { background: #dff3ea; color: #0b6b50; } .invoice .badge.red { background: #fbe4e2; color: #9f1f18; }
.invoice header { display: flex; justify-content: space-between; gap: var(--s5); border-bottom: 3px solid #0f6b57; padding-bottom: var(--s4); margin-bottom: var(--s4); }
.invoice header h1 { color: #9d341e; margin: 0; font-size: 1.75rem; } .invoice header h2 { margin: 6px 0 2px; font-size: var(--fs-lg); } .invoice header p { margin: 0; font-size: var(--fs-sm); color: #46534e; }
.invoice .client { background: #f4f7f5; padding: var(--s3) var(--s4); border-radius: var(--r-sm); }
.invoice table { width: 100%; border-collapse: collapse; margin: var(--s4) 0; table-layout: auto; }
.invoice th, .invoice td { padding: 8px 6px; border-bottom: 1px solid #d5dfda; text-align: left; }
.invoice th { font-size: .8125rem; text-transform: uppercase; color: #46534e; }
.invoice tfoot td { font-size: var(--fs-lg); border: 0; } .invoice tfoot .muted td { font-size: var(--fs-sm); color: #46534e; }
.invoice .paid { color: #0b6b50; font-weight: 800; border: 2px solid #0b6b50; display: inline-block; padding: 4px 12px; border-radius: 6px; transform: rotate(-2deg); }
.invoice .wifi { border: 2px dashed #0f6b57; border-radius: var(--r); padding: var(--s3) var(--s4); margin: var(--s3) 0; }
.invoice .wifi code { font-size: 1.25rem; background: #f4f7f5; letter-spacing: .1em; }
.invoice .legal { margin-top: var(--s6); font-size: .8125rem; color: #46534e; border-top: 1px solid #d5dfda; padding-top: var(--s3); }
.invoice footer { margin-top: var(--s5); font-size: var(--fs-sm); color: #46534e; text-align: center; }
.invoice .sign { display: flex; justify-content: space-between; gap: var(--s6); margin-top: 56px; } .invoice .sign div { border-top: 1px solid #7d8e88; flex: 1; padding-top: 6px; font-size: var(--fs-xs); }
.invoice-actions { max-width: 820px; margin: 0 auto var(--s4); }
@media (max-width: 599px) {
  .invoice { padding: var(--s4); border-radius: 0; margin: 0 calc(-1 * var(--s3)); box-shadow: none; }
  .invoice header { flex-direction: column; } .invoice header .right { text-align: left; margin-left: 0; }
  .invoice th, .invoice td { padding: 8px 4px; font-size: .875rem; }
  .invoice .num { white-space: normal; } /* « 16 000 FCFA » passe à la ligne entre le nombre et FCFA (insécables dans fcfa()) */
}
@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  .side, .top, .tabbar, .offline-banner, .noprint, #toasts, .scrim, .order-bar { display: none !important; }
  html, body { background: #fff !important; color: #000; font-size: 11pt; }
  #view { padding: 0 !important; max-width: none; }
  .invoice { box-shadow: none; padding: 0; margin: 0; max-width: none; border-radius: 0; }
  .invoice header { flex-direction: row !important; } .invoice header .right { text-align: right !important; }
  .invoice table, .invoice tr { page-break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- 17. Pages publiques (reserver.html, compte.html) ---------- */
.pub { max-width: 1040px; margin: 0 auto; padding: var(--s4); }
.pub-hero { position: relative; border-radius: var(--r-xl); overflow: hidden; min-height: 320px; display: grid; align-items: end; background: #0f3d33 center/cover no-repeat; color: #fff; margin-bottom: var(--s4); }
.pub-hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(5,20,16,.85)); }
.pub-hero > div { position: relative; padding: var(--s6); }
.pub-hero h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); margin: 0 0 var(--s2); }
.pub-hero p { color: #e7f2ee; max-width: 56ch; margin: 0; }
.trust { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 var(--s4); padding: 0; list-style: none; }
.trust li { display: inline-flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 6px 12px; font-weight: 600; font-size: var(--fs-sm); }
.room.sel { outline: 3px solid var(--brand); outline-offset: 2px; }
.room .px { font-weight: 800; color: var(--rust); font-size: var(--fs-lg); }
.lang { position: absolute; top: var(--s3); right: var(--s3); z-index: 2; }

/* ---------- 18. Mouvement réduit, texte agrandi ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) { .btn, .badge, .card, .tile, .payeur { border: 1px solid CanvasText; } }

/* ---------- 19. Compléments V1.1 ---------- */
.err-msg { color: var(--err); font-weight: 700; font-size: var(--fs-sm); margin: 6px 0 0; }
[aria-invalid="true"] { border-color: var(--err-strong) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--err-strong) 25%, transparent) !important; }
.money-inp { display: flex; align-items: center; gap: var(--s2); }
.money-inp b { color: var(--ink-2); font-size: var(--fs-sm); }
.date-human { display: block; color: var(--ink-2); margin-top: 4px; font-size: var(--fs-sm); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); margin: var(--s2) 0 var(--s3); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: var(--tap-lg); padding: var(--s2) var(--s3); border: 2px solid var(--line-strong); border-radius: var(--r-lg); font-weight: 700; background: var(--surface); }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.field { display: block; margin-bottom: var(--s4); }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field > small { display: block; color: var(--ink-2); margin-top: 4px; font-size: var(--fs-sm); }
.check { display: flex; gap: var(--s3); align-items: center; min-height: var(--tap); margin: var(--s2) 0 var(--s3); cursor: pointer; }
.check input { width: 26px; height: 26px; min-height: 0; flex: none; accent-color: var(--brand); }
fieldset { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: var(--s3) var(--s4); margin: 0 0 var(--s4); }
legend { font-weight: 800; padding: 0 6px; }
.form { max-width: 760px; }
.mission-now { border: 2px solid var(--brand); background: var(--brand-soft); }
.mission-now .grid-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.mission-now .grid-actions .btn { flex-direction: column; min-height: 72px; font-size: var(--fs-sm); white-space: normal; }
.more-menu { display: grid; gap: var(--s2); }
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--topbar) + 8px); z-index: 150; display: flex; gap: var(--s3); align-items: center; background: var(--ink); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: var(--r-pill); box-shadow: var(--sh-3); font-weight: 650; }
.stale { font-size: var(--fs-xs); color: var(--ink-2); margin: 0 0 var(--s3); }
.kds-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.kds-live { font-size: var(--fs-sm); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.kds-live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok-strong); }

.burger.back { display: inline-grid !important; }
@media (min-width: 1024px) { .burger:not(.back) { display: none !important; } }
.month-card { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s3); align-items: center; }
.month-card small { color: var(--ink-2); }

/* ---------- 20. V1.2 : réglages par module, carte, planning, envois, stock ---------- */
.ico.flip { transform: scaleX(-1); }
.top .gear { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: var(--r-pill); color: var(--ink-2); }
.top .gear.on, .top .gear:hover { background: var(--surface-2); color: var(--brand-ink); }
.top .gear .ico { width: 22px; height: 22px; }
.tabs-bar { display: flex; align-items: flex-end; gap: var(--s2); }
.tabs-bar .tabs { flex: 1; min-width: 0; }
.tabs-bar > .btn { margin-bottom: var(--s4); flex: none; }
.set-row select, .set-row textarea { width: 100%; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-sm); }
.switch { display: inline-flex; align-items: center; gap: var(--s3); min-height: var(--tap); cursor: pointer; font-weight: 650; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 15px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); box-shadow: var(--sh-1); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(22px); }
.switch input:focus-visible { box-shadow: var(--focus); }
.seg-i { display: contents; }
.seg-i input { position: absolute; opacity: 0; pointer-events: none; }
.seg-i span { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; min-height: 44px; font-weight: 650; cursor: pointer; background: var(--surface); color: var(--ink); }
.seg-i input:checked + span { background: var(--brand); color: var(--on-brand); }
.seg-i input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--accent); }
.price-box { background: var(--surface-2); border-radius: var(--r); padding: var(--s3) var(--s4); margin: var(--s2) 0 var(--s3); display: grid; gap: 6px; }
.price-box .big { font-size: var(--fs-lg); }
.danger-t { color: var(--err); display: flex; align-items: center; gap: 6px; }
.envoi.ko { border-left: 6px solid var(--err-strong); }
.envoi b { display: block; }
.mail-st { margin: var(--s2) 0; }
.ph-btn { border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: var(--r); }
img.zoom { width: 100%; height: auto; border-radius: var(--r); }
.day-h { margin: var(--s4) 0 var(--s1); font-size: var(--fs-md); color: var(--ink-2); }
.day-h:first-child { margin-top: 0; }
.ordre { padding: var(--s3) 0; border-top: 1px solid var(--line); gap: var(--s2); }
.ordre:first-of-type { border-top: 0; }
tr.link { cursor: pointer; }
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s2); margin-bottom: var(--s2); scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; background: var(--surface); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.achat-l { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); margin-bottom: var(--s3); background: var(--surface-2); }
.achat-l > select { width: 100%; margin-bottom: var(--s2); }
.achat-l .u-base { display: flex; align-items: center; min-height: var(--tap); }
.inv-l { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s2); }
.inv-l input { text-align: right; }
.eq-g { font-weight: 750; margin: var(--s3) 0 var(--s1); color: var(--ink-2); font-size: var(--fs-sm); }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 var(--s3); }
.lit-row { gap: var(--s2); margin-bottom: var(--s2); }
.lit-row select { flex: 1; min-width: 0; }
.photos figure.main img { outline: 3px solid var(--accent); }
.photos figcaption { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.photos figcaption .icon { position: static; min-width: 36px; min-height: 36px; box-shadow: none; background: var(--surface-2); }
.tile.occupied { border-color: var(--ok-strong); background: var(--ok-soft); }
/* choix de lieu + carte */
.lieu-btn { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3); border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; flex-wrap: wrap; }
.lieu-btn.set { border-style: solid; color: var(--ink); font-weight: 650; }
.lieu-btn small { flex-basis: 100%; color: var(--ok); font-weight: 600; padding-left: 28px; }
.lieux-res { display: grid; gap: 4px; margin: var(--s2) 0; }
.lieux-res.busy { opacity: .6; }
.lieu { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lieu span { display: grid; } .lieu small { color: var(--ink-2); }
.lieu:hover { background: var(--surface-2); }
.osm-box { height: 280px; border-radius: var(--r); margin: var(--s2) 0; }
.osm { position: relative; overflow: hidden; background: #e8eee9; touch-action: none; user-select: none; cursor: grab; border: 1px solid var(--line); }
.osm-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.osm-pin { position: absolute; width: 26px; height: 26px; margin: -26px 0 0 -13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--rust); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); pointer-events: none; }
.osm-pin.alt { width: 16px; height: 16px; margin: -16px 0 0 -8px; background: var(--info); border-width: 2px; opacity: .85; }
.osm-zoom { position: absolute; top: 8px; right: 8px; display: grid; gap: 4px; }
.osm-zoom button { width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 22px; font-weight: 700; cursor: pointer; box-shadow: var(--sh-1); }
.osm-attr { position: absolute; right: 0; bottom: 0; margin: 0; padding: 2px 6px; font-size: 11px; background: rgba(255,255,255,.85); color: #333; border-top-left-radius: 6px; }
.osm-attr a { color: #333; }
/* planning des chambres */
.pl-nav { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.pl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); }
.pl-wrap:focus-visible { box-shadow: var(--focus); }
.pl { display: grid; grid-template-columns: 104px repeat(calc(var(--n) * 2), minmax(22px, 1fr)); min-width: calc(104px + var(--n) * 46px); position: relative; }
.pl-room { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); border-top: 1px solid var(--line); padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; min-height: 56px; grid-column: 1; }
.pl-room b { font-size: var(--fs-sm); line-height: 1.2; } .pl-room small { color: var(--ink-3); font-size: 12px; }
.pl-corner { border-top: 0; min-height: 46px; grid-row: 1; }
.pl-day { grid-column: span 2; grid-row: 1; text-align: center; padding: 4px 0; font-size: 12px; color: var(--ink-2); display: grid; line-height: 1.2; border-left: 1px solid var(--line); }
.pl-day b { font-size: var(--fs-md); color: var(--ink); }
.pl-day.we { background: var(--surface-2); }
.pl-day.today { background: var(--brand); color: var(--on-brand); } .pl-day.today b { color: var(--on-brand); }
.pl-cell { border-left: 1px solid var(--line); border-top: 1px solid var(--line); min-height: 56px; z-index: 1; }
.pl-cell:hover { background: var(--brand-soft); }
.pl-cell.today { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
.pl-bar { z-index: 2; align-self: center; height: 40px; margin: 0 2px; border-radius: 8px; padding: 2px 8px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; white-space: nowrap; text-decoration: none; color: #fff; box-shadow: var(--sh-1); min-width: 0; }
.pl-bar b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; } .pl-bar small { font-size: 11px; opacity: .9; }
.pl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.pl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.st-demande { background: #f0b44c; color: #3d2600 !important; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.08) 6px 12px); }
.st-confirmee { background: #2f6db8; }
.st-arrivee { background: var(--ok-strong); }
.st-partie { background: #8a9893; }
.legend i.st-demande, .legend i.st-confirmee, .legend i.st-arrivee, .legend i.st-partie { color: transparent; }
.pl-foot { min-height: 34px; background: var(--surface-2); }
.pl-occ { border-top: 1px solid var(--line); border-left: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--ink-2); display: grid; place-items: center; background: var(--surface-2); }
.pl-occ.full { color: var(--ok); font-weight: 750; }
.fiche table td:first-child { width: 38%; color: #46534e; }
@media (prefers-color-scheme: dark) {
  .osm { background: #1e2a26; }
  .st-confirmee { background: #3a7fd0; }
}
@media print { .pl-nav, .osm-zoom { display: none; } }

/* ---------- 21. V1.2 · corrections après audit UX ---------- */
@media (max-width: 599px) {
  .tabs-bar > .btn { width: var(--tap); padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .tabs-bar > .btn .ico { width: 22px; height: 22px; }
  .tbl.stack tr.low { background: var(--err-soft); border-radius: var(--r); padding-inline: var(--s2); }
  .tbl.stack tr.low td { background: none; }
  .tbl.stack td.num { white-space: normal; }
  .kpi { min-height: 72px; padding: var(--s3); }
  .kpi b { font-size: var(--fs-xl); }
}
.kpi .ico { width: 20px; height: 20px; color: var(--rust); }
@media (max-width: 399px) { .devise { min-width: 0; padding: 6px 10px; font-size: 13px; } }
.tasks li:has(> [data-ren]) { display: flex; align-items: center; gap: var(--s2); }
.tasks li > label { flex: 1; }
.tasks li > .icon { min-width: 48px; min-height: 48px; }
.card p a[href^="tel:"], .card p a[href*="wa.me"], .card p a[href^="mailto:"] { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.lit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; }
.lit-row select { text-overflow: ellipsis; }
.pl-cell.today { box-shadow: inset 2px 0 var(--brand), inset -2px 0 var(--brand); background: none; }
.envoi dl { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s3); margin: var(--s2) 0; }
.envoi dt { color: var(--ink-2); } .envoi dd { margin: 0; font-weight: 650; }
details.tech summary { cursor: pointer; font-weight: 650; min-height: var(--tap); display: flex; align-items: center; }
details.plus summary { cursor: pointer; font-weight: 650; color: var(--brand-ink); min-height: var(--tap); display: flex; align-items: center; }
.chauffeur-box { border-top: 1px solid var(--line); margin-top: var(--s3); padding-top: var(--s3); }
@media (prefers-color-scheme: dark) { .st-arrivee { color: var(--on-brand); } .st-arrivee small, .st-arrivee b { color: var(--on-brand); } }

/* ===== 22. Bulle de retours (bugs, modifications) et liste des retours ===== */
.retour-bulle { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--s4) + env(safe-area-inset-bottom)); z-index: 90; width: var(--tap-lg); height: var(--tap-lg); border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--brand); color: var(--on-brand, #fff); box-shadow: var(--sh-3); cursor: pointer; }
.retour-bulle .ico { width: 26px; height: 26px; }
.retour-bulle:hover { filter: brightness(1.08); }
.retour-bulle:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 3px; }
body.noscroll .retour-bulle { display: none; }
.journal { margin: 0; padding-left: 1.2em; max-height: 220px; overflow: auto; }
.journal li { padding: 2px 0; overflow-wrap: anywhere; }
.retour-msg { white-space: pre-wrap; font-size: var(--fs-md, 1rem); margin: var(--s2) 0; }
.retour dd { overflow-wrap: anywhere; margin: 0 0 var(--s1); }
.retour dt { color: var(--ink-2); font-weight: 650; }
@media print { .retour-bulle { display: none; } }
@media (max-width: 1023px) { body:not(.no-tabbar) .retour-bulle { bottom: calc(var(--tabbar) + var(--s3) + env(safe-area-inset-bottom)); } }
body.has-bulle #view { padding-bottom: calc(var(--tap-lg) + var(--s8) + env(safe-area-inset-bottom)); }
@media (max-width: 1023px) { body.has-bulle #view { padding-bottom: calc(var(--tabbar) + var(--tap-lg) + var(--s8) + env(safe-area-inset-bottom)); } }
/* audit UX du 17/10 : bulle et retours */
body:has(.order-bar) .retour-bulle { bottom: calc(var(--tap-lg) + 3 * var(--s3) + env(safe-area-inset-bottom)) !important; }
body:has(.scrim.on) .retour-bulle { display: none; }
.retour-msg, .retour .small, .modal .small { overflow-wrap: anywhere; }
.retour code { word-break: break-all; }
details.tech summary, details.plus summary { list-style: none; gap: 8px; }
details.tech summary::-webkit-details-marker, details.plus summary::-webkit-details-marker { display: none; }
details.tech summary::before, details.plus summary::before { content: "▸"; transition: transform .15s; }
details[open].tech > summary::before, details[open].plus > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { details.tech summary::before, details.plus summary::before { transition: none; } }
body.has-bulle:has(.order-bar) #view { padding-bottom: calc(var(--tap-lg) * 3 + var(--s8) + env(safe-area-inset-bottom)); }
