/* ===== Panneau K0BR4 : couleurs des deux thèmes, ambiance, structure, coquille =====
   Refonte validée le 17 novembre 2026 (maquette/panneau/refonte/, section « refonte » de maquette/panneau/LISEZ-MOI.md).
   Même charte (graphite + corail, Sora / DM Sans / JetBrains Mono, brand/CHARTE.md), plus de profondeur :
   une lumière de fond qui vit lentement, des surfaces en verre, un relief net, du mouvement qui guide.
   Tout ce qui bouge n'anime que transform et opacity (fluide sur une carte graphique Intel UHD 630).

   Noms des variables : ceux du panneau (--bg, --surface, --border, --text, --muted…), complétés par ceux de la maquette
   traduits dans le même esprit (--glass pour --verre, --surface-solid pour --surface-pleine, --faint pour --pale…).
   Les adresses url(...) relatives sont versionnées par tool/gen_assets.dart (?v= du fichier visé). */

@font-face { font-family: "Sora"; src: url(../../fonts/sora.ttf?v=84ff7096ae) format("truetype"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(../../fonts/dm-sans.ttf?v=8cd08d97e8) format("truetype"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(../../fonts/jetbrains-mono.ttf?v=48715a42ec) format("truetype"); font-weight: 100 800; font-display: swap; }

/* ---------- Couleurs : clair (sans choix, le panneau suit Windows ; panneau.js pose data-theme avant l'affichage) ---------- */
:root {
  --graphite-950: #12161C; --graphite-900: #1B2129; --graphite-800: #1E252E; --graphite-700: #2A323D; --graphite-500: #5C6572;
  --graphite-400: #8B95A3; --graphite-200: #DEE1E6; --graphite-100: #F3F4F6;
  --coral-300: #FF8068; --coral-500: #FF6B57; --coral-600: #F0472F; --coral-700: #C4341F;
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r-chip: 8px; --r-xs: 10px; --r-ctl: 12px; --r-s: 14px; --r-card: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1); --ease-in: cubic-bezier(.5, 0, .9, .4); --spring: cubic-bezier(.3, 1.5, .5, 1);
  --fast: 160ms; --base: 240ms;
  --bar-h: 72px;
  --accent: var(--coral-500); --accent-hover: var(--coral-300); --on-accent: var(--graphite-800); --focus: var(--coral-300);

  color-scheme: light;
  --bg: #F3F4F6; --bg-2: #FAFAFB;
  --surface: rgba(255, 255, 255, .82); --surface-solid: #FFFFFF; --surface-2: rgba(243, 244, 246, .8); --surface-3: #ECEEF1;
  --glass: rgba(255, 255, 255, .66);
  --border: rgba(17, 21, 27, .08); --border-strong: rgba(17, 21, 27, .15); --line-top: rgba(255, 255, 255, .9);
  --text: #12161C; --muted: #586271; --faint: #8A93A0;
  --accent-text: #C4341F; --accent-soft: rgba(255, 107, 87, .13); --accent-halo: rgba(255, 107, 87, .28);
  --ok: #1F9D63; --ok-soft: rgba(31, 157, 99, .12);
  --warn: #B7790F; --warn-soft: rgba(232, 160, 32, .16);
  --bad: #D92D48; --bad-soft: rgba(217, 45, 72, .1);
  --info: #2F6FD6; --info-soft: rgba(47, 111, 214, .1);
  --mute: #6B7684; --mute-soft: rgba(107, 118, 132, .12);
  --shadow-1: 0 1px 0 var(--line-top) inset, 0 18px 40px -22px rgba(30, 37, 46, .28), 0 1px 3px rgba(30, 37, 46, .08);
  --shadow-2: 0 1px 0 var(--line-top) inset, 0 36px 70px -28px rgba(30, 37, 46, .4), 0 6px 18px rgba(30, 37, 46, .1);
  --shadow-3: var(--shadow-2);
  --glow: rgba(255, 107, 87, .09);
  --scrim: rgba(30, 37, 46, .22);
  --amb-op: 1; --amb-image: url(../images/ambiance-claire.webp?v=ef66f4ea9e); --grain-op: .035; --grain-blend: multiply;
  --logo-light: block; --logo-dark: none;
}
/* Sombre : choisi dans le menu du compte, ou suivi de Windows. Le bloc est écrit deux fois (choix, système). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0D11; --bg-2: #10141A;
  --surface: rgba(21, 26, 33, .74); --surface-solid: #151A21; --surface-2: rgba(32, 39, 48, .7); --surface-3: #232A34;
  --glass: rgba(16, 20, 26, .62);
  --border: rgba(255, 255, 255, .075); --border-strong: rgba(255, 255, 255, .14); --line-top: rgba(255, 255, 255, .09);
  --text: #F3F4F6; --muted: #A0A9B6; --faint: #6E7988;
  --accent-text: #FF8A78; --accent-soft: rgba(255, 107, 87, .15); --accent-halo: rgba(255, 107, 87, .32);
  --ok: #3DD68C; --ok-soft: rgba(61, 214, 140, .14);
  --warn: #F5B544; --warn-soft: rgba(245, 181, 68, .15);
  --bad: #FF5C70; --bad-soft: rgba(255, 92, 112, .15);
  --info: #7AB2FF; --info-soft: rgba(122, 178, 255, .14);
  --mute: #8B95A3; --mute-soft: rgba(139, 149, 163, .14);
  --shadow-1: 0 1px 0 var(--line-top) inset, 0 24px 48px -24px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-2: 0 1px 0 var(--line-top) inset, 0 40px 80px -30px rgba(0, 0, 0, .8), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-3: var(--shadow-2);
  --glow: rgba(255, 128, 104, .13);
  --scrim: rgba(5, 7, 10, .5);
  --amb-op: .72; --amb-image: url(../images/ambiance-sombre.webp?v=1384f14682); --grain-op: .05; --grain-blend: overlay;
  --logo-light: none; --logo-dark: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A0D11; --bg-2: #10141A;
    --surface: rgba(21, 26, 33, .74); --surface-solid: #151A21; --surface-2: rgba(32, 39, 48, .7); --surface-3: #232A34;
    --glass: rgba(16, 20, 26, .62);
    --border: rgba(255, 255, 255, .075); --border-strong: rgba(255, 255, 255, .14); --line-top: rgba(255, 255, 255, .09);
    --text: #F3F4F6; --muted: #A0A9B6; --faint: #6E7988;
    --accent-text: #FF8A78; --accent-soft: rgba(255, 107, 87, .15); --accent-halo: rgba(255, 107, 87, .32);
    --ok: #3DD68C; --ok-soft: rgba(61, 214, 140, .14);
    --warn: #F5B544; --warn-soft: rgba(245, 181, 68, .15);
    --bad: #FF5C70; --bad-soft: rgba(255, 92, 112, .15);
    --info: #7AB2FF; --info-soft: rgba(122, 178, 255, .14);
    --mute: #8B95A3; --mute-soft: rgba(139, 149, 163, .14);
    --shadow-1: 0 1px 0 var(--line-top) inset, 0 24px 48px -24px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .25);
    --shadow-2: 0 1px 0 var(--line-top) inset, 0 40px 80px -30px rgba(0, 0, 0, .8), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-3: var(--shadow-2);
    --glow: rgba(255, 128, 104, .13);
    --scrim: rgba(5, 7, 10, .5);
    --amb-op: .72; --amb-image: url(../images/ambiance-sombre.webp?v=1384f14682); --grain-op: .05; --grain-blend: overlay;
    --logo-light: none; --logo-dark: block;
  }
}

/* ---------- Bases ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 400 14px/20px var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.ic { fill: currentColor; flex: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; color: var(--text); letter-spacing: -.02em; }
h1 { font-size: 28px; line-height: 34px; font-weight: 700; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; line-height: 18px; }
.mono, .serial, code { font-family: var(--font-mono); font-size: .92em; }
.serial { font-weight: 600; letter-spacing: .3px; }
.amount, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.eyebrow, .caption { font: 500 11px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
form.inline { display: inline-flex; margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
kbd { font: 500 11px/1 var(--font-mono); border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 6px;
  color: var(--muted); background: var(--surface-solid); white-space: nowrap; }

/* ---------- Ambiance : la lumière de fond ----------
   Une seule image (générée, 1280 px, 4 à 7 Ko) qui dérive très lentement et se déplace d'une section à l'autre.
   Le voile garde le texte lisible ; le grain évite les bandes de dégradé. */
.ambiance { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
.amb-lieu { position: absolute; inset: -16%; transition: transform 1.4s var(--ease);
  transform: translate3d(var(--amb-x, 0), var(--amb-y, 0), 0) scale(var(--amb-s, 1.04)); }
.amb-img { position: absolute; inset: 0; background: var(--amb-image) center / cover no-repeat; opacity: var(--amb-op);
  animation: derive 48s ease-in-out infinite alternate; will-change: transform; }
.amb-voile { position: absolute; inset: 0; background:
  radial-gradient(120% 90% at 0% 100%, var(--bg) 20%, transparent 70%),
  linear-gradient(180deg, transparent 0, transparent 45%, var(--bg) 100%); }
.amb-grain { position: absolute; inset: 0; background: url(../images/grain.png?v=7208545227); opacity: var(--grain-op); mix-blend-mode: var(--grain-blend); }
@keyframes derive { from { transform: translate3d(-2%, -1%, 0) scale(1.04) rotate(-1deg); } to { transform: translate3d(2%, 2%, 0) scale(1.1) rotate(1.5deg); } }
/* La lumière change de place selon la section (data-section sur <html>, posé par le serveur). */
[data-section="clients"] { --amb-x: -5%; --amb-y: 3%; --amb-s: 1.06; }
[data-section="ventes"] { --amb-x: -9%; --amb-y: -2%; --amb-s: 1.1; }
[data-section="caisses"] { --amb-x: 4%; --amb-y: 5%; --amb-s: 1.04; }
[data-section="argent"] { --amb-x: -10%; --amb-y: 6%; --amb-s: 1.12; }
[data-section="support"] { --amb-x: 6%; --amb-y: -4%; --amb-s: 1.06; }
[data-section="reglages"] { --amb-x: -7%; --amb-y: 8%; --amb-s: 1.04; }

/* ---------- Coquille : barre du haut, pastille des sections, outils ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.barre { position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center; gap: 16px; padding: 0 28px; view-transition-name: barre; }
.barre::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 60%, transparent); }
.defile .barre::before { opacity: 1; }
.marque { display: flex; align-items: center; gap: 10px; justify-self: start; position: relative; text-decoration: none; }
.marque img { height: 26px; width: auto; }
.marque .lg-light { display: var(--logo-light); } .marque .lg-dark { display: var(--logo-dark); }

.dock { position: relative; display: flex; gap: 2px; padding: 5px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); }
.dock a { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 999px;
  font: 600 13.5px/20px var(--font-body); color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .25s; }
.dock a:hover { color: var(--text); }
.dock a.on { color: var(--on-accent); }
.dock .ic { width: 18px; height: 18px; }
/* Le témoin corail est dans le lien actif : d'une page à l'autre, il glisse (view-transition-name « temoin »). */
.dock-temoin { position: absolute; z-index: -1; inset: 0; border-radius: 999px; pointer-events: none;
  background: linear-gradient(180deg, var(--coral-300), var(--coral-500));
  box-shadow: 0 6px 20px -6px var(--accent-halo), 0 1px 0 rgba(255, 255, 255, .35) inset; }
.dock .dock-temoin { view-transition-name: temoin; }
.count { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font: 600 10.5px/18px var(--font-mono); text-align: center; }
.dock a.on .count, .dockm a.on .count { background: var(--on-accent); color: var(--coral-300); }

.outils { justify-self: end; display: flex; align-items: center; gap: 8px; }
.rond { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; border: 1px solid var(--border-strong);
  background: var(--glass); color: var(--text); cursor: pointer; position: relative; padding: 0; text-decoration: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform .2s var(--ease), border-color .2s; }
.rond:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--coral-500) 50%, var(--border-strong)); }
.rond .ic { width: 19px; height: 19px; }
/* Point des notifications : le nombre de choses à traiter, une onde lente autour. */
.rond .count { position: absolute; top: -5px; right: -5px; min-width: 18px; box-shadow: 0 0 0 2px var(--bg); }
.rond .count::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--accent); z-index: -1; animation: onde 2.4s var(--ease) infinite; }
.recherche { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 13px; border-radius: 13px; border: 1px solid var(--border-strong);
  background: var(--glass); color: var(--faint); cursor: pointer; min-width: 190px; font: 500 13.5px var(--font-body);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: border-color .2s; }
.recherche:hover { border-color: color-mix(in srgb, var(--coral-500) 50%, var(--border-strong)); color: var(--muted); }
.recherche kbd { margin-left: auto; background: transparent; }
.avatar-moi { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font: 700 13px var(--font-display); cursor: pointer;
  background: linear-gradient(135deg, #2A323D, #12161C); color: #F3F4F6; box-shadow: 0 0 0 1px var(--border-strong), 0 8px 18px -8px rgba(0, 0, 0, .6); }
.tel-seul { display: none !important; }

.page { width: min(1240px, 100% - 56px); margin: 0 auto; padding: 8px 0 96px; flex: 1 0 auto; view-transition-name: page; }

/* ---------- Fenêtres moyennes : la recherche se replie, puis la pastille ne garde que les icônes ---------- */
@media (max-width: 1240px) {
  .recherche { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .recherche span, .recherche kbd { display: none; }
}
@media (max-width: 1140px) and (min-width: 761px) {
  .barre { padding: 0 18px; gap: 10px; }
  .dock a { padding: 0 12px; gap: 0; }
  .dock a > .lb { display: none; }
  .dock a.on { gap: 7px; } .dock a.on > .lb { display: inline; }
  .dock a .count { position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; font-size: 9px; line-height: 15px; padding: 0 3px; }
  .dock a.on .count { position: static; }
  .page { width: calc(100% - 36px); }
}

/* ---------- Téléphone : pastille en bas, avec son témoin ---------- */
.dockm { display: none; }
@media (max-width: 760px) {
  :root { --bar-h: 60px; }
  .barre { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 16px; gap: 10px; }
  .barre .dock, .barre .recherche, .barre .creer, .barre .notif { display: none; }
  .tel-seul { display: grid !important; }
  .marque img { height: 22px; }
  .page { width: calc(100% - 32px); padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
  .dockm { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: grid;
    grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 6px; border-radius: 24px; background: var(--glass);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-2); view-transition-name: dockm;
    backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); }
  .dockm a { position: relative; z-index: 1; display: grid; justify-items: center; gap: 3px; padding: 8px 0 6px; min-width: 0;
    font: 600 10.5px/14px var(--font-body); color: var(--muted); text-decoration: none; text-align: center; }
  .dockm a .lb { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .dockm a .ic { width: 21px; height: 21px; }
  .dockm a.on { color: var(--on-accent); }
  .dockm .count { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 16px; height: 16px; font-size: 9.5px; line-height: 16px; padding: 0 4px; }
  .dockm .dock-temoin { border-radius: 18px; view-transition-name: temoinm; }
}

/* ---------- Pages publiques (sans compte) : choix de langue ---------- */
.public-langs { position: fixed; top: 14px; right: 16px; z-index: 5; display: flex; gap: 2px; background: var(--glass); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 4px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.public-langs a { padding: 3px 9px; font: 600 12px/18px var(--font-mono); letter-spacing: .04em; color: var(--muted); text-decoration: none; border-radius: 8px; }
.public-langs a.on { background: var(--accent); color: var(--on-accent); }

@media print {
  .barre, .dockm, .ambiance, .no-print { display: none !important; }
  .page { width: 100%; padding: 0; }
  body { background: #fff; }
}
