/* Les jetons de CETTE instance — chargés après la feuille du core
   (/static/core/style.css), donc prioritaires — et l'habillage de
   l'application.

   Le core ne pose AUCUNE couleur : sa structure lit ces jetons, et core.js
   lit --text --muted --border --panel --panel2 --bg --accent --good --warn
   --bad --serie-1…8 pour les graphiques. C'est le SEUL fichier du front où
   une couleur s'écrit en dur (le harnais avertit ailleurs).

   La charte (refonte du 10/10/2026, demandée par le dirigeant : « une
   application moderne ») : une barre latérale à icônes, la police Inter et
   ses chiffres tabulaires, des surfaces neutres — fond gris très clair,
   cartes blanches à filet fin, ombre à peine posée, rayon 12 px — et le
   vert Piatto en accent (vert profond en clair, vert menthe en sombre). Le
   logo du site du restaurant (web/marque/) signe la barre et la connexion.

   Les états (bon, alerte, mauvais) et les séries gardent leur sens : les
   séries restent distinctes deux à deux, y compris pour un œil qui confond
   le rouge et le vert, et lisibles à 3:1 au moins sur le panneau. Contrastes
   mesurés sur le panneau : encre 17:1 (clair) et 15:1 (sombre), gris 4,8:1
   et 5,8:1, états 4,8:1 au moins.

   L'habillage passe par des classes stables du core (la barre #tabs, la
   carte, l'intertitre, le tableau) : une montée de version du core qui les
   renommerait se voit ici d'abord. */

:root {
  color-scheme: light;
  --police: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --police-titre: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  --police-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --num-poids: 600;
  --radius: 10px;
  --rail: 248px;

  --bg: #f6f7f5;
  --rail-fond: #ffffff;
  --panel: #ffffff;
  --panel2: #f3f4f2;
  --border: #e4e7e3;
  --text: #161b18;
  --texte-2: #3d4541;
  --muted: #6b7470;
  --accent: #1f3824;
  --accent-encre: #ffffff;

  --good: #12784a;
  --warn: #b45309;
  --bad: #d92d20;
  --perime: var(--warn);

  /* Les teintes, pour les cartes locales (web/cartes/) et l'habillage. */
  --accent-fond: #ecf3ee;
  --good-fond: #e9f6ef;
  --warn-fond: #fdf4e7;
  --warn-vif: #d97706;
  --separateur: #eef0ed;
  --segment-actif: #ffffff;
  --segment-ombre: 0 1px 2px rgba(16, 24, 20, 0.08), 0 0 0 1px rgba(16, 24, 20, 0.05);
  --ombre-carte: 0 1px 2px rgba(16, 24, 20, 0.04), 0 1px 3px rgba(16, 24, 20, 0.03);
  --ombre-flottante: 0 4px 8px -4px rgba(16, 24, 20, 0.08), 0 16px 36px -10px rgba(16, 24, 20, 0.18);
  --ombre: var(--ombre-carte);

  /* Facultatifs du core (repli sur --serie-* et --warn sinon). */
  --bleu: #2563eb;
  --bleu-clair: #60a5fa;
  --corail: #ea580c;
  --violet: #7c3aed;
  --orange: #d97706;

  /* Séries — l'ordre est fixe : une série garde sa couleur quand une autre
     disparaît. */
  --serie-1: #2563eb;
  --serie-2: #ea580c;
  --serie-3: #059669;
  --serie-4: #7c3aed;
  --serie-5: #db2777;
  --serie-6: #b88003;
  --serie-7: #0891b2;
  --serie-8: #65a30d;
}

/* Le sombre : celui du système, sauf choix contraire (le menu du compte pose
   <html data-theme="light|dark"> ; web/app.js, et le <head> dès le chargement). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d100f;
    --rail-fond: #0a0c0b;
    --panel: #141817;
    --panel2: #1b201e;
    --border: #252b28;
    --text: #eceeed;
    --texte-2: #c3c9c6;
    --muted: #8b9490;
    --accent: #6cc59a;
    --accent-encre: #08130d;

    --good: #3fcf8e;
    --warn: #f5b041;
    --bad: #f87171;

    --accent-fond: #15241c;
    --good-fond: #10291d;
    --warn-fond: #2c2210;
    --warn-vif: #f59e0b;
    --separateur: #1e2421;
    --segment-actif: #2a302d;
    --segment-ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --ombre-carte: none;
    --ombre-flottante: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 44px -10px rgba(0, 0, 0, 0.7);

    --bleu: #60a5fa;
    --bleu-clair: #93c5fd;
    --corail: #fb923c;
    --violet: #a78bfa;
    --orange: #f59e0b;

    --serie-1: #60a5fa;
    --serie-2: #fb923c;
    --serie-3: #34d399;
    --serie-4: #a78bfa;
    --serie-5: #f472b6;
    --serie-6: #eab308;
    --serie-7: #22d3ee;
    --serie-8: #a3e635;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d100f;
  --rail-fond: #0a0c0b;
  --panel: #141817;
  --panel2: #1b201e;
  --border: #252b28;
  --text: #eceeed;
  --texte-2: #c3c9c6;
  --muted: #8b9490;
  --accent: #6cc59a;
  --accent-encre: #08130d;

  --good: #3fcf8e;
  --warn: #f5b041;
  --bad: #f87171;

  --accent-fond: #15241c;
  --good-fond: #10291d;
  --warn-fond: #2c2210;
  --warn-vif: #f59e0b;
  --separateur: #1e2421;
  --segment-actif: #2a302d;
  --segment-ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --ombre-carte: none;
  --ombre-flottante: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 44px -10px rgba(0, 0, 0, 0.7);

  --bleu: #60a5fa;
  --bleu-clair: #93c5fd;
  --corail: #fb923c;
  --violet: #a78bfa;
  --orange: #f59e0b;

  --serie-1: #60a5fa;
  --serie-2: #fb923c;
  --serie-3: #34d399;
  --serie-4: #a78bfa;
  --serie-5: #f472b6;
  --serie-6: #eab308;
  --serie-7: #22d3ee;
  --serie-8: #a3e635;
}
:root[data-theme="light"] { color-scheme: light; }

/* ── La page ─────────────────────────────────────────────────────────────── */
body { font-size: 14px; font-feature-settings: "cv11", "ss01"; letter-spacing: -0.006em;
  -moz-osx-font-smoothing: grayscale; }
h1, h2, h3 { letter-spacing: -0.015em; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
button { border-radius: 8px; font-weight: 600; transition: background-color .15s, border-color .15s, color .15s; }
button.ghost { border-radius: 8px; }

/* ── La barre latérale (écran large) ────────────────────────────────────────
   La barre du core devient un rail fixe à gauche : la marque en haut, les
   onglets en liste à icônes (une porte qui regroupe montre ses onglets
   en retrait, toujours dépliés), la fraîcheur et le compte en bas. */
#tabs .cockpit-marque { margin: 0; }
.brand { gap: 10px; }
.brand .logo { display: block; height: 34px; width: auto; flex: none; }
.cockpit-marque h1 { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none;
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; }
.cockpit-marque .brand > div::after { content: "Cockpit de pilotage"; display: block; font-size: 11.5px;
  font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 1px; }

#tabs a[data-tab="redressement"]::before, #tabs a[data-tab="resultat"]::before, #tabs a[data-tab="equipe"]::before,
#tabs a[data-tab="matieres"]::before, #tabs a[data-tab="tresorerie"]::before, #tabs .porte-btn::before {
  content: ""; width: 17px; height: 17px; flex: none; background: currentColor; opacity: .9;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
#tabs .porte-menu a::before { display: none; }
#tabs a[data-tab="redressement"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 7 13.5 15.5 8.5 10.5 2 17'/%3E%3Cpolyline points='16 7 22 7 22 13'/%3E%3C/svg%3E"); }
#tabs a[data-tab="resultat"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v16a2 2 0 0 0 2 2h16'/%3E%3Cpath d='M18 17V9'/%3E%3Cpath d='M13 17V5'/%3E%3Cpath d='M8 17v-3'/%3E%3C/svg%3E"); }
#tabs .porte-btn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2'/%3E%3Cpath d='M7 2v20'/%3E%3Cpath d='M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E"); }
#tabs a[data-tab="equipe"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
#tabs a[data-tab="matieres"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7.5 4.27 9 5.15'/%3E%3Cpath d='M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z'/%3E%3Cpath d='m3.3 7 8.7 5 8.7-5'/%3E%3Cpath d='M12 22V12'/%3E%3C/svg%3E"); }
#tabs a[data-tab="tresorerie"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1'/%3E%3Cpath d='M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4'/%3E%3C/svg%3E"); }

@media (min-width: 1024px) and (min-height: 600px) {
  body.barre-cockpit { padding-left: var(--rail); }
  #tabs {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: var(--rail);
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 2px;
    padding: 18px 12px 14px; overflow: visible;
    background: var(--rail-fond); border-bottom: 0; border-right: 1px solid var(--border);
  }
  #tabs .cockpit-marque { padding: 2px 8px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--separateur); }
  #tabs > a, #tabs .porte-btn {
    display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500; line-height: 1.2; color: var(--texte-2); text-align: left;
    white-space: normal; transition: background-color .12s, color .12s; }
  #tabs > a:hover { background: var(--panel2); color: var(--text); }
  #tabs > a.active { background: var(--accent-fond); color: var(--text); font-weight: 600; }
  #tabs > a.active::before { color: var(--accent); opacity: 1; }
  #tabs > a.active::after, #tabs .porte.active > .porte-btn::after { display: none; }
  /* La porte : son libellé en tête, ses onglets dessous, en retrait sur un filet. */
  #tabs .porte { display: block; }
  #tabs .porte-btn { pointer-events: none; cursor: default; background: transparent; }
  #tabs .porte.active > .porte-btn { color: var(--text); font-weight: 600; }
  #tabs .porte.active > .porte-btn::before { color: var(--accent); opacity: 1; }
  #tabs .porte-chev, #tabs .porte-q { display: none; }
  #tabs .porte-menu, #tabs .porte.pop-ouvert > .porte-menu {
    display: flex; flex-direction: column; gap: 2px; position: static; min-width: 0; z-index: auto;
    margin: 2px 0 4px 18px; padding: 0 0 0 10px; border: 0; border-left: 1px solid var(--border);
    border-radius: 0; background: transparent; box-shadow: none; }
  #tabs .porte-menu a { padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--muted); }
  #tabs .porte-menu a:hover { background: var(--panel2); color: var(--text); }
  #tabs .porte-menu a.active { background: var(--accent-fond); color: var(--text); font-weight: 600; }
  /* En bas : la fraîcheur sur toute la largeur, puis la version et les icônes. */
  #tabs .cockpit-actions { margin: auto 0 0; padding: 14px 4px 0; border-top: 1px solid var(--separateur);
    flex-wrap: wrap; gap: 8px; }
  #tabs .cockpit-actions .pilule-fraicheur { flex: 1 1 100%; justify-content: flex-start; }
  #tabs .cockpit-actions .pilule-licence { margin-right: auto; }
  #tabs .cockpit-actions .bulle { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
  #tabs .menu-compte { top: auto; bottom: 0; left: calc(100% + 12px); right: auto; }
}

/* ── La barre du haut (écran étroit) : la marque et le compte, puis les
   onglets en pastilles qui passent à la ligne — aucun menu déroulant. */
@media (max-width: 1023px), (max-height: 599px) {
  #tabs { position: sticky; top: 0; z-index: 40; gap: 6px; padding: 10px 14px 12px;
    background: color-mix(in srgb, var(--rail-fond) 92%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border); }
  #tabs .cockpit-marque { order: -2; margin-right: 8px; padding: 0; }
  #tabs .cockpit-actions { order: -1; padding: 0; flex-wrap: nowrap; gap: 6px; }
  #tabs .cockpit-actions .pilule-licence { display: none; }
  #tabs::after { content: ""; order: -1; flex-basis: 100%; height: 4px; }
  #tabs .porte, #tabs .porte-menu, #tabs .porte.pop-ouvert > .porte-menu { display: contents; }
  #tabs .porte-btn, #tabs .porte-q { display: none; }
  #tabs > a, #tabs .porte-menu a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px;
    border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--texte-2); background: var(--panel2);
    white-space: nowrap; }
  #tabs a[data-tab]::before { width: 15px; height: 15px; }
  #tabs > a.active, #tabs .porte-menu a.active { background: var(--accent); color: var(--accent-encre); font-weight: 600; }
  #tabs > a.active::after { display: none; }
  .brand .logo { height: 30px; }
  .cockpit-marque .brand > div::after { display: none; }
}

/* ── L'en-tête de page (web/app.js) : le nom de l'onglet et sa question ──── */
.pz-page { max-width: 1500px; margin: 0 auto; padding: 30px 26px 0; }
.pz-page[hidden] { display: none; }
.pz-page-titre { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; color: var(--text); }
.pz-page-question { margin-top: 4px; font-size: 14px; color: var(--muted); }
.pz-page-question:empty { display: none; }
.pz-page + main { padding-top: 20px; }
@media (max-width: 1023px) { .pz-page { padding: 20px 16px 0; } .pz-page-titre { font-size: 20px; } }

/* ── Le plateau, les intertitres, la note d'onglet ──────────────────────── */
main { padding: 24px 26px 48px; gap: 18px; }
@media (max-width: 1023px) { main { padding: 16px 16px 40px; gap: 14px; } }
.section-head, .surtitre, .a-regarder h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.015em;
  text-transform: none; color: var(--text); margin: 30px 0 2px; }
.section-head:first-child { margin-top: 2px; }
.tab-note { position: relative; padding: 14px 18px 14px 46px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  color: var(--texte-2); background: var(--accent-fond); border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-left-width: 1px; }
.tab-note::before { content: ""; position: absolute; left: 16px; top: 15px; width: 18px; height: 18px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.tab-note strong { color: var(--text); }

/* Les sous-onglets et les vues d'une carte : un segment, la sélection en relief. */
.subtab-nav, .rm-vues { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; border: 0;
  background: var(--panel2); }
.rm-vues { margin-bottom: 14px; }
.subtab, .rm-vue { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 8px;
  font-size: 13px; font-weight: 500; line-height: 1; }
.subtab:hover, .rm-vue:hover { color: var(--text); }
.subtab.active, .rm-vue.active { background: var(--segment-actif); color: var(--text); font-weight: 600;
  box-shadow: var(--segment-ombre); border: 0; }

/* ── La carte ────────────────────────────────────────────────────────────── */
.card { border-radius: 12px; padding: 18px 20px; box-shadow: var(--ombre-carte); min-width: 0; }
.ck-tete { margin-bottom: 12px; flex-wrap: nowrap; }
.ck-tete .ck-label { flex: 1 1 auto; min-width: 0; }
.ck-label { font-size: 13px; font-weight: 600; color: var(--texte-2); letter-spacing: -0.005em; }
.ck-menu-btn { width: 26px; height: 26px; border-radius: 7px; }
.ck-menu, .menu-compte, .nav-portes .porte-menu { border-radius: 12px; box-shadow: var(--ombre-flottante); }
.big { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; }
.big .unit { font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.subtitle { font-size: 12px; line-height: 1.5; }
.card .desc { font-size: 12.5px; }
.delta { border-color: transparent; background: var(--panel2); font-weight: 600; padding: 2px 8px; }
.delta.good { background: var(--good-fond); border-color: transparent; }
.delta.bad { background: color-mix(in srgb, var(--bad) 11%, transparent); border-color: transparent; }

/* ── Les tableaux ────────────────────────────────────────────────────────── */
th { font-size: 12px; font-weight: 500; color: var(--muted); padding: 9px 12px; }
td { padding: 9px 12px; }
tbody tr:not(.grp):hover > td { background: color-mix(in srgb, var(--panel2) 80%, transparent); }

/* ── La barre : pilules et boutons ronds ─────────────────────────────────── */
.pilule-fraicheur, .pilule-licence { border-radius: 8px; background: var(--panel2); border-color: transparent; padding: 6px 10px; }
.btn-icone { border-radius: 8px; width: 32px; height: 32px; background: var(--panel2); border-color: transparent; color: var(--texte-2); }
.btn-compte { width: 32px; height: 32px; background: var(--panel2); border-color: transparent; color: var(--texte-2); }
.btn-icone:hover, .btn-compte:hover { background: var(--border); border-color: transparent; color: var(--text); }
.bulle { border-radius: 8px; }

/* ── La connexion : le logo du restaurant au-dessus du formulaire ────────── */
#connexion { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-fond), var(--bg) 70%); }
#connexion form { width: min(380px, calc(100vw - 32px)); padding: 30px 28px 26px; border-radius: 16px; gap: 12px; }
#connexion form::before { content: ""; display: block; height: 64px; margin: 0 0 6px;
  background: url("/static/marque/piatto-logo.png") center / contain no-repeat; }
#connexion h1 { text-align: center; font-size: 19px; font-weight: 700; }
#connexion p { text-align: center; }
#connexion input { border-radius: 8px; padding: 10px 12px; background: var(--panel); }
#connexion input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
#connexion button { padding: 11px 12px; border-radius: 8px; }

/* ── L'apparence, dans le menu du compte (web/app.js) ───────────────────── */
.pz-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px 8px; }
.pz-theme-lab { font-size: 13px; color: var(--text); }
.pz-theme-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--panel2); }
.pz-theme-seg button { border: 0; background: transparent; color: var(--muted); padding: 5px 9px; border-radius: 7px;
  font-size: 12px; font-weight: 500; line-height: 1; }
.pz-theme-seg button:hover { color: var(--text); filter: none; }
.pz-theme-seg button.active { background: var(--segment-actif); color: var(--text); font-weight: 600;
  box-shadow: var(--segment-ombre); }
