/* =====================================================================
   Système de style — calqué sur le CRM Figelys (verre clair, rail d'icônes sombre,
   typographie dense), avec le bleu de la marque et une touche de jaune.
   Clair / sombre : html[data-theme] posé avant l'affichage (templates/header.php).
   Toutes les couleurs passent par les jetons. Composants PHP : includes/ui.php.
   ===================================================================== */

@view-transition { navigation: auto; }

:root {
  --bg: #F4F6FA;
  --glow-1: rgba(59, 130, 246, .16);
  --glow-2: rgba(250, 204, 21, .10);
  --glow-3: rgba(14, 165, 233, .10);
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .5);
  --surface-strong: rgba(255, 255, 255, .97);
  --sunken: rgba(226, 232, 240, .55);
  --edge: rgba(255, 255, 255, .9);
  --hover: rgba(37, 99, 235, .05);
  --ink: #0F172A;
  --ink-2: #1E293B;
  --ink-3: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --line: rgba(15, 23, 42, .07);
  --line-strong: rgba(15, 23, 42, .13);
  --brand: #2563EB;
  --brand-2: #3B82F6;
  --brand-strong: #1D4ED8;
  --brand-ink: #FFFFFF;
  --brand-soft: rgba(37, 99, 235, .09);
  --grad: linear-gradient(135deg, #3B82F6 0%, #2563EB 55%, #1D4ED8 100%);
  --yellow: #FACC15;
  --yellow-soft: rgba(250, 204, 21, .18);
  --ok: #059669;      --ok-soft: rgba(16, 185, 129, .12);
  --warn: #B45309;    --warn-soft: rgba(245, 158, 11, .14);
  --bad: #DC2626;     --bad-soft: rgba(239, 68, 68, .10);
  --violet: #7C3AED;  --violet-soft: rgba(124, 58, 237, .10);
  --shadow-1: inset 0 1px 0 rgba(255,255,255,.9), 0 0 0 1px var(--edge), 0 10px 28px -16px rgba(15,23,42,.22), 0 1px 3px rgba(15,23,42,.04);
  --shadow-2: inset 0 1px 0 rgba(255,255,255,.9), 0 0 0 1px var(--edge), 0 30px 70px -24px rgba(15,23,42,.35);
  --neu-raised: 3px 3px 8px rgba(148, 163, 184, .35), -3px -3px 8px rgba(255, 255, 255, .95);
  --neu-pressed: inset 3px 3px 7px rgba(148, 163, 184, .35), inset -3px -3px 7px rgba(255, 255, 255, .9);
  --neu-input: inset 2px 2px 5px rgba(148, 163, 184, .22), inset -2px -2px 5px rgba(255, 255, 255, .8);
  --input-bg: rgba(248, 250, 252, .9);
  --rail: linear-gradient(180deg, #0B1324 0%, #070D1B 100%);
  --radius: 16px;
  --radius-sm: 11px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --tabbar-h: 0px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #020617;
  --glow-1: rgba(59, 130, 246, .12);
  --glow-2: rgba(250, 204, 21, .05);
  --glow-3: rgba(14, 165, 233, .07);
  --surface: rgba(15, 23, 42, .66);
  --surface-2: rgba(30, 41, 59, .38);
  --surface-strong: rgba(15, 23, 42, .96);
  --sunken: rgba(2, 6, 23, .45);
  --edge: rgba(148, 163, 184, .12);
  --hover: rgba(96, 165, 250, .08);
  --ink: #F1F5F9; --ink-2: #E2E8F0; --ink-3: #CBD5E1;
  --muted: #94A3B8; --faint: #64748B;
  --line: rgba(148, 163, 184, .12);
  --line-strong: rgba(148, 163, 184, .22);
  --brand: #60A5FA; --brand-2: #93C5FD; --brand-strong: #3B82F6; --brand-ink: #FFFFFF;
  --brand-soft: rgba(96, 165, 250, .12);
  --yellow-soft: rgba(250, 204, 21, .12);
  --ok: #34D399; --ok-soft: rgba(52, 211, 153, .12);
  --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .12);
  --bad: #F87171; --bad-soft: rgba(248, 113, 113, .12);
  --violet: #A78BFA; --violet-soft: rgba(167, 139, 250, .12);
  --shadow-1: inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 1px var(--edge), 0 16px 40px -18px rgba(0,0,0,.7);
  --shadow-2: inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px var(--edge), 0 30px 80px -20px rgba(0,0,0,.8);
  --neu-raised: 3px 3px 8px rgba(0, 0, 0, .5), -2px -2px 7px rgba(51, 65, 85, .2);
  --neu-pressed: inset 3px 3px 7px rgba(0, 0, 0, .55), inset -2px -2px 6px rgba(51, 65, 85, .22);
  --neu-input: inset 2px 2px 5px rgba(0, 0, 0, .45), inset -1px -1px 4px rgba(51, 65, 85, .2);
  --input-bg: rgba(2, 6, 23, .55);
  --rail: linear-gradient(180deg, #050A16 0%, #02050E 100%);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--bg); color: var(--ink-2); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; min-height: 100dvh; }
body::before { content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(36rem 36rem at 10% 6%, var(--glow-1), transparent 62%),
    radial-gradient(32rem 32rem at 95% 40%, var(--glow-2), transparent 62%),
    radial-gradient(30rem 30rem at 45% 100%, var(--glow-3), transparent 62%);
  animation: ambient-drift 40s ease-in-out infinite alternate; }
@keyframes ambient-drift {
  0% { transform: translate3d(0,0,0) rotate(0deg); }
  50% { transform: translate3d(3%,-2%,0) rotate(4deg); }
  100% { transform: translate3d(-3%,2%,0) rotate(-3deg); } }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font); color: var(--ink); margin: 0; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1rem; font-weight: 700; }
h3 { font-size: .92rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .8rem; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .85em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.ti { display: inline-block; font-size: 1.1em; line-height: 1; vertical-align: -.14em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Mise en page : rail d'icônes (ordinateur), barre du haut, tiroir (téléphone) ---------- */
.layout { min-height: 100dvh; }
.sidebar { display: none; }
.page { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 64px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid var(--line); box-shadow: inset 0 -1px 0 var(--edge); }
.topbar .tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.content { padding: 22px 16px 40px; max-width: 1240px; margin: 0 auto; animation: page-in .3s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Logo en tuile blanche (marque) */
.logo-tile { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: var(--surface-strong); box-shadow: var(--neu-raised); border: 0; padding: 0; cursor: pointer; }
.logo-tile svg { width: 26px; height: 26px; }
.logo-tile:active { box-shadow: var(--neu-pressed); }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; align-items: center; position: sticky; top: 0; height: 100dvh; z-index: 40;
    padding: 12px 0; gap: 6px; background: radial-gradient(10rem 8rem at 50% 0%, rgba(59,130,246,.22), transparent 70%), var(--rail);
    box-shadow: inset -1px 0 0 rgba(255,255,255,.05), 8px 0 30px -12px rgba(2,6,23,.45); }
  .sidebar .logo-tile { margin-bottom: 8px; background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .rail-sep { width: 32px; height: 1px; background: rgba(255,255,255,.08); margin: 8px 0; }
  .rail a { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
    color: rgba(203, 213, 225, .72); transition: background .15s, color .15s, box-shadow .15s; }
  .rail a .ti { font-size: 1.32rem; }
  .rail a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .rail a.active { color: #BFDBFE; background: rgba(59,130,246,.16); box-shadow: inset 0 0 0 1px rgba(96,165,250,.45), 0 0 18px -4px rgba(59,130,246,.55); }
  .rail a .pip { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px #0B1324; }
  /* Infobulle du rail */
  .rail a::after { content: attr(data-label); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-4px);
    white-space: nowrap; font: 600 .78rem var(--font); color: #fff; background: #0F172A; padding: 6px 10px; border-radius: 8px;
    box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; }
  .rail a:hover::after, .rail a:focus-visible::after { opacity: 1; transform: translateY(-50%); }
  .sidebar .me { margin-top: auto; }
  .topbar { padding: 12px 28px; }
  .topbar .menu-btn { display: none; }
  .content { padding: 26px 32px 56px; }
}

/* Boutons ronds en relief (thème, notifications) et pastille utilisateur */
.round-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; border: 0; padding: 0;
  cursor: pointer; color: var(--ink-3); background: var(--surface-strong); box-shadow: var(--neu-raised); position: relative; flex: none; text-decoration: none; }
.round-btn:hover { color: var(--brand); }
.round-btn:active { box-shadow: var(--neu-pressed); }
.round-btn .ti { font-size: 1.15rem; }
.round-btn .dot { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: #EF4444; color: #fff;
  font: 700 .6rem/16px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface-strong); }
[data-theme-toggle] .ti-sun { display: none; }
html[data-theme="dark"] [data-theme-toggle] .ti-sun { display: inline-block; }
html[data-theme="dark"] [data-theme-toggle] .ti-moon { display: none; }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer;
  background: var(--surface-strong); box-shadow: var(--neu-raised); color: var(--ink-3); font-weight: 600; font-size: .85rem; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu[open] > summary { box-shadow: var(--neu-pressed); }
.user-menu .caret { color: var(--faint); transition: transform .2s; }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-menu .panel { position: absolute; right: 0; top: calc(100% + 10px); width: 240px; padding: 6px; border-radius: 16px; z-index: 60;
  background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%); animation: pop .16s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.user-menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu .head b { display: block; color: var(--ink); font-size: .85rem; }
.user-menu .head span { font-size: .75rem; color: var(--muted); }
.menu-item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px;
  font-size: .85rem; font-weight: 550; color: var(--ink-3); cursor: pointer; }
.menu-item .ti { color: var(--faint); font-size: 1.1rem; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); color: var(--ink); }
.menu-item:hover .ti { color: var(--brand); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger .ti { color: var(--bad); }
@media (max-width: 899px) {
  .user-menu .name, .user-menu .caret, .topbar .desk-only { display: none; }
  .user-menu > summary { padding: 3px; }
}

/* ---------- Sélecteur d'établissement ---------- */
.loc-switch { display: flex; align-items: center; min-width: 0; flex: 1; }
.loc-switch select { appearance: none; -webkit-appearance: none; width: 100%; max-width: 100%; font: 650 .88rem var(--font); color: var(--ink);
  background-color: var(--surface-strong); border: 0; border-radius: 999px; padding: 10px 34px 10px 14px; text-overflow: ellipsis; box-shadow: var(--neu-raised);
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.loc-switch .loc-name { font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .loc-switch { flex: 0 1 auto; } .loc-switch select { width: auto; max-width: 420px; } }

/* ---------- En-tête de page et titres de section ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--faint); margin-top: 3px; font-size: .88rem; }
.page-head h1 .ti { color: var(--brand); margin-right: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-label { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; font: 700 .7rem var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--faint); }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 650 .86rem var(--font); min-height: 38px; padding: 0 15px;
  border-radius: 11px; border: 0; cursor: pointer; text-decoration: none; color: var(--brand-ink); background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 22px -12px rgba(37,99,235,.75);
  transition: filter .15s, transform .15s, box-shadow .15s; touch-action: manipulation; white-space: nowrap; }
.btn:hover { color: #fff; filter: brightness(1.06) saturate(1.05); transform: translateY(-1px); }
.btn:active { transform: none; box-shadow: inset 2px 2px 6px rgba(0,0,0,.2); }
.btn:disabled, .btn[aria-busy=true] { opacity: .6; pointer-events: none; }
.btn-ghost { background: var(--surface-strong); color: var(--ink-3); box-shadow: var(--neu-raised); }
.btn-ghost:hover { color: var(--brand); }
.btn-ghost:active { box-shadow: var(--neu-pressed); }
.btn-soft { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn-soft:hover { color: var(--brand-strong); }
.btn-danger { background: linear-gradient(135deg, #F87171, #DC2626); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 22px -12px rgba(239,68,68,.7); }
.btn-yellow { background: linear-gradient(135deg, #FDE047, #FACC15); color: #1A1600; }
.btn-yellow:hover { color: #1A1600; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: .8rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.link { all: unset; color: var(--brand); cursor: pointer; font-weight: 600; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); min-width: 0; }
.card-pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > .card-bar { margin: -18px -18px 14px; }
.card-title { display: inline-flex; align-items: center; gap: 8px; font: 700 .72rem var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.card-title .ti { color: var(--faint); font-size: 1rem; }
.card-link { font-size: .78rem; color: var(--faint); font-weight: 550; }
.card-link:hover { color: var(--brand); }
.grid, .grid-2, .grid-3 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }

/* ---------- Statistiques : pastille d'icône en relief, chiffre coloré, étiquette en capitales, tache de couleur ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.stat { --c: var(--brand); --cs: var(--brand-soft); position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); min-width: 0; }
.stat::after { content: ""; position: absolute; width: 120px; height: 120px; right: -36px; top: -46px; border-radius: 50%; background: var(--cs); filter: blur(22px); opacity: .9; pointer-events: none; }
.stat .ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--c); background: var(--surface-strong); box-shadow: var(--neu-raised); margin-bottom: 12px; }
.stat .value { font: 800 1.65rem/1.1 var(--font); color: var(--c); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .label { margin-top: 6px; font: 700 .66rem var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat .trend { font-size: .74rem; font-weight: 650; color: var(--ok); margin-top: 4px; }
.stat .trend.down { color: var(--bad); }
.stat.t-ok { --c: var(--ok); --cs: var(--ok-soft); }
.stat.t-warn { --c: var(--warn); --cs: var(--warn-soft); }
.stat.t-bad { --c: var(--bad); --cs: var(--bad-soft); }
.stat.t-violet { --c: var(--violet); --cs: var(--violet-soft); }
.stat.t-plain { --c: var(--ink); --cs: var(--sunken); }
.hero-rating { display: flex; align-items: center; gap: 16px; }
.hero-rating .big { font: 800 2.6rem/1 var(--font); color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- Pastilles, étoiles, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font: 650 .7rem/1 var(--font); padding: 5px 8px; border-radius: 7px;
  background: var(--sunken); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.stars { color: #F59E0B; letter-spacing: 1px; white-space: nowrap; font-size: .9em; }
.stars .off { color: var(--line-strong); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 .72rem var(--font); color: #fff;
  background: linear-gradient(135deg, var(--a1, #60A5FA), var(--a2, #2563EB)); box-shadow: 0 4px 10px -4px rgba(15,23,42,.35); }
.avatar.sm { width: 28px; height: 28px; font-size: .64rem; }
.avatar.c1 { --a1: #34D399; --a2: #059669; } .avatar.c2 { --a1: #A78BFA; --a2: #7C3AED; } .avatar.c3 { --a1: #FBBF24; --a2: #D97706; }
.avatar.c4 { --a1: #F472B6; --a2: #DB2777; } .avatar.c5 { --a1: #38BDF8; --a2: #0284C7; } .avatar.c0 { --a1: #60A5FA; --a2: #2563EB; }
.chip-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; flex: none; color: var(--muted); background: var(--sunken); }
.chip-ic.info { color: var(--brand); background: var(--brand-soft); }
.chip-ic.ok { color: var(--ok); background: var(--ok-soft); }

/* ---------- Listes (lisibles sur téléphone) ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; transition: background .12s; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--hover); color: inherit; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: .8rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.row .chev { color: var(--line-strong); flex: none; }

/* Tableau (ordinateur) qui devient une pile de cartes (téléphone) : <td data-label="Canal"> */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th { text-align: left; font: 700 .68rem var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-3); }
table.data tr:hover td { background: var(--hover); }
table.data tr:last-child td { border-bottom: 0; }
@media (max-width: 699px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.data td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 600; }
}

/* ---------- Filtres, segments, recherche ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 600 .8rem var(--font); padding: 7px 12px; border-radius: 999px;
  background: var(--surface-strong); border: 0; color: var(--ink-3); box-shadow: var(--neu-raised); text-decoration: none; transition: all .15s; }
.chip:hover { color: var(--brand); }
.chip:active { box-shadow: var(--neu-pressed); }
.chip.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(37,99,235,.75); }
.chip .n { font-size: .7rem; opacity: .65; }
.seg { display: inline-flex; padding: 4px; gap: 3px; background: var(--sunken); border-radius: 12px; box-shadow: var(--neu-input); max-width: 100%; }
.seg label, .seg a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 9px; font: 650 .84rem var(--font);
  color: var(--muted); cursor: pointer; text-decoration: none; flex: 1; min-width: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg a.active { background: var(--surface-strong); color: var(--ink); box-shadow: var(--neu-raised); }
.search { position: relative; }
.search .ti { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 38px !important; }

/* ---------- Formulaires : champs creusés ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font: 650 .8rem var(--font); color: var(--ink-3); }
.field .hint { font-size: .76rem; color: var(--faint); }
.field .error { font-size: .76rem; color: var(--bad); font-weight: 600; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .auth-card input:not([type=hidden]):not([type=checkbox]) {
  width: 100%; font: 500 1rem var(--font); color: var(--ink); background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 13px; box-shadow: var(--neu-input); transition: border-color .15s, box-shadow .15s; }
@media (min-width: 900px) { .input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea { font-size: .9rem; } }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .auth-card input:focus {
  outline: none; border-color: var(--brand-2); box-shadow: var(--neu-input), 0 0 0 3px var(--brand-soft); }
::placeholder { color: var(--faint); }
.field.invalid input, .field.invalid textarea { border-color: var(--bad); }
.form-row { display: grid; gap: 14px; }
@media (min-width: 700px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.check input { width: 18px; height: 18px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--sunken); border-radius: 24px; box-shadow: var(--neu-input); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.counter { font: 600 .74rem var(--font); color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); }
.preview-bubble { background: var(--surface-strong); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 12px 14px; font-size: .9rem;
  white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-1); }
.tag { font: 600 .76rem var(--mono); background: var(--brand-soft); color: var(--brand); padding: 1px 6px; border-radius: 6px; }
.gauge { height: 7px; background: var(--sunken); border-radius: 7px; overflow: hidden; box-shadow: var(--neu-input); }
.gauge > i { display: block; height: 100%; background: var(--grad); border-radius: 7px; transition: width .6s var(--ease); }
.gauge.bad > i { background: linear-gradient(135deg, #F87171, #DC2626); }

/* ---------- Messages, états vides, chargement ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 550; font-size: .86rem; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--brand-soft); color: var(--brand); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 32px 20px; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .86rem; }
.empty > .ti { font-size: 1.5rem; color: var(--brand); width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-strong); box-shadow: var(--neu-raised); margin-bottom: 4px; }
.empty h3 { color: var(--ink-2); font-size: .9rem; }
.skeleton { background: linear-gradient(90deg, var(--sunken) 25%, var(--line) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 70;
  display: flex; flex-direction: column; gap: 8px; width: min(92vw, 400px); pointer-events: none; }
@media (min-width: 900px) { .toasts { left: auto; right: 24px; bottom: 24px; transform: none; } }
.toast { pointer-events: auto; background: rgba(15,23,42,.94); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-2);
  font-weight: 600; font-size: .86rem; display: flex; gap: 10px; align-items: center; animation: toast-in .25s var(--ease) both; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.toast.ok .ti { color: #6EE7B7; }
.toast.bad .ti { color: #FCA5A5; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Fenêtres : <dialog class="sheet"> (feuille du bas sur téléphone, fenêtre au centre sur ordinateur) ---------- */
dialog.sheet { border: 0; padding: 0; color: var(--ink-2); width: 100%; max-width: 100%; margin: auto auto 0; border-radius: 22px 22px 0 0; max-height: 92dvh;
  background: var(--surface-strong); box-shadow: var(--shadow-2); backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%); }
dialog.sheet[open] { animation: sheet-up .28s var(--ease) both; }
dialog.sheet::backdrop { background: rgba(15,23,42,.35); backdrop-filter: blur(6px) saturate(120%); }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 8px; }
.sheet-head::before { content: ""; position: absolute; left: 50%; top: 7px; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line-strong); }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: calc(92dvh - 60px); }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) { dialog.sheet { margin: auto; max-width: 560px; border-radius: 20px; } .sheet-head::before { display: none; } }
/* Tiroir de navigation (téléphone) : dialog.sheet.drawer, depuis la gauche */
dialog.sheet.drawer { margin: 0 auto 0 0; height: 100dvh; max-height: 100dvh; width: min(84vw, 320px); border-radius: 0 22px 22px 0; }
dialog.sheet.drawer[open] { animation: drawer-in .26s var(--ease) both; }
dialog.sheet.drawer .sheet-head::before { display: none; }
dialog.sheet.drawer .sheet-body { max-height: calc(100dvh - 70px); }
@keyframes drawer-in { from { transform: translateX(-24px); opacity: 0; } }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-list a, .menu-list button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  font-weight: 600; font-size: .9rem; color: var(--ink-3); cursor: pointer; width: 100%; }
.menu-list a .ti, .menu-list button .ti { color: var(--faint); font-size: 1.25rem; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); color: var(--ink); }
.menu-list a.active { background: var(--brand-soft); color: var(--brand); }
.menu-list a.active .ti { color: var(--brand); }
.menu-label { font: 700 .66rem var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 14px 12px 4px; }

/* ---------- Pages d'authentification : fond clair à rubans, carte en verre ---------- */
body.auth { display: grid; place-items: center; padding: 20px; min-height: 100dvh; }
body.auth::before {
  background:
    radial-gradient(55rem 9rem at 72% 12%, rgba(59,130,246,.42), transparent 62%),
    radial-gradient(42rem 8rem at 18% 46%, rgba(59,130,246,.30), transparent 64%),
    radial-gradient(26rem 16rem at 88% 88%, rgba(250,204,21,.22), transparent 62%),
    radial-gradient(30rem 30rem at 50% 50%, rgba(255,255,255,.5), transparent 70%);
  filter: blur(14px); }
.auth-card { position: relative; width: 100%; max-width: 384px; padding: 30px 30px 24px; border-radius: 24px;
  background: linear-gradient(160deg, var(--surface-strong), var(--surface)); box-shadow: var(--shadow-2); animation: page-in .35s var(--ease) both;
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); }
.auth-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-bottom: 22px; }
.auth-head .logo-tile { width: 76px; height: 76px; border-radius: 22px; margin-bottom: 14px; cursor: default; }
.auth-head .logo-tile svg { width: 44px; height: 44px; }
.auth-head .eyebrow { font: 700 .68rem var(--font); text-transform: uppercase; letter-spacing: .16em; color: var(--brand); }
.auth-head h1 { font-size: 1.2rem; }
.auth-head .sub { color: var(--muted); font-size: .86rem; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font: 650 .8rem var(--font); color: var(--ink-3); }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { width: 100%; min-height: 44px; }
.auth-card .muted { font-size: .82rem; }
.auth-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; font-size: .76rem; color: var(--faint); }
.auth-theme { position: fixed; top: calc(env(safe-area-inset-top) + 16px); right: 16px; }

/* ---------- Divers ---------- */
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.kbd { font: 600 .74rem var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-strong); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.cluster { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.space-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hide-mobile { display: none !important; }
@media (min-width: 900px) { .hide-mobile { display: initial !important; } .hide-desktop { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}
