/* =====================================================================
   CantineTrack — système visuel
   Couleurs tirées du logo : bleu assiette -> vert feuille, encre bleu nuit.
   Élément signature : le « ticket certifié » (bord perforé) pour les chiffres clés.
   ===================================================================== */
@import url('/css/fonts.css');

:root {
  --ink: #0f1f38;
  --ink-2: #3a4a63;
  --ink-3: #5a6a80;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --paper: #ffffff;       /* fond d'une image imprimée (logo), blanc dans les deux thèmes */
  --blue: #0b63ce;
  --blue-2: #0951a8;
  --blue-soft: #e8f1fd;
  --green: #1f9a3e;
  --green-ink: #157a31;
  --green-soft: #e6f6ea;
  --vanilla: #e09b17;
  --vanilla-ink: #8a5a00;
  --vanilla-soft: #fff6e2;
  --chili: #e0453a;
  --chili-ink: #b42318;
  --chili-soft: #fdecea;
  --night: #0b1f3a;
  --night-2: #0d2a4d;
  --on-accent: #ffffff;
  --green-strong: #157a31;
  --green-strong-2: #0f6327;
  --alert-strong: #c8312a;
  --line-strong: #a3b1c2;
  --brand-grad: linear-gradient(100deg, #0b63ce 0%, #1f8fc4 48%, #22a04b 100%);
  /* Pastilles des indicateurs (fond, trait) */
  --t-blue-bg: #e8f0fe; --t-blue: #2563eb;
  --t-green-bg: #e5f6ea; --t-green: #16a34a;
  --t-purple-bg: #f1ebff; --t-purple: #7c3aed;
  --t-orange-bg: #fff0e1; --t-orange: #ea7a12;
  --t-teal-bg: #e1f5f8; --t-teal: #0e98b2;
  --t-red-bg: #fde8ec; --t-red: #e11d48;
  --t-amber-bg: #fff4d6; --t-amber: #c98a00;
  --r-sm: 10px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(15, 31, 56, .04), 0 6px 22px rgba(15, 31, 56, .06);
  --font: 'Lexend', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --side: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eef6; --ink-2: #bcc8d8; --ink-3: #8f9db1; --line: #24344b; --line-2: #1a2839;
    --bg: #0b1626; --surface: #121f33; --blue: #5b9be6; --blue-2: #7fb1ef; --blue-soft: #16304f;
    --green: #5cc36a; --green-ink: #7fd78b; --green-soft: #143524; --vanilla: #eab54a; --vanilla-ink: #f1c76f; --vanilla-soft: #33280f;
    --chili: #ef6b61; --chili-ink: #f59088; --chili-soft: #3a1b1a; --shadow: 0 1px 2px rgba(0,0,0,.35); color-scheme: dark;
    --night: #08121f; --night-2: #0b1a2e; --on-accent: #0b1626; --green-strong: #5cc36a; --green-strong-2: #7fd78b; --alert-strong: #c8312a; --line-strong: #5d6d84;
    --t-blue-bg: #17305a; --t-blue: #8db8ff; --t-green-bg: #133a24; --t-green: #6fd88a; --t-purple-bg: #2c2152; --t-purple: #b99cff;
    --t-orange-bg: #3d2812; --t-orange: #ffad5c; --t-teal-bg: #0f3640; --t-teal: #5fd3e8; --t-red-bg: #3d1622; --t-red: #ff8aa3;
    --t-amber-bg: #3a2f0d; --t-amber: #f2c94c;
  }
}
:root[data-theme="dark"] {
    --ink: #e8eef6; --ink-2: #bcc8d8; --ink-3: #8f9db1; --line: #24344b; --line-2: #1a2839;
    --bg: #0b1626; --surface: #121f33; --blue: #5b9be6; --blue-2: #7fb1ef; --blue-soft: #16304f;
    --green: #5cc36a; --green-ink: #7fd78b; --green-soft: #143524; --vanilla: #eab54a; --vanilla-ink: #f1c76f; --vanilla-soft: #33280f;
    --chili: #ef6b61; --chili-ink: #f59088; --chili-soft: #3a1b1a; --shadow: 0 1px 2px rgba(0,0,0,.35); color-scheme: dark;
    --night: #08121f; --night-2: #0b1a2e; --on-accent: #0b1626; --green-strong: #5cc36a; --green-strong-2: #7fd78b; --alert-strong: #c8312a; --line-strong: #5d6d84;
    --t-blue-bg: #17305a; --t-blue: #8db8ff; --t-green-bg: #133a24; --t-green: #6fd88a; --t-purple-bg: #2c2152; --t-purple: #b99cff;
    --t-orange-bg: #3d2812; --t-orange: #ffad5c; --t-teal-bg: #0f3640; --t-teal: #5fd3e8; --t-red-bg: #3d1622; --t-red: #ff8aa3;
    --t-amber-bg: #3a2f0d; --t-amber: #f2c94c;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); font-feature-settings: 'tnum' 1; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Boutons & champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--blue); color: var(--on-accent); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--blue-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost):not(.danger):hover { background: #8ab9f0; } }
:root[data-theme="dark"] .btn:not(.ghost):not(.danger):hover { background: #8ab9f0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--line-2); }
.btn.green { background: var(--green-strong); color: var(--on-accent); }
.btn.green:hover { background: var(--green-strong-2); }
.btn.danger { background: transparent; color: var(--chili-ink); border-color: color-mix(in srgb, var(--chili) 40%, transparent); }
.btn.danger:hover { background: var(--chili-soft); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: .86rem; }
.btn.link { background: none; border: 0; color: var(--blue); padding: 0; min-height: 0; }
.btn svg { width: 17px; height: 17px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .86rem; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
label.field > small { display: block; color: var(--ink-3); font-size: .8rem; margin-top: 4px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 45%, transparent); }
input[readonly] { background: var(--line-2); border-style: dashed; color: var(--ink-2); }
[aria-invalid="true"] { border-color: var(--chili) !important; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: .92rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- Écrans d'accès (connexion / inscription) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-side { background: var(--night); color: #e8eef6; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .logo-chip { background: #fff; border-radius: 14px; padding: 10px 14px; display: inline-block; width: max-content; }
.auth-side .logo-chip img { height: 64px; display: block; }
.auth-side h1 { font-size: clamp(1.8rem, 3.2vw, 2.7rem); font-weight: 600; max-width: 14ch; margin: 40px 0 18px; color: #fff; }
.auth-side p { color: #b9c6d8; max-width: 42ch; }
.auth-tickets { display: grid; gap: 10px; margin-top: 28px; max-width: 420px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h2 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-3); margin-bottom: 24px; }
.auth-foot { margin-top: 18px; font-size: .9rem; color: var(--ink-3); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.seg button { padding: 14px 12px; border-radius: var(--r); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.seg button strong { display: block; font-weight: 600; }
.seg button span { font-size: .82rem; color: var(--ink-3); }
.seg button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 22px; }
  .auth-side h1 { margin: 22px 0 10px; font-size: 1.6rem; }
  .auth-tickets { display: none; }
}

/* ---------- Ticket certifié (signature) ---------- */
.ticket { --notch: 9px; position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px;
  padding: 14px 18px 14px 22px; background: var(--surface); color: var(--ink); border-radius: var(--r);
  -webkit-mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat; }
.ticket::after { content: ''; position: absolute; top: 12px; bottom: 12px; right: 92px; border-left: 2px dashed var(--line); }
.ticket .t-label { font-size: .82rem; color: var(--ink-3); }
.ticket .t-value { font-size: 1.05rem; font-weight: 600; }
.ticket .t-stamp { grid-row: span 2; width: 62px; text-align: center; font-size: .72rem; font-weight: 600; color: var(--green-ink); line-height: 1.15; }
.ticket .t-stamp svg { width: 26px; height: 26px; display: block; margin: 0 auto 3px; }
.auth-side .ticket { background: #1b3050; color: #fff; }
.auth-side .ticket .t-label { color: #9fb1c9; }
.auth-side .ticket::after { border-color: #2e4668; }
.auth-side .ticket .t-stamp { color: #7fd78b; }

/* ---------- Structure de l'application ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--night); color: #c9d4e3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; }
.side .brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 3px; }
.side .brand b { color: #fff; font-weight: 600; font-size: 1.02rem; display: block; line-height: 1.15; }
.side .brand small { color: #8fa1ba; font-size: .74rem; }
.side .org { margin: 0 12px 10px; padding: 10px 12px; border-radius: var(--r); background: rgba(255,255,255,.06); font-size: .85rem; }
.side .org b { color: #fff; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .org span { color: #8fa1ba; font-size: .78rem; }
.side nav { padding: 6px 10px; flex: 1; }
.side nav .grp { font-size: .74rem; color: #8a9cb5; margin: 14px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #c9d4e3; font-size: .93rem; text-decoration: none; }
.side nav a svg { width: 19px; height: 19px; opacity: .85; flex: none; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a[aria-current="page"] { background: rgba(91,155,230,.18); color: #fff; box-shadow: inset 3px 0 0 #5cc36a; }
.side nav a .count { margin-left: auto; background: var(--alert-strong); color: #fff; font-size: .72rem; border-radius: 10px; padding: 1px 7px; }
.side .side-foot { padding: 12px 18px 18px; font-size: .78rem; color: #8a9cb5; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .burger { display: none; }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--alert-strong); color: #fff; font-size: .66rem; display: grid; place-items: center; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .82rem; }
.userchip .who { text-align: left; line-height: 1.15; font-size: .85rem; }
.userchip .who small { color: var(--ink-3); font-size: .74rem; display: block; }
.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); max-width: 70ch; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  .side.open { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 0 0 0 100vmax rgba(10, 19, 34, .45); }
  .topbar { padding: 10px 16px; }
  .topbar .burger { display: grid; }
  .content { padding: 18px 16px 70px; }
  .userchip .who { display: none; }
}

/* ---------- Panneaux, indicateurs, tableaux ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; color: var(--ink-3); font-size: .86rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.cols > .panel { margin-bottom: 0; }
.cols-eq { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.cols-eq > .panel { margin-bottom: 0; min-width: 0; }
.cols > * { min-width: 0; }
.list-item .grow .t { overflow-wrap: anywhere; }
.list-item .grow .t .num { white-space: normal; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 16px 20px; border-right: 1px solid var(--line-2); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kpi .l { font-size: .84rem; color: var(--ink-3); }
.kpi .d { font-size: .8rem; margin-top: 3px; color: var(--ink-3); }
.kpi.good .v { color: var(--green-ink); }
.kpi.bad .v { color: var(--chili-ink); }
.kpi.warn .v { color: var(--vanilla-ink); }

/* Écart forfait / réel : le ticket en grand */
.gapcard { display: grid; grid-template-columns: minmax(0, 1fr) 230px; background: var(--night); color: #fff; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; position: relative; }
:root[data-theme="dark"] .gapcard { border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gapcard { border: 1px solid var(--line); } }
.gapcard .g-main { padding: 22px 26px; }
.gapcard .g-main h2 { font-size: 1.05rem; color: #c9d4e3; font-weight: 500; }
.gapcard .g-amount { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 600; letter-spacing: -.03em; margin: 6px 0 2px; }
.gapcard .g-amount small { font-size: .45em; font-weight: 400; color: #9fb1c9; margin-left: 6px; letter-spacing: 0; }
.gapcard .g-sub { color: #9fb1c9; font-size: .9rem; }
.gapcard .g-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.12); margin-top: 16px; overflow: hidden; display: flex; }
.gapcard .g-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3fa34d, #5cc36a); }
.gapcard .g-bar b { display: block; height: 100%; background: repeating-linear-gradient(45deg, #d2453b 0 6px, #e0665d 6px 12px); }
.gapcard .g-legend { display: flex; gap: 18px; font-size: .8rem; color: #9fb1c9; margin-top: 8px; flex-wrap: wrap; }
.gapcard .g-legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; background: #5cc36a; }
.gapcard .g-legend span.ghost::before { background: #d2453b; }
.gapcard .g-stub { border-left: 2px dashed rgba(255,255,255,.18); padding: 22px; display: flex; flex-direction: column; justify-content: center; gap: 4px; position: relative; }
.gapcard .g-stub::before, .gapcard .g-stub::after { content: ''; position: absolute; left: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); }
.gapcard .g-stub::before { top: -10px; } .gapcard .g-stub::after { bottom: -10px; }
.gapcard .g-stub .n { font-size: 1.9rem; font-weight: 600; }
.gapcard .g-stub .t { font-size: .82rem; color: #9fb1c9; }
@media (max-width: 720px) { .gapcard { grid-template-columns: 1fr; } .gapcard .g-stub { border-left: 0; border-top: 2px dashed rgba(255,255,255,.18); } .gapcard .g-stub::before, .gapcard .g-stub::after { display: none; } }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .8rem; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--line-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--blue-soft); }
.tbl .r { text-align: right; }
.tbl td.actions { text-align: right; white-space: nowrap; }
@media (max-width: 720px) {
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tbl.stack td { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); column-gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .tbl.stack td > * { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
  .tbl.stack td::before { grid-column: 1; grid-row: 1 / span 9; }
  .tbl.stack td::before { content: attr(data-l); color: var(--ink-3); font-size: .8rem; text-align: left; }
  .tbl.stack td.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .tbl.stack td.actions::before { content: none; }
}
.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: .78rem; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--green-soft); color: var(--green-ink); }
.badge.bad { background: var(--chili-soft); color: var(--chili-ink); }
.badge.warn { background: var(--vanilla-soft); color: var(--vanilla-ink); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.plain::before { display: none; }
.verified { display: inline-flex; align-items: center; gap: 4px; color: var(--green-ink); font-size: .8rem; font-weight: 500; }
.verified svg { width: 15px; height: 15px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters label.field { margin: 0; min-width: 150px; flex: 0 1 200px; }
.filters .grow { flex: 1 1 240px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2.5px solid transparent; padding: 10px 14px; font: inherit; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--blue); font-weight: 500; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: .92rem;
  background: var(--blue-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.banner.warn { background: var(--vanilla-soft); border-color: color-mix(in srgb, var(--vanilla) 40%, transparent); }
.banner.bad { background: var(--chili-soft); border-color: color-mix(in srgb, var(--chili) 35%, transparent); }
.banner.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner .grow { flex: 1; }

.list { display: grid; gap: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 500; }
.list-item .s { font-size: .84rem; color: var(--ink-3); }
.sev { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--blue); }
.sev.critical { background: var(--chili); box-shadow: 0 0 0 4px var(--chili-soft); }
.sev.warning { background: var(--vanilla); }

/* ---------- Graphiques SVG ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.chart .bar { fill: var(--blue); }
.chart .bar.alt { fill: var(--chili); opacity: .85; }
.chart .bar:hover { fill: var(--green); }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--ink-3); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.meter { height: 8px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 5px; }
.stars { color: var(--vanilla); letter-spacing: 1px; }

/* ---------- Modale, panneau latéral, toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 19, 34, .5); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--surface); color: var(--ink); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: rise .18s ease; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 10px; }
.modal-body { padding: 8px 22px 6px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal .err { color: var(--chili-ink); font-size: .88rem; min-height: 1.2em; margin: 2px 0 6px; }
@media (max-width: 640px) { .overlay { align-items: flex-end; padding: 0; } .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--night); color: #fff; padding: 12px 16px; border-radius: var(--r); box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: .92rem; animation: rise .2s ease; display: flex; gap: 10px; align-items: flex-start; }
:root[data-theme="dark"] .toast { background: #26364d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #26364d; } }
.toast.bad { background: var(--alert-strong); }
.toast.ok::before { content: ''; flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: #5cc36a; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); z-index: 85; box-shadow: -10px 0 40px rgba(0,0,0,.18); display: flex; flex-direction: column; animation: slidein .2s ease; }
.drawer .modal-body { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.notif { padding: 12px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; }
.notif.unread .t { font-weight: 600; }
.notif .dotu { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 7px; flex: none; }
.notif.read .dotu { background: transparent; }

.skeleton { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--line-2), var(--surface), var(--line-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; margin-bottom: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Cartes employés imprimables ---------- */
.cards-print { display: grid; grid-template-columns: repeat(auto-fill, 85.6mm); gap: 6mm; }
.emp-card { width: 85.6mm; height: 54mm; border: 1px solid #c9d2db; border-radius: 3mm; padding: 4mm; display: grid; grid-template-columns: 1fr 30mm; gap: 3mm; background: #fff; color: #12233d; break-inside: avoid; }
.emp-card .co { font-size: 8pt; color: #6a778c; }
.emp-card .nm { font-size: 11pt; font-weight: 600; margin: 2mm 0 1mm; line-height: 1.15; }
.emp-card .mt { font-size: 9pt; }
.emp-card .brand { display: flex; align-items: center; gap: 2mm; font-size: 7pt; color: #6a778c; margin-top: auto; }
.emp-card .brand img { width: 7mm; height: 7mm; }
.emp-card .left { display: flex; flex-direction: column; }
.emp-card svg { width: 30mm; height: 30mm; align-self: center; }
@media print {
  body { background: #fff; }
  .side, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; } .content { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
}

/* =====================================================================
   V1.1 — onglets, grilles de prix, totaux de facture, mise en route,
   bilan des économies, pages publiques (vérification, partage)
   ===================================================================== */
.tabs a { border-bottom: 2.5px solid transparent; padding: 10px 14px; color: var(--ink-3); white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-selected="true"], .tabs a[aria-current="page"] { color: var(--ink); border-color: var(--blue); font-weight: 500; }
.tabs a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 6px 6px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 2px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--ink-2); font-size: .8rem; }
.chip b { color: var(--ink); font-weight: 600; }

/* Grille de prix d'un contrat */
.grid-box { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 14px; margin: 4px 0 14px; }
.grid-box legend { padding: 0 6px; font-size: .9rem; font-weight: 500; color: var(--ink-2); }
.grid-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.grid-row:has(input[data-k="formula_name"]) { grid-template-columns: minmax(0, .7fr) minmax(0, 1.2fr) minmax(0, 1fr) 40px; }
.grid-row select, .grid-row input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.grid-row .icon-btn { width: 36px; height: 36px; font-size: 1.2rem; line-height: 1; }
@media (max-width: 560px) { .grid-row, .grid-row:has(input[data-k="formula_name"]) { grid-template-columns: 1fr 1fr 36px; } .grid-row [data-k="formula_name"] { grid-column: 1 / -2; } }

/* Totaux HT / TVA / TTC : alignés à droite comme sur la facture papier */
.totals { margin: 14px 0 0 auto; max-width: 380px; display: grid; gap: 6px; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.totals > div span { color: var(--ink-3); }
.totals .ttc { border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 8px; font-size: 1.1rem; }
.totals .ttc span { color: var(--ink); font-weight: 600; }
.totals p { margin: 6px 0 0; text-align: right; }

/* Mise en route */
.onboarding { border-left: 3px solid var(--green); }
.onboarding .meter i { background: var(--green); }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .9rem; }
.steps .mark { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.steps li.done .mark { background: var(--green-strong); border-color: var(--green-strong); color: var(--on-accent); }
.steps li.done a { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line); }
.steps .st { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.steps .opt { font-size: .75rem; color: var(--ink-3); }
.steps .mark svg { width: 13px; height: 13px; stroke-width: 3; }

/* Bilan des économies : le chiffre est le seul élément fort de la page */
.pilot { background: var(--night); color: #fff; border-radius: var(--r-lg); padding: 24px 26px; margin-bottom: 18px; }
.pilot .muted { color: #9fb1c9; }
.pilot-amount { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; margin: 6px 0 18px; }
.pilot-amount small { font-size: .9rem; font-weight: 400; color: #9fb1c9; margin-left: 8px; letter-spacing: 0; }
.pilot-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; border-top: 1px dashed #2e4668; padding-top: 14px; }
.pilot-split b { display: block; font-size: 1.15rem; color: #7fd78b; }
.pilot-split span { font-size: .84rem; color: #c9d4e3; }

/* Codes de secours de la double authentification */
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.codes span { padding: 10px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-sm); font-weight: 600; letter-spacing: .08em; user-select: all; }

/* Pages publiques */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 28px 16px; background: var(--bg); }
.public-head img { height: 54px; background: #fff; border-radius: 12px; padding: 6px 10px; }
.public-main { width: min(760px, 100%); margin: 26px 0; }
.public-main h1 { margin-bottom: 6px; }
.public-foot { margin-top: auto; text-align: center; }
.verify { display: flex; gap: 18px; align-items: center; padding: 22px 24px; border-radius: var(--r-lg); margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); }
.verify svg { width: 54px; height: 54px; flex: none; }
.verify.ok { border-color: var(--green); } .verify.ok svg { color: var(--green-ink); }
.verify.bad { border-color: var(--chili); } .verify.bad svg { color: var(--chili-ink); }
.verify h1 { font-size: 1.4rem; }
.verify p { margin: 6px 0 0; }

/* Environnement de test */
.env-ribbon { position: sticky; top: 0; z-index: 1000; background: repeating-linear-gradient(-45deg, #f6c445 0 14px, #f2b824 14px 28px); color: #3a2a00; text-align: center; font-weight: 600; font-size: .85rem; padding: 5px 16px; }

/* ---------- Validation du compte ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
label.btn:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.loading { opacity: .6; pointer-events: none; }
.review-status { border-left: 3px solid var(--vanilla); }
.review-status.submitted { border-left-color: var(--blue); }
.review-status.approved { border-left-color: var(--green); }
.review-status.changes_requested, .review-status.rejected { border-left-color: var(--chili); }
.rs-top { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.rs-top p { margin: 0; flex: 1; min-width: 240px; max-width: 75ch; }
.rs-steps { list-style: none; display: flex; gap: 0; margin: 16px 0 4px; padding: 0; counter-reset: rs; }
.rs-steps li { flex: 1; position: relative; padding-top: 26px; font-size: .8rem; color: var(--ink-3); counter-increment: rs; }
.rs-steps li::before { content: counter(rs); position: absolute; top: 0; left: 0; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: .68rem; z-index: 1; }
.rs-steps li::after { content: ''; position: absolute; top: 10px; left: 22px; right: 4px; height: 2px; background: var(--line); }
.rs-steps li:last-child::after { display: none; }
.rs-steps li.done { color: var(--ink-2); }
.rs-steps li.done::before { content: '✓'; background: var(--green-strong); border-color: var(--green-strong); color: var(--on-accent); }
.rs-steps li.done::after { background: var(--green); }
.rs-steps li.now { color: var(--ink); font-weight: 500; }
.rs-steps li.now::before { border-color: var(--blue); color: var(--blue); }
.cols-eq.tight { gap: 12px; margin-bottom: 0; }
.cols-eq.tight ul { margin: 6px 0 0; padding-left: 18px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; }
.checks .ci { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.checks .ci svg { width: 12px; height: 12px; stroke-width: 2.6; }
.checks li.ok .ci { background: var(--green-soft); color: var(--green-ink); }
.checks li.warn .ci { background: var(--vanilla-soft); color: var(--vanilla-ink); }
.checks li.bad .ci { background: var(--chili-soft); color: var(--chili-ink); }
.checks li.bad { color: var(--chili-ink); }
.doc-kinds { display: grid; gap: 12px; }
.doc-kind { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.dk-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.doc-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--line-2); border-radius: var(--r-sm); }
.doc-list .grow { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.submit-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px; background: var(--line-2); border-radius: var(--r); font-size: .9rem; }
.submit-bar > div { flex: 1; min-width: 240px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.doc-card { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.doc-card img { width: 100%; height: 150px; object-fit: cover; background: var(--line-2); }
.pdf-tile { height: 150px; display: grid; place-items: center; align-content: center; gap: 4px; background: var(--chili-soft); color: var(--chili-ink); font-weight: 600; }
.pdf-tile svg { width: 34px; height: 34px; }
.doc-card figcaption { padding: 10px; display: grid; gap: 4px; font-size: .88rem; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.timeline li { position: relative; font-size: .9rem; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
form.stack { display: grid; gap: 4px; }
.review-ribbon:empty { display: none; }
.review-ribbon { padding: 14px 28px 0; }
.review-ribbon .banner { margin: 0; }
@media (max-width: 760px) { .review-ribbon { padding: 12px 16px 0; } }
@media (max-width: 640px) {
  .banner { flex-wrap: wrap; }
  .banner > .btn, .banner > .btn-row { margin-left: 32px; }
}
/* Graphiques lisibles sur téléphone : le texte est dimensionné dans le repère du graphique (640 de large) */
@media (max-width: 640px) { .chart text { font-size: 19px; } }
.grid-head { font-size: .8rem; color: var(--ink-3); margin-bottom: 2px; }
.grid-head span { padding: 0 2px; }
/* La zone principale reçoit le focus à chaque changement de page (lecteurs d'écran) : pas de cadre sur cet élément non interactif */
.content:focus, .content:focus-visible, [role="tabpanel"]:focus:not(:focus-visible) { outline: none; }

/* =====================================================================
   Design V2 (V1.4) — référence : docs/DESIGN.md
   Menu bleu nuit, cartes blanches arrondies, pastilles d'indicateurs colorées, en-têtes avec visuel,
   états vides illustrés. Les règles ci-dessous remplacent les précédentes (même spécificité, plus tard).
   ===================================================================== */
body { font-size: 15px; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.05rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.12rem; font-weight: 600; }

/* Boutons et champs */
.btn { min-height: 42px; padding: 0 18px; border-radius: var(--r-sm); font-weight: 500; box-shadow: 0 1px 2px rgba(11, 99, 206, .18); }
.btn.ghost { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); background: var(--surface); box-shadow: none; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger, .btn.link { box-shadow: none; }
.btn.sm { min-height: 34px; padding: 0 12px; }
input, select, textarea { border-radius: var(--r-sm); border-color: #cfd8e3; min-height: 44px; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { border-color: var(--line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(input, select, textarea) { border-color: var(--line-strong); } }
input::placeholder, textarea::placeholder { color: #6b7a8f; opacity: 1; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235a6a80' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
label.field > span { font-weight: 500; color: var(--ink); }

/* Menu latéral */
.side { background: linear-gradient(180deg, var(--night-2) 0%, var(--night) 100%); color: #d3dcea; overflow-x: hidden; }
.side .brand { padding: 22px 22px 18px; gap: 12px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.side .brand img { width: 46px; height: 46px; background: none; padding: 0; border-radius: 0; }
.side .brand b { font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; }
.side .brand b em { font-style: normal; color: #4cc26a; }
.side .brand small { color: #93a6c1; font-size: .78rem; letter-spacing: .02em; }
.side .org { margin: 14px 14px 8px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, .05); border-radius: var(--r); }
.side .org .org-ico { width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; flex: none; }
.side .org .org-ico svg { width: 17px; height: 17px; }
.side .org > div { min-width: 0; }
.side nav { padding: 6px 14px 14px; }
.side nav .grp { color: #7f93ad; font-size: .72rem; letter-spacing: .02em; margin: 16px 12px 6px; }
.side nav a { padding: 11px 14px; margin: 2px 0; border-radius: var(--r); color: #d3dcea; gap: 14px; font-size: .95rem; }
.side nav a svg { width: 20px; height: 20px; opacity: .9; }
.side nav a:hover { background: rgba(255, 255, 255, .06); }
.side nav a[aria-current="page"] { background: #1565d8; color: #fff; box-shadow: 0 6px 18px rgba(21, 101, 216, .35); }
.side nav a[aria-current="page"] svg { opacity: 1; }
.side .side-foot { position: relative; padding: 18px 22px 26px; color: #a9b8cc; line-height: 1.45; overflow: hidden; }
.side .side-foot::before { content: ''; display: block; width: 40px; height: 3px; border-radius: 3px; background: #22a04b; margin-bottom: 12px; }
.side .side-foot::after { content: ''; position: absolute; left: -40px; bottom: 56px; width: 240px; height: 120px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(34, 160, 75, .22), transparent); pointer-events: none; }

/* Barre du haut */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 28px; gap: 14px; backdrop-filter: none; }
.topbar .search { flex: 0 1 460px; position: relative; }
.topbar .search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.topbar .search input { min-height: 44px; padding-left: 42px; border-radius: 12px; background: var(--bg); border-color: var(--line); }
.topbar .search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 40; max-height: 60vh; overflow-y: auto; }
.topbar .search-results a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.topbar .search-results a svg { position: static; transform: none; color: var(--blue); }
.topbar .search-results a:hover, .topbar .search-results a[aria-selected="true"] { background: var(--blue-soft); }
.topbar .search-results .none { padding: 10px; color: var(--ink-3); font-size: .9rem; }
.icon-btn { width: 44px; height: 44px; border-color: var(--line); }
.icon-btn .dot { top: 4px; right: 4px; }
.userchip { border: 0; background: none; padding: 4px; gap: 12px; }
.userchip .who { font-weight: 600; font-size: .9rem; }
.userchip .who small { font-weight: 400; }
.userchip > svg { width: 18px; height: 18px; color: var(--ink-3); }
.avatar { width: 40px; height: 40px; background: #1565d8; font-size: .9rem; }
.content { padding: 28px 32px 64px; max-width: 1360px; }

/* En-tête de page : titre souligné de vert, visuel facultatif à droite */
.page-head { align-items: flex-start; margin-bottom: 26px; }
.page-head .ph-text { max-width: 760px; }
.page-head .ph-text::after { content: ''; display: block; width: 48px; height: 4px; border-radius: 4px; background: #22a04b; margin-top: 16px; }
.page-head p { margin-top: 8px; font-size: 1rem; line-height: 1.55; }
.page-head.hero { position: relative; margin: -28px -32px 26px; padding: 30px 32px 30px; min-height: 176px; isolation: isolate; }
.page-head.hero::before { content: ''; position: absolute; inset: 0 0 0 38%; z-index: -1; background-repeat: no-repeat; background-size: cover; background-position: right center;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%); mask-image: linear-gradient(90deg, transparent 0%, #000 40%); }
.page-head.hero-food::before { background-image: url('/assets/hero-food.webp'); opacity: .95; }
.page-head.hero-tablet::before { background-image: url('/assets/hero-tablet.webp'); background-position: right top; }
:root[data-theme="dark"] .page-head.hero::before { opacity: .45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-head.hero::before { opacity: .45; } }
.page-head.hero .btn-row { position: relative; z-index: 1; }
@media (max-width: 900px) { .page-head.hero { margin: -18px -16px 20px; padding: 22px 16px; min-height: 0; } .page-head.hero::before { display: none; } }
.date-chip { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.date-chip svg { width: 22px; height: 22px; color: var(--ink-2); }
.date-chip b { display: block; font-size: .9rem; font-weight: 600; }
.date-chip span { font-size: .84rem; color: var(--ink-3); }

/* Panneaux */
.panel { border-radius: var(--r-lg); border-color: var(--line); box-shadow: var(--shadow); padding: 22px 24px; }
.panel-head h2 { display: flex; align-items: center; gap: 10px; }
.panel-head h2 > svg { width: 22px; height: 22px; color: var(--blue); }

/* Cartes d'indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; background: none; border: 0; border-radius: 0; overflow: visible; margin-bottom: 22px; }
.kpi { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 4px 14px; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; min-height: 112px; }
.kpi:not(.has-icon) { grid-template-columns: minmax(0, 1fr); }
.kpi:last-child { border-right: 1px solid var(--line); }
.kpi .tile { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; }
.kpi .tile svg { width: 26px; height: 26px; }
.kpi .kv { min-width: 0; }
.kpi .v { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--ink); }
.kpi .l { font-size: .9rem; color: var(--ink-2); margin-top: 4px; }
.kpi .d { font-size: .8rem; color: var(--ink-3); }
.kpi .spark { grid-column: 1 / -1; width: 100%; height: 40px; margin-top: 8px; display: block; }
.spark .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark .area { opacity: .14; }
.tile.t-blue, .spark.t-blue { background-color: var(--t-blue-bg); color: var(--t-blue); }
.tile.t-green, .spark.t-green { background-color: var(--t-green-bg); color: var(--t-green); }
.tile.t-purple, .spark.t-purple { background-color: var(--t-purple-bg); color: var(--t-purple); }
.tile.t-orange, .spark.t-orange { background-color: var(--t-orange-bg); color: var(--t-orange); }
.tile.t-teal, .spark.t-teal { background-color: var(--t-teal-bg); color: var(--t-teal); }
.tile.t-red, .spark.t-red { background-color: var(--t-red-bg); color: var(--t-red); }
.tile.t-amber, .spark.t-amber { background-color: var(--t-amber-bg); color: var(--t-amber); }
.spark { background: none !important; }
.spark .line { stroke: currentColor; }
.spark .area { fill: currentColor; }
.kpi.good .v { color: var(--green-ink); }
.kpi.bad .v { color: var(--chili-ink); }
.kpi.warn .v { color: var(--vanilla-ink); }

/* Bandeaux */
.banner { padding: 16px 20px; border-radius: var(--r-lg); align-items: center; gap: 16px; font-size: .95rem; }
.banner > svg { width: 28px; height: 28px; margin: 0; }
.banner.warn { background: var(--vanilla-soft); border-color: color-mix(in srgb, var(--vanilla) 45%, transparent); }
.banner.warn > svg { color: var(--vanilla); }
.banner.bad > svg { color: var(--chili); }
.banner.ok > svg { color: var(--green); }
.banner:not(.warn):not(.bad):not(.ok) > svg { color: var(--blue); }
.banner.warn .btn.ghost, .banner.warn .btn.sm { background: var(--surface); color: var(--vanilla-ink); border-color: color-mix(in srgb, var(--vanilla) 60%, transparent); box-shadow: none; }
.banner .grow b, .banner .grow strong { font-weight: 600; }

/* États vides */
.empty { padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .ill { width: 84px; height: 84px; border-radius: 50%; background: var(--line-2); color: var(--ink-3); display: grid; place-items: center; margin-bottom: 14px; }
.empty .ill svg { width: 36px; height: 36px; }
.empty b { font-size: 1.08rem; font-weight: 600; }
.empty .hint { max-width: 52ch; }
.empty .act { margin-top: 16px; }

/* Tableaux et listes */
.tbl-wrap { border-radius: var(--r-lg); box-shadow: var(--shadow); }
.tbl th { background: var(--surface); color: var(--ink-3); font-size: .8rem; padding: 12px 14px; }
.tbl td { padding: 13px 14px; }
.list-item { padding: 14px 4px; gap: 14px; }
.list-item .tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.list-item .tile svg { width: 22px; height: 22px; }
.list-item > .chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
a.list-item { color: inherit; text-decoration: none; }
a.list-item:hover .t { color: var(--blue); }
.badge { padding: 4px 11px; font-size: .8rem; }
.tabs button[aria-selected="true"], .tabs a[aria-selected="true"], .tabs a[aria-current="page"] { border-color: #1565d8; }
.info-line { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r); background: var(--blue-soft); color: var(--ink-2); font-size: .88rem; margin-top: 16px; }
.info-line svg { width: 18px; height: 18px; color: var(--blue); flex: none; }

/* Écran de connexion (et inscription) */
.auth { grid-template-columns: minmax(0, 1.5fr) minmax(400px, 1fr); background: #f6f9fc; }
.auth-side { background: #f7fafc; color: var(--ink); padding: 56px calc(44% + 8px) 48px 64px; justify-content: center; isolation: isolate; }
.auth-side::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 46%; z-index: -1; background: url('/assets/hero-chef.webp') center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 34%); mask-image: linear-gradient(90deg, transparent 0%, #000 34%); }
.auth-side h1 { color: #0f1f38; font-size: clamp(1.9rem, 3vw, 3.1rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; max-width: 12ch; margin: 0 0 22px; }
.auth-side h1 em { font-style: normal; color: #1f9a3e; display: block; }
.auth-side .rule { width: 72px; height: 4px; border-radius: 4px; background: #22a04b; margin: 0 0 22px; }
.auth-side .lead { color: #3a4a63; font-size: 1.08rem; max-width: 34ch; line-height: 1.55; margin-bottom: 40px; }
.auth-feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.auth-feats .tile { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(15, 31, 56, .08); }
.auth-feats .tile svg { width: 32px; height: 32px; }
.auth-feats b { display: block; color: #0f1f38; font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.auth-feats span { color: #4b5b72; font-size: .88rem; line-height: 1.45; }
.auth-main { background: radial-gradient(120% 80% at 100% 100%, #e7f4ec 0%, transparent 55%), linear-gradient(180deg, #f3f7fb, #eef3f9); padding: 32px; }
.auth-card { max-width: 500px; background: var(--surface); border-radius: 24px; box-shadow: 0 10px 40px rgba(15, 31, 56, .10); padding: 34px 40px 26px; }
.auth-card .auth-logo { display: block; width: 210px; margin: 0 auto 18px; }
.auth-card h2 { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; }
.auth-card .sub { margin-bottom: 22px; }
.auth-card .btn[type="submit"] { width: 100%; min-height: 50px; font-size: 1.02rem; border-radius: 14px; background: #0b63ce; }
.auth-card .btn[type="submit"] svg { margin-left: auto; }
.auth-card .btn[type="submit"] span { margin-left: auto; }
.input-ico { position: relative; }
.input-ico > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--ink-3); pointer-events: none; }
.input-ico input { padding-left: 44px; min-height: 50px; }
.input-ico .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; border-radius: 8px; }
.input-ico .reveal svg { width: 20px; height: 20px; }
.input-ico:has(.reveal) input { padding-right: 48px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .88rem; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-card .btn.ghost.wide { width: 100%; min-height: 50px; border-radius: 14px; border-width: 1.5px; border-color: #0b63ce; font-weight: 600; }
.auth-card .note { text-align: center; color: var(--ink-3); font-size: .85rem; margin: 12px 0 0; }
.auth-card .legal-foot { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; text-align: center; font-size: .84rem; color: var(--ink-3); }
.auth-card .legal-foot a { margin: 0 4px; }
.auth-card .forgot { display: block; text-align: right; margin: -6px 0 14px; font-size: .9rem; font-weight: 500; }
.flag-mg { display: inline-block; width: 16px; height: 11px; vertical-align: -1px; margin-right: 6px; border-radius: 2px;
  background: linear-gradient(90deg, #fff 33%, transparent 33%), linear-gradient(180deg, #e3262f 50%, #1a9f4b 50%); box-shadow: 0 0 0 1px #d6dde6; }
:root[data-theme="dark"] .auth, :root[data-theme="dark"] .auth-main { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.auth, .auth-main) { background: var(--bg); } }
@media (max-width: 1100px) { .auth-feats { grid-template-columns: 1fr; gap: 14px; } .auth-feats > div { display: grid; grid-template-columns: 52px 1fr; gap: 0 14px; }
  .auth-feats .tile { width: 52px; height: 52px; margin: 0; grid-row: span 2; } }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-main { order: -1; padding: 18px 14px; }
  .auth-card { padding: 24px 20px 20px; border-radius: 20px; }
  .auth-side { background: #f6f9fc; padding: 28px 20px 36px; }
  .auth-side h1 { font-size: 1.7rem; max-width: none; }
  .auth-side .lead { margin-bottom: 22px; }
}

/* Mobile */
@media (max-width: 980px) {
  .topbar { padding: 10px 14px; }
  .topbar .search { display: none; }
  .content { padding: 18px 16px 70px; }
}
:root[data-theme="dark"] .auth-side { background: var(--bg); }
:root[data-theme="dark"] .auth-side :is(h1, .auth-feats b) { color: var(--ink); }
:root[data-theme="dark"] .auth-side :is(.lead, .auth-feats span) { color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-side { background: var(--bg); }
  :root:not([data-theme="light"]) .auth-side :is(h1, .auth-feats b) { color: var(--ink); }
  :root:not([data-theme="light"]) .auth-side :is(.lead, .auth-feats span) { color: var(--ink-2); }
}
@media (max-width: 900px) { :root .auth-side { background: var(--bg) !important; padding: 28px 20px 36px; } .auth-side::after { display: none; } }
/* Ajustements après contrôle visuel */
.kpi { padding: 16px 16px 14px; gap: 2px 12px; min-height: 104px; align-content: start; }
.kpi .tile { width: 46px; height: 46px; border-radius: 13px; }
.kpi .tile svg { width: 24px; height: 24px; }
.kpi .v { font-size: 1.7rem; }
.kpi .l { font-size: .86rem; line-height: 1.3; }
.page-head.hero .ph-text { max-width: min(720px, 56%); }
@media (max-width: 900px) { .page-head.hero .ph-text { max-width: none; } }
.auth-card p.err { margin: 0 0 10px; min-height: 0 !important; }
.auth-side { padding-right: calc(41% + 8px); }
.auth-side::after { width: 42%; }
/* Vignette d'image (logo d'une organisation dans les paramètres) : fond blanc dans les deux thèmes, le logo garde ses couleurs */
.thumb { display: block; max-width: 220px; max-height: 64px; margin: 6px 0 4px; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); object-fit: contain; }
