/* ══════════════════════════════════════════════════════════════════════════
   PUCACE — Design system « Paper & Ink »
   Fraunces (titres, éditorial) + DM Sans (texte) + terracotta #C45C18.
   Thème clair (papier chaud) & sombre (encre nuit). Contrastes AA.

   Le SOIN vient des RÈGLES, pas seulement des variables : profondeur des
   cartes (ombres en couches), densité (dividers, tableaux zébrés), états
   tactiles (hover/active/focus), hiérarchie typo Fraunces vs DM Sans.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --paper: #faf7f2;
  --paper-2: #f3ece1;
  --paper-3: #ede4d5;
  --card: #ffffff;
  --ink: #241e17;
  --ink-2: #5c5347;
  --muted: #8b8073;
  --line: #e4dccf;
  --line-2: #d3c8b6;
  --accent: #c45c18;
  --accent-2: #a24d14;
  --accent-ink: #ffffff;
  --accent-soft: #f6e8dc;

  --cash: #3f7d4e;    --cash-bg: #eaf3ec;
  --twint: #2f5fb0;   --twint-bg: #e8eef8;
  --later: #b23a2e;   --later-bg: #f8e9e7;
  --warn: #a6771a;    --warn-bg: #f7efdc;

  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Ombres en COUCHES (contact rapproché + halo diffus) — c'est ce qui fait
     « respirer » une carte au lieu d'un aplat. */
  --shadow-sm: 0 1px 2px rgba(36,30,23,.08);
  --shadow: 0 1px 2px rgba(36,30,23,.06), 0 8px 24px -12px rgba(36,30,23,.18);
  --shadow-card: 0 1px 2px rgba(36,30,23,.05), 0 6px 16px -10px rgba(36,30,23,.16);
  --shadow-hover: 0 2px 6px rgba(36,30,23,.09), 0 16px 34px -14px rgba(36,30,23,.24);
  --shadow-pop: 0 10px 28px -8px rgba(36,30,23,.20), 0 30px 70px -24px rgba(36,30,23,.34);
  --ring: 0 0 0 3px var(--accent-soft);

  /* Échelle d'espacement 4/8/12/16/24/32 — rythme constant. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --sp: 8px;

  --t-fast: .13s; --t-base: .22s; --ease: cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14110e; --paper-2: #1c1813; --paper-3: #241e17; --card: #201b15;
    --ink: #ece4d8; --ink-2: #b9ad9c; --muted: #8a7f70;
    --line: #322b22; --line-2: #423a2e;
    --accent: #e8862e; --accent-2: #f0a04e; --accent-ink: #1a1510; --accent-soft: #2c2115;
    --cash: #7bc48c; --cash-bg: #1b2a1f; --twint: #8fb2e8; --twint-bg: #172234;
    --later: #e88b7e; --later-bg: #2e1a17; --warn: #e0b458; --warn-bg: #2a2213;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.6);
    --shadow-hover: 0 2px 8px rgba(0,0,0,.5), 0 18px 40px -14px rgba(0,0,0,.72);
    --shadow-pop: 0 14px 40px -10px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.5);
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}
:root[data-theme='light'] { color-scheme: light; --paper:#faf7f2;--paper-2:#f3ece1;--paper-3:#ede4d5;--card:#fff;--ink:#241e17;--ink-2:#5c5347;--muted:#8b8073;--line:#e4dccf;--line-2:#d3c8b6;--accent:#c45c18;--accent-2:#a24d14;--accent-ink:#fff;--accent-soft:#f6e8dc;--cash:#3f7d4e;--cash-bg:#eaf3ec;--twint:#2f5fb0;--twint-bg:#e8eef8;--later:#b23a2e;--later-bg:#f8e9e7;--warn:#a6771a;--warn-bg:#f7efdc;
  --shadow-sm:0 1px 2px rgba(36,30,23,.08);--shadow:0 1px 2px rgba(36,30,23,.06),0 8px 24px -12px rgba(36,30,23,.18);--shadow-card:0 1px 2px rgba(36,30,23,.05),0 6px 16px -10px rgba(36,30,23,.16);--shadow-hover:0 2px 6px rgba(36,30,23,.09),0 16px 34px -14px rgba(36,30,23,.24);--shadow-pop:0 10px 28px -8px rgba(36,30,23,.20),0 30px 70px -24px rgba(36,30,23,.34);--ring:0 0 0 3px var(--accent-soft); }
:root[data-theme='dark'] { color-scheme: dark; --paper:#14110e;--paper-2:#1c1813;--paper-3:#241e17;--card:#201b15;--ink:#ece4d8;--ink-2:#b9ad9c;--muted:#8a7f70;--line:#322b22;--line-2:#423a2e;--accent:#e8862e;--accent-2:#f0a04e;--accent-ink:#1a1510;--accent-soft:#2c2115;--cash:#7bc48c;--cash-bg:#1b2a1f;--twint:#8fb2e8;--twint-bg:#172234;--later:#e88b7e;--later-bg:#2e1a17;--warn:#e0b458;--warn-bg:#2a2213;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);--shadow:0 1px 2px rgba(0,0,0,.3),0 10px 30px -14px rgba(0,0,0,.6);--shadow-card:0 1px 2px rgba(0,0,0,.4),0 8px 22px -12px rgba(0,0,0,.6);--shadow-hover:0 2px 8px rgba(0,0,0,.5),0 18px 40px -14px rgba(0,0,0,.72);--shadow-pop:0 14px 40px -10px rgba(0,0,0,.6),0 2px 8px rgba(0,0,0,.5);--ring:0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft); color: var(--accent-2); }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: 2rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.12rem; }
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { text-decoration: underline; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 5px; }

/* Barre de défilement fine (desktop) — détail discret. */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  border-right: 1px solid var(--line); padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px 16px; margin-bottom: 10px; border-bottom: 1px solid var(--line); position: relative; }
.brand::before { content: ''; position: absolute; left: 8px; bottom: -1px; width: 34px; height: 2px; background: var(--accent); border-radius: 2px; }
.brand b { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.brand span { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2); font-weight: 500; margin-bottom: 2px; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.nav a:hover { background: var(--card); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a .ic { width: 18px; text-align: center; opacity: .8; font-size: 1.05em; }
.nav a.active .ic { opacity: 1; }
.main { padding: 28px clamp(16px, 3vw, 44px); max-width: 1240px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.pagehead h1 { position: relative; }
.pagehead .sub { color: var(--muted); font-size: .92rem; margin-top: 5px; font-style: italic; font-family: var(--font-serif); font-weight: 400; }

@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-flow: row wrap; gap: 6px; align-items: center; }
  .brand { width: 100%; padding-bottom: 8px; margin-bottom: 4px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav a { margin: 0; }
  .main { padding: 18px 14px; }
  .pagehead { flex-wrap: wrap; }
}

/* ── Cartes & utilitaires ────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.grid { display: grid; gap: 14px; align-items: start; }   /* start = pas d'étirement → fin des grands vides */
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* KPI / statistiques — structure lisible : micro-label · filet · valeur Fraunces. */
.stat { padding: 15px 18px 17px; display: flex; flex-direction: column; transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease); }
.card.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--line-2); }
.stat .k { font-size: .69rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; padding-bottom: 9px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.stat .v { font-family: var(--font-serif); font-size: 1.7rem; font-weight: 600; line-height: 1.08; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-wrap: balance; }
.stat .v small { font-size: .8rem; color: var(--muted); font-family: var(--font-sans); font-weight: 500; letter-spacing: 0; }
.stat .foot { margin-top: 8px; font-size: .8rem; color: var(--muted); }
/* Tuile KPI cliquable (Aujourd'hui / Compta) : mène à l'écran d'action. Chevron discret,
   marqué à l'accent au survol. Additif — classe utilisée uniquement par ces deux écrans. */
.statlink { position: relative; color: inherit; text-decoration: none; cursor: pointer; }
.statlink:hover { text-decoration: none; color: inherit; }
.statlink::after { content: '›'; position: absolute; top: 13px; right: 15px; font-size: 1.15rem; line-height: 1; color: var(--muted); opacity: .55; transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.statlink:hover::after { opacity: 1; color: var(--accent); transform: translateX(2px); }

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); padding: 8px 14px; min-height: 38px;
  border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 1px 2px rgba(36,30,23,.14), 0 4px 12px -6px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); filter: brightness(1.06); box-shadow: var(--shadow-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { border-color: transparent; background: var(--paper-2); color: var(--ink); }
.btn.danger { color: var(--later); border-color: color-mix(in srgb, var(--later) 45%, var(--line-2)); background: var(--card); }
.btn.danger:hover { color: var(--later); border-color: var(--later); background: var(--later-bg); }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: .84rem; border-radius: 8px; }
.btn.big { padding: 13px 16px; min-height: 48px; font-size: 1rem; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }

/* ── Formulaires ─────────────────────────────────────────────────────────── */
.input, select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: var(--card); color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:hover, select:hover, textarea:hover { border-color: var(--muted); }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
select { cursor: pointer; }
input[type='date'] { min-height: 38px; }
label.field { display: block; margin-bottom: 13px; }
/* Intitulé de champ. `.caption` porte la même typographie pour les champs qui ne
   sont pas un <label class="field"> — un secret, par exemple, n'a pas de champ de
   saisie tant qu'on ne clique pas « Renouveler », mais son intitulé doit s'aligner
   sur les autres. Un seul jeu de règles, donc aucune dérive possible entre les deux. */
label.field > span, .caption { display: block; font-size: .72rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
/* Aide sous un champ : phrase, pas légende — elle ne doit hériter ni des capitales
   ni de l'interlettrage de l'intitulé, même placée à l'intérieur du <label>. */
label.field > .hint, .hint { display: block; text-transform: none; letter-spacing: 0; font-size: .78rem; color: var(--ink-2); margin-top: 5px; }
input[type='checkbox'] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: var(--radius-pill); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.cash { background: var(--cash-bg); color: var(--cash); border-color: color-mix(in srgb, var(--cash) 28%, transparent); }
.badge.twint { background: var(--twint-bg); color: var(--twint); border-color: color-mix(in srgb, var(--twint) 28%, transparent); }
.badge.later { background: var(--later-bg); color: var(--later); border-color: color-mix(in srgb, var(--later) 28%, transparent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.neutral { background: var(--paper-2); color: var(--ink-2); border-color: var(--line-2); }

/* ── Tableaux ────────────────────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px;
  background: var(--paper-2); border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.data thead th:first-child { border-top-left-radius: 10px; }
table.data thead th:last-child { border-top-right-radius: 10px; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-2) 42%, transparent); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--t-fast) var(--ease); }
table.data tbody tr:hover td { background: var(--accent-soft); }

/* ── Fiche client (ADDITIF — utilisé par l'écran Clients uniquement) ─────── */
/* Monogramme : pastille d'initiales. Le PALIER (volume cumulé livré) est repris
   de la prod — un client « gold » se repère sans lire un chiffre. Encre sur
   papier au repos, teinté dès le bronze. */
.mono-av {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .74rem; font-weight: 700; letter-spacing: .02em;
  background: var(--paper-2); color: var(--ink-2);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-sm);
}
.mono-av.bronze { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.mono-av.silver { background: var(--twint-bg); color: var(--twint); border-color: color-mix(in srgb, var(--twint) 30%, transparent); }
.mono-av.gold   { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.mono-av.big { width: 54px; height: 54px; font-size: 1.1rem; font-family: var(--font-serif); }

/* Ligne de tableau menant à une fiche. */
tr.clickrow { cursor: pointer; }

/* Un montant ne se coupe JAMAIS en deux lignes (« 1175,00 » / « CHF »). Classe
   explicite plutôt qu'une règle sur .mono : ne change aucun autre écran. */
table.data td.nowrap { white-space: nowrap; }

/* Adresse secondaire : une seule ligne, coupée proprement — sinon une adresse de
   53 caractères double la hauteur de sa ligne et casse le rythme du tableau. */
.ellip { display: block; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* En-tête de groupe dans un tableau (historique par mois) : une respiration
   dans la densité, sans casser l'alignement des colonnes. */
table.data tbody tr.grouphead td {
  background: var(--paper-2); border-bottom: 1px solid var(--line-2);
  font-family: var(--font-serif); font-weight: 600; font-size: .95rem;
  text-transform: capitalize; padding-top: 13px; padding-bottom: 9px;
}
table.data tbody tr.grouphead:hover td { background: var(--paper-2); }
/* Les sous-totaux gardent la sobriété du corps de tableau (et pas la capitale
   du libellé de mois : « 1 kg », jamais « 1 Kg »). */
table.data tbody tr.grouphead td.mono { font-family: var(--font-sans); font-size: .84rem; color: var(--ink-2); text-transform: none; font-weight: 500; }

/* Liste de définitions (libellé / valeur) — bloc contact d'une fiche. */
.deflist { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; align-items: baseline; }
.deflist dt { font-size: .68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.deflist dd { margin: 0; overflow-wrap: anywhere; }

/* ── Onglets ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { font: inherit; font-weight: 600; background: none; border: none; padding: 9px 15px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.tabs button:hover { color: var(--ink); background: var(--paper-2); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Toast, overlay, modal, vides ────────────────────────────────────────── */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); z-index: 100; font-size: .9rem; font-weight: 500; animation: toastIn .28s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.overlay { position: fixed; inset: 0; background: rgba(20,17,14,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: overlayIn var(--t-base) var(--ease); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 24px; animation: modalIn var(--t-base) var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal .spread h2 { font-size: 1.35rem; }
.empty { text-align: center; color: var(--muted); padding: 52px 16px; font-style: italic; font-family: var(--font-serif); font-size: 1rem; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(120% 80% at 50% -10%, var(--paper-2), var(--paper) 60%); }
.login-card { width: min(400px, 100%); padding: 36px 34px; box-shadow: var(--shadow-pop); position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ── App Livraison (mobile-first) ────────────────────────────────────────── */
.mob { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); }
.mob-head { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 16px; box-shadow: var(--shadow-sm); }
.mob-head h1 { font-size: 1.4rem; }
.syncbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.dot.on { background: var(--cash); color: var(--cash); } .dot.off { background: var(--later); color: var(--later); } .dot.pend { background: var(--warn); color: var(--warn); }
.dcard { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: center; cursor: pointer; transition: background var(--t-fast) var(--ease); }
.dcard:hover { background: var(--paper-2); }
.dcard:active { background: var(--paper-3); }
.dcard .ord { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.dcard .body { flex: 1; min-width: 0; }
.dcard .body b { display: block; }
.dcard .body .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; background: rgba(20,17,14,.5); backdrop-filter: blur(4px); animation: overlayIn var(--t-base) var(--ease); }
.sheet-inner { background: var(--card); width: 100%; max-height: 92dvh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-pop); animation: sheetIn var(--t-base) var(--ease); }
@keyframes sheetIn { from { transform: translateY(6%); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: -6px auto 14px; }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.act-grid .btn { justify-content: center; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.outbox-item { display: flex; gap: 8px; align-items: center; font-size: .82rem; padding: 4px 0; }
.livmap { width: 100%; height: 64vh; }
.mk { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 2px solid #fff; }
.mk-done { background: var(--cash); } .mk-start { background: #241e17; }
.viewtabs { display: flex; gap: 6px; padding: 10px 16px 2px; }
.viewtabs button { flex: 1; padding: 9px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all var(--t-fast) var(--ease); }
.viewtabs button:hover { border-color: var(--line-2); }
.viewtabs button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ── Écran Vitrine : panneau d'édition + aperçu du vrai site ─────────────── */
/* L'aperçu occupe la hauteur restante et défile SEUL : c'est une page web
   entière, la faire défiler avec le panneau rendrait les deux inutilisables. */
.site-editor { display: grid; grid-template-columns: 380px 1fr; gap: 14px; align-items: stretch; height: calc(100dvh - 168px); min-height: 460px; }
.site-panel { overflow: auto; padding: 14px; }
.site-panel-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.site-group { border-top: 1px solid var(--line); padding: 8px 0; }
.site-group > summary { cursor: pointer; font-weight: 600; font-family: var(--font-serif); font-size: 1.02rem; padding: 4px 0; list-style: none; }
.site-group > summary::-webkit-details-marker { display: none; }
.site-group > summary::before { content: '▸'; display: inline-block; width: 1.1em; color: var(--accent); transition: transform var(--t-fast) var(--ease); }
.site-group[open] > summary::before { transform: rotate(90deg); }
.site-list { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin: 8px 0; background: var(--paper-2); }
.site-list-item { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }
.site-list-item:first-of-type { border-top: 0; }
/* Le champ sélectionné dans l'aperçu doit se retrouver d'un coup d'œil. */
.field-sel > span { color: var(--accent); font-weight: 600; }
.field-sel .input { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.site-preview { overflow: auto; background: var(--paper-3); border: 1px solid var(--line); border-radius: var(--radius); }
.site-frame { display: block; width: 100%; height: 100%; min-height: 100%; border: 0; background: #fff; }
@media (max-width: 1080px) {
  .site-editor { grid-template-columns: 1fr; height: auto; }
  .site-panel { max-height: none; }
  .site-preview { height: 70dvh; }
}
