/* =========================================================================
   FREECOM WIFI — interface inspirée de Mikhmon (barre du haut fixe, menu latéral
   repliable, tuiles colorées, cartes à en-tête), version moderne.
   Thèmes : dark (défaut, esprit Mikhmon), light, blue, green, pink, freecom.
   Icônes : Tabler Icons (MIT) · Graphiques : Chart.js (MIT) — hébergés localement.
   ========================================================================= */

/* ---------- Jetons communs ---------- */
:root {
  --brand: #2B5BA8;
  --accent: #8CC63F;
  --c-blue: #20a8d8;
  --c-green: #4dbd74;
  --c-yellow: #f9b115;
  --c-red: #f86c6b;
  --c-purple: #7c69ef;
  --c-cyan: #39c2d7;
  --ok: #3aa55d;
  --bad: #e5534b;
  --warn: #d68910;
  --info: #2d8fd5;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 56px;
  --side-w: 250px;
  --side-mini: 66px;
  --f-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --f-body: "Instrument Sans", "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

/* ---------- Thème sombre (Mikhmon) ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #2a3036;
  --bg-pattern: rgba(255, 255, 255, .025);
  --panel: #353c43;
  --panel-2: #2f353b;
  --line: #23282c;
  --line-soft: #2e3439;
  --hover: #3c444c;
  --text: #e4e7ea;
  --muted: #a3adb7;
  --faint: #7d8791;
  --input: #2b3137;
  --nav-bg: #3a4149;
  --nav-text: #e4e7ea;
  --side-bg: #3a4149;
  --side-text: #c8ced3;
  --side-group: #7f8a95;
  --side-hover: rgba(32, 168, 216, .16);
  --side-active: #20a8d8;
  --side-active-text: #fff;
  --primary: #20a8d8;
  --primary-text: #fff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 26px -18px rgba(0, 0, 0, .7);
  --hero: linear-gradient(135deg, #1b7fa6, #20a8d8);
}

/* ---------- Thème clair ---------- */
[data-theme="light"], [data-theme="blue"], [data-theme="green"], [data-theme="pink"], [data-theme="freecom"] {
  color-scheme: light;
  --bg: #eef1f4;
  --bg-pattern: rgba(20, 30, 50, .045);
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --line: #dde2e7;
  --line-soft: #edf0f3;
  --hover: #f3f6f9;
  --text: #1f2a37;
  --muted: #5f6b7a;
  --faint: #8b95a2;
  --input: #fbfcfd;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 10px 26px -18px rgba(20, 30, 50, .35);
}
[data-theme="light"] {
  --nav-bg: #ffffff;
  --nav-text: #2f353a;
  --side-bg: #ffffff;
  --side-text: #3c4650;
  --side-group: #97a1ab;
  --side-hover: rgba(32, 168, 216, .1);
  --side-active: #20a8d8;
  --side-active-text: #fff;
  --primary: #20a8d8;
  --primary-text: #fff;
  --hero: linear-gradient(135deg, #1b8fbf, #20a8d8);
}
[data-theme="blue"] {
  --nav-bg: #1d4f91;
  --nav-text: #fff;
  --side-bg: #173f74;
  --side-text: #d3e1f5;
  --side-group: #8aa6cd;
  --side-hover: rgba(255, 255, 255, .1);
  --side-active: #3b8beb;
  --side-active-text: #fff;
  --primary: #1f6fd1;
  --primary-text: #fff;
  --hero: linear-gradient(135deg, #173f74, #2b7de0);
}
[data-theme="green"] {
  --nav-bg: #2e7d4f;
  --nav-text: #fff;
  --side-bg: #256642;
  --side-text: #d6efdf;
  --side-group: #8fc4a3;
  --side-hover: rgba(255, 255, 255, .1);
  --side-active: #4dbd74;
  --side-active-text: #fff;
  --primary: #2f9a5a;
  --primary-text: #fff;
  --hero: linear-gradient(135deg, #256642, #3fae6a);
}
[data-theme="pink"] {
  --nav-bg: #b83280;
  --nav-text: #fff;
  --side-bg: #97266a;
  --side-text: #f8d9ea;
  --side-group: #e39cc5;
  --side-hover: rgba(255, 255, 255, .12);
  --side-active: #e83e8c;
  --side-active-text: #fff;
  --primary: #d63384;
  --primary-text: #fff;
  --hero: linear-gradient(135deg, #97266a, #e83e8c);
}
[data-theme="freecom"] {
  --nav-bg: #0B1730;
  --nav-text: #fff;
  --side-bg: #0e1d3b;
  --side-text: #c9d3e6;
  --side-group: #6479A3;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: var(--accent);
  --side-active-text: #0B1730;
  --primary: var(--brand);
  --primary-text: #fff;
  --hero: linear-gradient(135deg, #0B1730, var(--brand));
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--f-body);
  color: var(--text);
  background: radial-gradient(circle at 1px 1px, var(--bg-pattern) 1px, transparent 0) 0 0 / 22px 22px, var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--nav-h);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -.015em; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 700; }
code, .mono { font-family: var(--f-mono); }
code { background: var(--panel-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; font-size: .85em; }
.ti { line-height: 1; vertical-align: -0.12em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--primary) 35%, transparent); }

/* ---------- Barre du haut (Mikhmon) ---------- */
.navbar {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 60;
  display: flex; align-items: center; gap: 6px; padding: 0 12px;
  background: var(--nav-bg); color: var(--nav-text);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 2px 10px -6px rgba(0, 0, 0, .4);
}
.nav-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; text-decoration: none !important;
}
.nav-btn:hover { background: color-mix(in srgb, var(--nav-text) 12%, transparent); }
.nav-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; margin-left: 4px; min-width: 0; }
.nav-picto { width: 30px; height: auto; filter: drop-shadow(0 3px 8px rgba(140, 198, 63, .4)); }
.nav-logo { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.nav-brand strong { display: block; font-family: var(--f-display); font-size: 1rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.nav-brand small { display: block; font-size: .72rem; opacity: .7; }
.nav-spacer { flex: 1; }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; margin-right: 4px;
  background: var(--accent); color: #0B1730; font-weight: 700; font-size: .88rem; text-decoration: none !important;
  box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--accent) 80%, transparent);
}
.nav-cta:hover { filter: brightness(1.06); }
.nav-clock { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; opacity: .85; padding: 0 8px; font-variant-numeric: tabular-nums; }
.nav-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--c-red); color: #fff; font-size: .66rem; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--nav-bg); }
.nav-user { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 4px 6px; border-radius: 10px; font: inherit; text-align: left; }
.nav-user:hover { background: color-mix(in srgb, var(--nav-text) 10%, transparent); }
.nav-user strong { display: block; font-size: .85rem; line-height: 1.15; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user small { display: block; font-size: .7rem; opacity: .7; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--c-blue)); color: #0B1730; font-weight: 800; font-family: var(--f-display); flex: none; }

/* Menus déroulants */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; z-index: 70; display: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .55);
}
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text); font: 500 .9rem var(--f-body); cursor: pointer; text-decoration: none !important; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--hover); }
.dropdown-menu form { margin: 0; }
.dropdown-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 6px 10px 4px; font-weight: 700; }
.theme-opt.is-on { background: var(--hover); font-weight: 700; }
.swatch { width: 22px; height: 22px; border-radius: 7px; flex: none; border: 1px solid rgba(0, 0, 0, .15); }
.sw-dark { background: linear-gradient(135deg, #3a4149 50%, #20a8d8 50%); }
.sw-light { background: linear-gradient(135deg, #ffffff 50%, #20a8d8 50%); }
.sw-blue { background: linear-gradient(135deg, #1d4f91 50%, #3b8beb 50%); }
.sw-green { background: linear-gradient(135deg, #2e7d4f 50%, #4dbd74 50%); }
.sw-pink { background: linear-gradient(135deg, #b83280 50%, #e83e8c 50%); }
.sw-freecom { background: linear-gradient(135deg, #0B1730 50%, #8CC63F 50%); }

/* ---------- Menu latéral (repliable, façon Mikhmon) ---------- */
.sidenav {
  position: fixed; top: var(--nav-h); bottom: 0; left: 0; width: var(--side-w); z-index: 50;
  display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  transition: width .22s ease, transform .22s ease;
}
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 10px 16px; scrollbar-width: thin; }
.side-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--side-group); padding: 14px 10px 5px; font-weight: 700; white-space: nowrap; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 2px 0; border-radius: 9px;
  color: var(--side-text); font-weight: 500; font-size: .9rem; white-space: nowrap; transition: background .15s, color .15s;
}
.side-link:hover { background: var(--side-hover); color: inherit; text-decoration: none; }
.side-link.is-active { background: var(--side-active); color: var(--side-active-text); box-shadow: 0 6px 16px -10px var(--side-active); }
.side-link.is-cta:not(.is-active) { border: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent); }
.side-link .ico { width: 22px; text-align: center; flex: none; }
.pill-count { margin-left: auto; background: var(--c-red); color: #fff; font-size: .68rem; border-radius: 99px; padding: 1px 7px; }
.side-foot { padding: 10px 16px; font-size: .72rem; color: var(--side-group); border-top: 1px solid color-mix(in srgb, var(--side-text) 12%, transparent); white-space: nowrap; }

body.side-mini .sidenav { width: var(--side-mini); }
body.side-mini .side-txt, body.side-mini .side-group span, body.side-mini .pill-count { display: none; }
body.side-mini .side-group { padding: 8px 0 2px; border-top: 1px solid color-mix(in srgb, var(--side-text) 10%, transparent); margin-top: 6px; }
body.side-mini .side-link { justify-content: center; padding: 10px 0; }
body.side-mini .main { margin-left: var(--side-mini); }

.main { margin-left: var(--side-w); min-width: 0; transition: margin-left .22s ease; }
.page-head { display: flex; align-items: flex-end; gap: 14px; padding: 20px 26px 10px; flex-wrap: wrap; }
.page-title { flex: 1; min-width: 200px; }
.page-title h1 { font-size: clamp(1.35rem, 2.2vw, 1.8rem); font-weight: 800; }
.crumb { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 6px 26px 46px; display: grid; gap: 18px; animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.scrim { display: none; }

/* ---------- Bannières & messages ---------- */
.banner { margin: 0 26px 8px; padding: 10px 14px; border-radius: var(--radius-sm); display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.banner-info { background: color-mix(in srgb, var(--info) 14%, var(--panel)); color: color-mix(in srgb, var(--info) 70%, var(--text)); }
.banner-warn { background: color-mix(in srgb, var(--warn) 16%, var(--panel)); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.flashes { padding: 0 26px; display: grid; gap: 8px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 500; border-left: 4px solid; animation: rise .3s ease both; background: var(--panel); box-shadow: var(--shadow); }
.flash-success { border-color: var(--ok); color: color-mix(in srgb, var(--ok) 65%, var(--text)); }
.flash-error { border-color: var(--bad); color: color-mix(in srgb, var(--bad) 70%, var(--text)); }
.flash-info { border-color: var(--info); color: color-mix(in srgb, var(--info) 65%, var(--text)); }
.flash-warning { border-color: var(--warn); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }

/* ---------- Cartes (en-tête façon Mikhmon) ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; flex-wrap: wrap;
  background: var(--panel-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.card-h h2 { display: flex; align-items: center; gap: 8px; }
.card-h h2::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: var(--primary); flex: none; }
.card-h p { margin: 2px 0 0; color: var(--muted); font-size: .83rem; }
details.card > summary.card-h { list-style: none; }
details.card:not([open]) > summary.card-h { border-bottom: 0; border-radius: var(--radius); }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }

/* ---------- Tuiles statistiques (boîtes colorées Mikhmon) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(175px, 100%), 1fr)); gap: 14px; }
.kpi {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 13px; box-shadow: var(--shadow); animation: rise .4s ease both; color: var(--text); text-decoration: none !important; display: block;
}
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; } .kpi:nth-child(4) { animation-delay: .12s; } .kpi:nth-child(5) { animation-delay: .16s; } .kpi:nth-child(6) { animation-delay: .2s; }
.kpi-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.kpi-value { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.45rem, 2.4vw, 1.95rem); letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: .5em; opacity: .75; font-weight: 600; letter-spacing: 0; }
.kpi-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi-ico { position: absolute; right: 10px; bottom: 4px; font-size: 64px !important; opacity: .16; transform: rotate(-8deg); transition: transform .25s, opacity .25s; }
a.kpi:hover .kpi-ico { transform: rotate(0) scale(1.06); opacity: .26; }
a.kpi:hover { transform: translateY(-2px); transition: transform .15s; }
.kpi.is-hero, .kpi.c-blue, .kpi.c-green, .kpi.c-yellow, .kpi.c-red, .kpi.c-purple, .kpi.c-cyan { border-color: transparent; color: #fff; }
.kpi.is-hero .kpi-label, .kpi.is-hero .kpi-sub, .kpi[class*="c-"] .kpi-label, .kpi[class*="c-"] .kpi-sub { color: rgba(255, 255, 255, .85); }
.kpi.is-hero { background: var(--hero); }
.kpi.c-blue { background: linear-gradient(135deg, #1b8fbf, #20a8d8 60%, #4cc3ec); }
.kpi.c-green { background: linear-gradient(135deg, #36a15d, #4dbd74 60%, #72d196); }
.kpi.c-yellow { background: linear-gradient(135deg, #e09b00, #f9b115 60%, #ffcb52); }
.kpi.c-red { background: linear-gradient(135deg, #e04b4a, #f86c6b 60%, #ff9695); }
.kpi.c-purple { background: linear-gradient(135deg, #5b4bd1, #7c69ef 60%, #a193ff); }
.kpi.c-cyan { background: linear-gradient(135deg, #1ea5ba, #39c2d7 60%, #6fdbeb); }
.kpi-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Boîtes d'information (icône + texte, rangée du haut Mikhmon) */
.infoboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.infobox { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.infobox-ico { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.infobox-ico .ti { font-size: 28px !important; }
.infobox-txt { font-size: .85rem; line-height: 1.45; min-width: 0; }
.infobox-txt b { font-family: var(--f-display); font-size: 1.02rem; }
.bg-blue { background: var(--c-blue); } .bg-green { background: var(--c-green); } .bg-yellow { background: var(--c-yellow); }
.bg-red { background: var(--c-red); } .bg-purple { background: var(--c-purple); } .bg-cyan { background: var(--c-cyan); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: 600 .88rem var(--f-body); cursor: pointer; text-decoration: none !important;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s, filter .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 1px;
}
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); box-shadow: 0 6px 16px -10px var(--primary); }
.btn-primary:hover { filter: brightness(1.08); color: var(--primary-text); }
.btn-accent { background: var(--accent); color: #0B1730; border-color: var(--accent); box-shadow: 0 6px 16px -10px var(--accent); }
.btn-accent:hover { filter: brightness(1.06); color: #0B1730; border-color: var(--accent); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn[disabled], .btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--hover); }
form.inline { display: inline; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; gap: 13px 15px; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); }
.field { display: grid; gap: 5px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-all { grid-column: 1 / -1; }
.field label, .label { font-size: .78rem; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--input); color: var(--text); font: 500 .93rem var(--f-body);
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: .76rem; color: var(--faint); }
.field input[type=color] { padding: 3px; height: 40px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 15px; margin: 0; }
.fieldset legend { font-weight: 700; font-size: .82rem; padding: 0 6px; color: var(--muted); }
.choice-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.choice { position: relative; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 40px; cursor: pointer; background: var(--input); transition: border-color .15s, background .15s; display: block; }
.choice input { position: absolute; left: 14px; top: 15px; accent-color: var(--primary); }
.choice strong { display: block; font-size: .92rem; }
.choice span { font-size: .8rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--panel)); }
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* ---------- Filtres ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.card > .filters:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 140px; flex: 1 1 140px; max-width: 240px; }
.filters .field input, .filters .field select { padding: 7px 10px; font-size: .86rem; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; box-shadow: var(--shadow); }
.seg a { padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: .83rem; text-decoration: none; }
.seg a:hover { color: var(--text); }
.seg a.is-on { background: var(--primary); color: var(--primary-text); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .89rem; }
.t th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover td { background: var(--hover); }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t td.actions { text-align: right; white-space: nowrap; }
.t tfoot td { font-weight: 700; background: var(--panel-2); border-top: 1px solid var(--line); }
.code { font-family: var(--f-mono); font-weight: 700; letter-spacing: .04em; font-size: .87rem; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .ico { opacity: .35; display: block; margin: 0 auto 8px; }
.pager { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok, .s-online, .s-active, .s-completed, .s-done, .s-present { background: color-mix(in srgb, var(--ok) 17%, transparent); color: var(--ok); }
.b-bad, .s-offline, .s-cancelled, .s-suspended, .s-failed { background: color-mix(in srgb, var(--bad) 17%, transparent); color: var(--bad); }
.b-warn, .s-assigned, .s-past_due, .s-pending, .s-unconfirmed, .s-disabled, .s-error, .s-running { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.b-info, .s-sold, .s-trial { background: color-mix(in srgb, var(--info) 17%, transparent); color: var(--info); }
.s-available { background: color-mix(in srgb, var(--c-green) 15%, transparent); color: color-mix(in srgb, var(--c-green) 75%, var(--text)); }
.s-expired, .s-unknown, .s-removed, .s-absent { background: color-mix(in srgb, var(--faint) 16%, transparent); color: var(--faint); }
.sev-critical { background: var(--bad); color: #fff; }
.sev-warning { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.sev-info { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }

/* ---------- Graphiques ---------- */
.chart { width: 100%; min-height: 240px; position: relative; }
.chart canvas { width: 100% !important; height: 250px !important; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart .grid-l { stroke: var(--line-soft); stroke-dasharray: 3 4; }
.chart text { font: 600 10.5px var(--f-body); fill: var(--faint); }
.chart .bar { fill: var(--primary); }
.chart .bar.is-hover { fill: var(--accent); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.chart .area { fill: url(#area-grad); }
.chart-tip { position: absolute; pointer-events: none; background: #111827; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s; z-index: 3; }
.chart-tip.on { opacity: 1; }
.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.hbar-track { height: 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-soft); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transform-origin: left; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.hbar b { font-variant-numeric: tabular-nums; }

/* ---------- Routeurs ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c-green); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 10px; position: relative; overflow: hidden; }
.tile-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.tile-h h3 a { color: var(--text); }
.tile .sig { position: absolute; right: 12px; bottom: 6px; opacity: .08; }
.tile .sig .ti { font-size: 70px !important; }
.tile.is-offline { border-top-color: var(--c-red); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: .84rem; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: pulse 2s infinite; display: inline-block; }
.pulse.off { background: var(--bad); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Tickets (talons perforés) ---------- */
.stubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.stub { position: relative; background: #fff; color: #1f2a37; border: 1.5px dashed #c5ccd4; border-radius: 12px; padding: 12px 14px 12px 20px; overflow: hidden; break-inside: avoid; display: block; }
.stub::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--c, var(--brand)); }
.stub::after { content: ""; position: absolute; right: -9px; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 1.5px dashed #c5ccd4; transform: translateY(-50%); }
.stub-top { display: flex; justify-content: space-between; gap: 8px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.stub-offer { font-size: .8rem; color: #5f6b7a; }
.stub-code { font-family: var(--f-mono); font-weight: 700; font-size: 1.35rem; letter-spacing: .08em; color: #0B1730; margin: 4px 0 2px; }
.stub-pass { font-family: var(--f-mono); font-size: .9rem; }
.stub-meta { font-size: .72rem; color: #5f6b7a; }

/* ---------- Point de vente ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(min(300px, 100%), 1fr); gap: 18px; align-items: start; }
.offer-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(165px, 100%), 1fr)); gap: 10px; }
.offer-card { position: relative; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: var(--input); transition: transform .12s, border-color .12s, box-shadow .12s; display: grid; gap: 3px; }
.offer-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.offer-card input { position: absolute; opacity: 0; }
.offer-card::before { content: ""; height: 5px; border-radius: 99px; background: var(--c, var(--brand)); margin-bottom: 6px; }
.offer-card strong { font-family: var(--f-display); font-size: 1rem; }
.offer-card .price { font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; }
.offer-card .stock { font-size: .76rem; color: var(--muted); }
.offer-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.offer-card.is-empty { opacity: .45; cursor: not-allowed; }
.qty { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; width: fit-content; }
.qty button { width: 44px; border: 0; background: var(--panel-2); color: var(--text); font-size: 1.2rem; cursor: pointer; font-weight: 700; }
.qty input { width: 70px; text-align: center; border: 0; font: 700 1.2rem var(--f-display); padding: 8px 0; background: var(--input); color: var(--text); }
.total-box { background: var(--hero); color: #fff; border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.total-box .big { font-family: var(--f-display); font-weight: 800; font-size: 2.2rem; letter-spacing: -.03em; }
.total-box .ln { display: flex; justify-content: space-between; color: rgba(255, 255, 255, .8); font-size: .88rem; }

/* ---------- Vérification ---------- */
.verdict { border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; align-items: flex-start; border: 1px solid; background: var(--panel); }
.verdict h2 { font-size: 1.35rem; }
.verdict-valid { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.verdict-invalid { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--panel)); }
.verdict-unconfirmed { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, var(--panel)); }
.verdict .v-ico { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.verdict-valid .v-ico { background: var(--ok); } .verdict-invalid .v-ico { background: var(--bad); } .verdict-unconfirmed .v-ico { background: var(--warn); }

/* ---------- Chronologie ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 0 0 15px 22px; font-size: .87rem; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 19px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: .75rem; color: var(--faint); }

/* ---------- Script / code ---------- */
pre.script { background: #1b2026; color: #d7e3fa; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; font: 500 .8rem/1.6 var(--f-mono); white-space: pre; margin: 0; border: 1px solid #0f1317; }
pre.script .c { color: #7c93c0; }
.copy-wrap { position: relative; }
.copy-wrap pre.script { white-space: pre-wrap; word-break: break-all; padding-right: 90px; }
.copy-wrap .btn { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 10px; overflow-x: auto; background: var(--panel-2); border-radius: var(--radius) var(--radius) 0 0; }
.tabs a { padding: 11px 12px; color: var(--muted); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.is-on { color: var(--text); border-color: var(--primary); }

/* ---------- Dialogues ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(540px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(10, 14, 20, .55); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .16s ease both; }

/* ---------- Matrice de permissions ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .grp td { background: var(--panel-2); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- Pages publiques ---------- */
body.guest { padding-top: 0; background: #0B1730; }
.guest-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.guest-hero { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
  background: radial-gradient(90% 70% at 20% 10%, rgba(43, 91, 168, .55), transparent 60%), radial-gradient(60% 60% at 90% 90%, rgba(140, 198, 63, .25), transparent 60%), #0B1730; }
.waves { position: absolute; left: 50%; top: 42%; }
.waves span { position: absolute; left: 50%; top: 50%; border: 1.5px solid rgba(140, 198, 63, .35); border-radius: 50%; transform: translate(-50%, -50%); animation: wave 5s linear infinite; opacity: 0; }
.waves span:nth-child(2) { animation-delay: 1.25s; } .waves span:nth-child(3) { animation-delay: 2.5s; } .waves span:nth-child(4) { animation-delay: 3.75s; }
@keyframes wave { 0% { width: 60px; height: 60px; opacity: .9; } 100% { width: 760px; height: 760px; opacity: 0; } }
.hero-picto { position: absolute; left: 50%; top: 42%; width: 120px; transform: translate(-50%, -50%); filter: drop-shadow(0 12px 40px rgba(140, 198, 63, .5)); }
.hero-copy { position: relative; max-width: 520px; }
.hero-copy h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); font-weight: 800; line-height: 1.05; }
.hero-copy ul { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; color: #b7c5e2; }
.hero-copy li::before { content: "▸ "; color: #8CC63F; }
.eyebrow { font-weight: 800; letter-spacing: .24em; font-size: .74rem; color: var(--accent); margin: 0 0 10px; }
.guest-panel { background: var(--bg); padding: 56px clamp(24px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.guest-panel h1 { font-size: 2rem; font-weight: 800; }
.guest-panel .sub { color: var(--muted); margin: 6px 0 16px; }
.guest-form { display: grid; gap: 14px; max-width: 440px; }
.demo-box { max-width: 440px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: .84rem; color: var(--muted); background: var(--panel); }
.guest .flash { max-width: 440px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .pos { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidenav { transform: translateX(-100%); width: var(--side-w) !important; box-shadow: 20px 0 40px -20px rgba(0, 0, 0, .5); }
  body.side-open .sidenav { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: var(--nav-h) 0 0 0; background: rgba(10, 14, 20, .5); z-index: 45; }
  body.side-mini .side-txt, body.side-mini .side-group span { display: inline; }
  body.side-mini .side-link { justify-content: flex-start; padding: 9px 10px; }
  .main, body.side-mini .main { margin-left: 0; }
  .page-head { padding: 14px 16px 8px; }
  .content { padding: 6px 16px 40px; }
  .flashes { padding: 0 16px; }
  .banner { margin: 0 16px 8px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .nav-clock, .nav-user-txt { display: none; }
  .guest-wrap { grid-template-columns: minmax(0, 1fr); }
  .guest-hero { min-height: 230px; padding: 26px; }
  .hero-copy ul { display: none; }
  .guest-panel { padding: 30px 18px; }
}
@media (max-width: 620px) {
  .nav-brand small, .nav-cta span { display: none; }
  .nav-brand strong { max-width: 130px; }
  .nav-cta { padding: 0 11px; }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 1.35rem; }
  .field.span-2 { grid-column: auto; }
  .card-h, .card-b { padding-left: 14px; padding-right: 14px; }
  .filters { padding: 10px 14px; }
  .filters .field { max-width: none; }
  table.t.stack-sm thead { display: none; }
  table.t.stack-sm, .t.stack-sm tbody, .t.stack-sm tr, .t.stack-sm td { display: block; width: 100%; }
  .t.stack-sm tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  .t.stack-sm td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .t.stack-sm td::before { content: attr(data-l); font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: left; }
  .t.stack-sm td.actions { justify-content: flex-end; }
  .t.stack-sm td.actions::before, .t.stack-sm td:not([data-l])::before { content: none; }
  .page-actions { width: 100%; }
}

/* ---------- Impression ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff !important; padding: 0; }
  .navbar, .sidenav, .page-head, .flashes, .banner, .no-print, .scrim { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; animation: none; }
  .card { box-shadow: none; border: 0; }
  .stubs { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stub { padding: 8px 10px 8px 16px; }
  .stub::after { background: #fff; }
  .stub-code { font-size: 1.05rem; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.kpis-tight { grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)); gap: 12px; }
.kpis-tight .kpi-value { font-size: clamp(1.3rem, 2vw, 1.7rem); }
@media (max-width: 620px) {
  .offer-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .navbar { gap: 2px; padding: 0 6px; }
  .nav-btn { width: 36px; }
  .nav-brand strong { max-width: 110px; }
  .pos aside { position: static !important; }
  .hbar { grid-template-columns: minmax(70px, 110px) 1fr auto; font-size: .8rem; }
}
