/* ==========================================================================
   Binôme — tokens et composants (piste B « Compte commun »)
   HTML/CSS simple, sans framework.
   Thème : suit le téléphone (prefers-color-scheme). Les classes .light / .dark
   sur .app forcent un thème (utile pour les maquettes ou un réglage manuel).
   Polices : Geist + Geist Mono (Google Fonts)
   <link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet">
   ========================================================================== */

/* ---------- 1. Tokens communs (indépendants du thème) ---------- */
.app {
  /* typographie */
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --fs-2xs: 11px;  --fs-xs: 12px;  --fs-sm: 13px;  --fs-md: 15px;
  --fs-lg: 17px;   --fs-xl: 22px;  --fs-2xl: 28px; --fs-3xl: 34px; --fs-hero: 56px;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  --lh-tight: 1.15; --lh-body: 1.4;
  --tracking-tight: -0.03em; --tracking-hero: -0.045em;

  /* espacements (base 4) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  --gutter: 16px;

  /* rayons */
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 24px; --r-pill: 999px;

  /* tailles tactiles */
  --tap: 44px; --tap-lg: 52px; --tap-xl: 56px;
  --tabbar-h: 68px; --topbar-h: 60px;

  /* mouvement */
  --ease: cubic-bezier(.2, .7, .2, 1); --dur-fast: 120ms; --dur: 200ms;
}

/* ---------- 2. Couleurs — thème clair ---------- */
.app {
  color-scheme: light;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #EEF1F6;
  --line: #E1E5EC;
  --text: #0A0C10;
  --muted: #5B6474;
  --accent: #2F5BEA;
  --on-accent: #FFFFFF;
  --pos: #0E8A5F;
  --neg: #D92D20;
  --warn: #B45309;
  --info: #2F5BEA;
  /* statuts du cycle */
  --st-commande: #7C3AED;
  --st-arrive: #1F6FD1;
  --st-vente: #B45309;
  --st-vendu: #0E8A5F;
  --st-livre: #4B5563;
  /* associés */
  --wen: #C2410C;
  --desmose: #BE185D;
  --on-person: #FFFFFF;
  /* divers */
  --ph: #E6EAF1;
  --ph-2: #DCE2EB;
  --scrim: rgba(10, 12, 16, .45);
  --shadow-1: 0 1px 2px rgba(10, 12, 16, .06);
  --shadow-2: 0 8px 24px rgba(10, 12, 16, .10);
  --shadow-3: 0 16px 40px rgba(10, 12, 16, .18);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- 3. Couleurs — thème sombre ---------- */
.app.dark {
  color-scheme: dark;
  --bg: #0A0C10;
  --surface: #14171E;
  --surface-2: #1C2029;
  --line: #262B36;
  --text: #F3F5F9;
  --muted: #8D95A6;
  --accent: #6E95FF;
  --on-accent: #0A0C10;
  --pos: #3DDC97;
  --neg: #FF6B6B;
  --warn: #F5C451;
  --info: #6E95FF;
  --st-commande: #B39DFF;
  --st-arrive: #6CB0FF;
  --st-vente: #F5C451;
  --st-vendu: #3DDC97;
  --st-livre: #9AA3B2;
  --wen: #F5A35C;
  --desmose: #F472B6;
  --on-person: #0A0C10;
  --ph: #1C2029;
  --ph-2: #232836;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: none;
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
  .app:not(.light) {
    color-scheme: dark;
    --bg: #0A0C10; --surface: #14171E; --surface-2: #1C2029; --line: #262B36;
    --text: #F3F5F9; --muted: #8D95A6; --accent: #6E95FF; --on-accent: #0A0C10;
    --pos: #3DDC97; --neg: #FF6B6B; --warn: #F5C451; --info: #6E95FF;
    --st-commande: #B39DFF; --st-arrive: #6CB0FF; --st-vente: #F5C451;
    --st-vendu: #3DDC97; --st-livre: #9AA3B2;
    --wen: #F5A35C; --desmose: #F472B6; --on-person: #0A0C10;
    --ph: #1C2029; --ph-2: #232836; --scrim: rgba(0, 0, 0, .6);
    --shadow-1: none; --shadow-2: 0 8px 24px rgba(0, 0, 0, .35); --shadow-3: 0 16px 40px rgba(0, 0, 0, .55);
  }
}

/* ---------- 4. Base ---------- */
.app {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.app, .app *, .app *::before, .app *::after { box-sizing: border-box; }
.app h1, .app h2, .app h3, .app p { margin: 0; }
.app button, .app input, .app select, .app textarea { font: inherit; color: inherit; }
.app a { color: inherit; text-decoration: none; }
.app :focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* utilitaires légers */
.hstack { display: flex; align-items: center; gap: var(--sp-2); }
.vstack { display: flex; flex-direction: column; gap: var(--sp-2); }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.xs { font-size: var(--fs-xs); } .sm { font-size: var(--fs-sm); } .lg { font-size: var(--fs-lg); }
.strong { font-weight: var(--fw-semibold); }
.right { text-align: right; } .center { text-align: center; }
.mono, .money { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.nowrap { white-space: nowrap; }

/* ---------- 5. Icônes (Lucide, trait 1,75) ---------- */
.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; } .i.lg { width: 24px; height: 24px; } .i.xl { width: 32px; height: 32px; stroke-width: 1.5; }
.i.fill { fill: currentColor; stroke: none; }
.ic-box { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text); }
.ic-box.sm { width: 34px; height: 34px; border-radius: 10px; }
.ic-box.round { border-radius: 50%; }
.ic-box.tint { --c: var(--accent); color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }

/* ---------- 6. Structure d'écran ---------- */
.phone { width: 390px; display: flex; flex-direction: column; overflow: hidden; position: relative; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--topbar-h); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--gutter); }
.topbar.center { justify-content: space-between; padding: var(--sp-2); }
.topbar .title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.topbar .title-lg { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.content { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--sp-5); padding: var(--sp-2) var(--gutter) var(--sp-6); }
.section { display: flex; flex-direction: column; gap: var(--sp-3); }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--sp-1); min-height: var(--tap); }
.section-head h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.link { color: var(--accent); font-size: var(--fs-md); font-weight: var(--fw-medium); min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--sp-1); }
.actionbar { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--gutter) var(--sp-4); background: var(--surface); border-top: 1px solid var(--line); }

.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); padding: 0; flex-shrink: 0; cursor: pointer; }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* barre d'onglets */
.tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding: var(--sp-1) 0 var(--sp-2); }
.tabbar a { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); color: var(--muted); font-size: var(--fs-2xs); font-weight: var(--fw-medium); position: relative; }
.tabbar .pill { width: 52px; height: 30px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center; }
.tabbar a.on { color: var(--accent); font-weight: var(--fw-semibold); }
.tabbar a.on .pill { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.tabbar .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--neg); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------- 7. Cartes et chiffres ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); }
.card.flush { padding: 0; overflow: hidden; }
.card.xl { border-radius: var(--r-xl); padding: var(--sp-5); }
.card.accent { border: 2px solid var(--accent); }
.card.tint { --c: var(--accent); background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-color: color-mix(in srgb, var(--c) 30%, var(--line)); }

.amount-hero { font-size: var(--fs-hero); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-hero); line-height: 1; }
.amount-xl { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: -0.04em; line-height: 1.05; }
.amount-lg { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: -0.035em; line-height: 1.1; }
.amount-hero .dec, .amount-xl .dec, .amount-lg .dec { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.kpi-label { font-size: var(--fs-sm); color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: 1.1; }
.kpi-sub { font-size: var(--fs-xs); color: var(--muted); }

/* lignes clé / valeur */
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-row .k { flex: 1; font-size: var(--fs-md); color: var(--muted); }
.kv-row .v { font-family: var(--font-mono); font-size: var(--fs-md); color: var(--text); text-align: right; }
.kv-row.total .k, .kv-row.total .v { color: var(--text); font-weight: var(--fw-semibold); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex-shrink: 0; }

/* ---------- 8. Listes ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: 10px 14px; color: var(--text); }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: var(--fs-md); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.row .chev { color: var(--muted); }
.thumb { width: 52px; height: 52px; border-radius: 12px; background: var(--ph); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.thumb.lg { width: 64px; height: 64px; border-radius: 14px; }
.list-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: var(--sp-2) var(--sp-1) 0; }

/* avatars */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: var(--fw-bold); color: var(--on-person); background: var(--muted); flex-shrink: 0; }
.av.wen { background: var(--wen); } .av.desmose { background: var(--desmose); }
.av.xs { width: 22px; height: 22px; font-size: 11px; } .av.lg { width: 44px; height: 44px; font-size: 17px; } .av.xl { width: 64px; height: 64px; font-size: 24px; }

/* ---------- 9. Badges de statut ---------- */
.badge { --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.2; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.sm { padding: 2px 8px; font-size: var(--fs-2xs); gap: 4px; }
.badge.sm::before { width: 6px; height: 6px; }
.badge.plain::before { display: none; }
.badge.commande { --c: var(--st-commande); }
.badge.arrive   { --c: var(--st-arrive); }
.badge.vente    { --c: var(--st-vente); }
.badge.vendu    { --c: var(--st-vendu); }
.badge.livre    { --c: var(--st-livre); }
.badge.pos { --c: var(--pos); } .badge.neg { --c: var(--neg); } .badge.warn { --c: var(--warn); } .badge.info { --c: var(--accent); }

/* ---------- 10. Frise du cycle ---------- */
.cycle { display: flex; flex-direction: column; gap: 10px; }
.cycle-bars, .cycle-labels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.cycle-bars span { height: 6px; border-radius: 3px; background: var(--surface-2); }
.cycle-bars span.done { background: var(--c); }
.cycle-bars span.now { background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.cycle-labels span { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); color: var(--muted); }
.cycle-labels b { font-weight: var(--fw-medium); color: var(--text); }
.cycle-labels .now b { color: var(--c); font-weight: var(--fw-semibold); }
.c1 { --c: var(--st-commande); } .c2 { --c: var(--st-arrive); } .c3 { --c: var(--st-vente); } .c4 { --c: var(--st-vendu); } .c5 { --c: var(--st-livre); }

/* ---------- 11. Boutons ---------- */
.btn { min-height: var(--tap-lg); padding: 0 var(--sp-5); border: none; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: 16px; font-weight: var(--fw-semibold); cursor: pointer; white-space: nowrap; transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast); }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.sm { min-height: var(--tap); font-size: var(--fs-md); padding: 0 var(--sp-4); border-radius: 12px; }
.btn.xl { min-height: var(--tap-xl); font-size: var(--fs-lg); border-radius: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
.btn-danger.solid { background: var(--neg); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn[disabled], .btn.is-disabled { opacity: .4; pointer-events: none; }
.btn.is-loading { color: transparent; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; }

/* ---------- 12. Champs ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > .label, .label { font-size: var(--fs-sm); color: var(--muted); font-weight: var(--fw-medium); }
.input { min-height: 48px; width: 100%; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid transparent; padding: 0 14px; font-size: 16px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.input input, .input select, input.input, select.input, textarea.input { border: none; background: transparent; outline: none; font-size: 16px; color: var(--text); flex: 1; min-width: 0; padding: 0; }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: var(--lh-body); }
.input .affix { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-md); }
.input.is-focus { border-color: var(--accent); box-shadow: var(--focus); }
.input.is-error { border-color: var(--neg); }
.input.is-readonly { background: transparent; border: 1.5px dashed var(--line); }
.help { font-size: var(--fs-xs); color: var(--muted); }
.help.error { color: var(--neg); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.input input::placeholder { color: var(--muted); opacity: .8; }

/* segmented / choix à deux */
.seg { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 4px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; }
.seg button { min-height: var(--tap); border: none; border-radius: 10px; background: transparent; color: var(--muted); font-size: var(--fs-md); font-weight: var(--fw-medium); display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: var(--fw-semibold); box-shadow: var(--shadow-1); }
.app.dark .seg button[aria-pressed="true"] { background: var(--bg); }

/* choix de prix (radio en cartes) */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.choices.stack { grid-template-columns: minmax(0, 1fr); }
.choice { position: relative; min-height: 84px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.choice.row-like { min-height: 64px; flex-direction: row; align-items: center; gap: var(--sp-3); }
.choice input[type="radio"], .choice input[type="checkbox"] { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.choice.row-like input { position: static; }
.choice.on { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); padding: 11px; }
.choice .choice-label { font-size: var(--fs-sm); color: var(--muted); }
.choice .choice-value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); display: flex; align-items: baseline; gap: 4px; }
.choice .choice-value input { width: 100%; border: none; background: transparent; font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text); padding: 0; outline: none; }
.choice.is-disabled { opacity: .45; }

/* pastilles de filtre (40 px visibles, 44 px de zone tactile) */
.chips { display: flex; gap: var(--sp-2); flex-wrap: nowrap; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chip { position: relative; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: var(--fw-medium); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.chip::after { content: ""; position: absolute; inset: -2px 0; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.chip.on .count { color: color-mix(in srgb, var(--bg) 70%, transparent); }

/* onglets */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); }
.tab { min-height: var(--tap); padding: 0 var(--sp-3); border: none; background: transparent; color: var(--muted); font-size: var(--fs-md); font-weight: var(--fw-medium); cursor: pointer; box-shadow: inset 0 -2px 0 transparent; }
.tab.on { color: var(--text); font-weight: var(--fw-semibold); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- 13. Messages ---------- */
.alert { --c: var(--info); display: flex; gap: var(--sp-3); align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); color: var(--text); font-size: var(--fs-md); }
.alert .i { color: var(--c); margin-top: 1px; }
.alert .alert-title { font-weight: var(--fw-semibold); }
.alert .alert-text { color: var(--muted); font-size: var(--fs-sm); }
.alert.success { --c: var(--pos); } .alert.error { --c: var(--neg); } .alert.warn { --c: var(--warn); } .alert.info { --c: var(--info); }
.toast { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 14px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: var(--fs-md); box-shadow: var(--shadow-3); }
.toast .toast-action { margin-left: auto; color: color-mix(in srgb, var(--accent) 70%, var(--bg)); font-weight: var(--fw-semibold); min-height: var(--tap); display: inline-flex; align-items: center; background: none; border: none; }

/* ---------- 14. Envoi de fichier ---------- */
.dropzone { border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent); border-radius: var(--r-lg); min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); text-align: center; padding: var(--sp-4); background: transparent; width: 100%; cursor: pointer; }
.dropzone .dz-title { color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.dropzone.is-required { border-color: color-mix(in srgb, var(--warn) 70%, transparent); }
.upload { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.upload .thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--ph-2); }
.progress { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 22%, transparent); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); border-radius: 3px; }
.progress.done > span { background: var(--pos); }
.progress.error > span { background: var(--neg); }

/* ---------- 15. Médias : carrousel et galerie ---------- */
.carousel { display: flex; flex-direction: column; gap: 10px; }
.carousel-main { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-xl); background: var(--ph); display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.carousel-main .counter { position: absolute; top: 14px; right: 14px; font-size: var(--fs-xs); font-weight: var(--fw-medium); background: var(--bg); color: var(--text); border-radius: var(--r-pill); padding: 4px 10px; }
.carousel-main .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.carousel-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.carousel-thumbs span { aspect-ratio: 1; border-radius: 12px; background: var(--ph-2); }
.carousel-thumbs span.on { background: var(--ph); box-shadow: inset 0 0 0 2px var(--accent); }
.ph-label { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.proof { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 6px; color: var(--text); min-width: 0; }
.proof-media { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.proof-media .tag { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: var(--fw-semibold); background: var(--bg); color: var(--text); border-radius: var(--r-pill); padding: 2px 6px; }
.proof-name { font-size: var(--fs-xs); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-sub { font-size: 10px; color: var(--muted); }

/* ---------- 16. Chat ---------- */
.thread { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4) var(--sp-3); flex: 1 1 auto; }
.day { align-self: center; font-size: var(--fs-xs); color: var(--muted); background: var(--surface); border-radius: var(--r-pill); padding: 4px 12px; }
.bubble { max-width: 76%; padding: 10px 14px; border-radius: 20px; font-size: var(--fs-md); line-height: var(--lh-body); }
.bubble.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.msg-meta { font-size: var(--fs-2xs); color: var(--muted); padding: 0 6px; }
.msg-meta.me { align-self: flex-end; }
.media-msg { align-self: flex-end; width: 240px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.media-msg.them { align-self: flex-start; align-items: flex-start; }
.media-box { width: 100%; border-radius: 20px; border-bottom-right-radius: 6px; background: var(--ph); position: relative; display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.media-box .tag { position: absolute; top: 10px; left: 10px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); background: var(--bg); color: var(--text); padding: 3px 8px; border-radius: var(--r-pill); }
.media-box .dur { position: absolute; bottom: 8px; right: 8px; font-family: var(--font-mono); font-size: var(--fs-2xs); background: var(--bg); color: var(--text); padding: 2px 8px; border-radius: var(--r-pill); }
.play { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--text); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; }
.quote-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); min-height: var(--tap); }
.quote-card .thumb { width: 52px; height: 52px; }
.composer { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) 10px 10px; background: var(--bg); }
.composer-row { display: flex; align-items: center; gap: var(--sp-2); }
.composer-input { flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); font-size: 16px; padding: 0 16px; outline: none; }

/* ---------- 17. Données : jauges, histogramme, barres, tableau ---------- */
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: flex; gap: 2px; }
.meter > span { height: 100%; width: var(--p, 0%); background: var(--c, var(--accent)); border-radius: 4px; }
.meter.sm { height: 6px; }
.meter.split > span { border-radius: 0; }
.ring { --p: 0; --c: var(--pos); width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ring::before { content: ""; position: absolute; }
.ring > span { width: 56px; height: 56px; border-radius: 50%; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: var(--fw-medium); }

.hist { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; }
.hist .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.hist .bar { width: 100%; height: var(--h, 0%); min-height: 2px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--accent) 45%, transparent); }
.hist .col.on .bar { background: var(--accent); }
.hist .col.neg .bar { background: var(--neg); }
.hist .m { font-size: 10px; color: var(--muted); }
.hist .col.on .m { color: var(--text); font-weight: var(--fw-semibold); }

.hbars { display: flex; flex-direction: column; gap: var(--sp-3); }
.hbar { display: grid; grid-template-columns: 96px minmax(0, 1fr) 72px; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.hbar .track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.hbar .track > span { display: block; height: 100%; width: var(--p, 0%); background: var(--c, var(--accent)); border-radius: 5px; }
.hbar .val { font-family: var(--font-mono); text-align: right; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 0 8px; }
.table td { padding: 10px 0; border-top: 1px solid var(--line); }
.table .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.table th.num { font-family: var(--font); }
.table tfoot td { font-weight: var(--fw-semibold); }

/* ---------- 18. États vides, hors ligne, divers ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-8) var(--sp-6); }
.empty-ic { width: 72px; height: 72px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.empty h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.empty p { font-size: var(--fs-md); color: var(--muted); max-width: 280px; }
.offline-bar { display: flex; align-items: center; gap: var(--sp-2); padding: 8px var(--gutter); background: var(--text); color: var(--bg); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.sep-label { display: flex; align-items: center; gap: var(--sp-3); color: var(--muted); font-size: var(--fs-xs); }
.sep-label::before, .sep-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sheet { background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--sp-2) var(--gutter) var(--sp-5); box-shadow: var(--shadow-3); display: flex; flex-direction: column; gap: var(--sp-3); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; margin-bottom: var(--sp-2); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: var(--r-pill); padding: 2px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.stepper span { min-width: 28px; text-align: center; font-family: var(--font-mono); }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex-shrink: 0; border: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 23px; }
.celebrate { position: relative; overflow: hidden; }
.confetti { position: absolute; width: 8px; height: 8px; border-radius: 2px; background: var(--c); transform: rotate(var(--r, 20deg)); }

/* ---------- 19. Maquettes uniquement ---------- */
.board { display: flex; gap: 80px; align-items: flex-start; }
.board-col { display: flex; flex-direction: column; gap: 12px; }
.board-label { font-family: var(--font); font-size: 13px; color: #5B6474; }
