/* ============================================================
   DUSK v2 — Thème sombre dense, orienté produit / SaaS
   Accent : Violet doux #A78BFA · UI : Geist · Data : JetBrains Mono
   Base : 14px · Compact mais user-friendly
   Compatible mobile (breakpoints 480 / 768 / 1024)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Geist:wght@300;400;500;600;700&display=swap');

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  /* Fonds — ~10% plus clairs que v2, teinte slate froide */
  --bg-0:      #141417;
  --bg-1:      #1a1a1e;
  --bg-2:      #212126;
  --bg-3:      #28282e;
  --bg-4:      #303037;
  --bg-hover:  #36363e;

  /* Bordures */
  --b0:        #272730;
  --b1:        #33333d;
  --b2:        #424250;
  --b3:        #555565;

  /* Accent principal — violet doux */
  --amber:     #A78BFA;          /* alias conservé pour compatibilité classes */
  --amber-dim: rgba(167,139,250,0.08);
  --amber-mid: rgba(167,139,250,0.16);
  --amber-glow:0 0 12px rgba(167,139,250,0.30);

  /* Couleurs sémantiques */
  --ok:      #34D399;
  --ok-dim:  rgba(52,211,153,0.10);
  --warn:    #FBBF24;
  --warn-dim:rgba(251,191,36,0.10);
  --err:     #F87171;
  --err-dim: rgba(248,113,113,0.10);
  --info:    #60A5FA;
  --info-dim:rgba(96,165,250,0.10);
  --muted:   #888898;

  /* Texte — légèrement plus lumineux grâce aux fonds plus clairs */
  --t1: #F0F0F5;
  --t2: #9090A8;
  --t3: #5a5a70;
  --t-amber: #A78BFA;

  /* Typo : UI = Geist, données = JetBrains Mono */
  --ui:   'Geist', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --cond: 'Geist', system-ui, sans-serif; /* rétrocompat */

  /* Tailles — base 14px, plus lisible */
  --f10: 10px;
  --f11: 11px;
  --f12: 12px;
  --f13: 13px;
  --f14: 14px;  /* base UI */
  --f15: 15px;
  --f16: 16px;
  --f18: 18px;
  --f22: clamp(18px, 2.5vw, 22px);
  --f28: clamp(22px, 3.5vw, 30px);
  --f36: clamp(26px, 4.5vw, 38px);

  /* Espacement — plus respirant */
  --g1: 2px;   --g2: 4px;   --g3: 8px;
  --g4: 10px;  --g5: 14px;  --g6: 16px;
  --g8: 20px;  --g10: 24px; --g12: 32px;
  --g16: 40px; --g20: 48px;

  /* Rayons — produit, pas terminal */
  --r0: 0;
  --r1: 6px;
  --r2: 8px;
  --r3: 10px;

  /* Layout */
  --nav-h:    48px;
  --side-w:   220px;

  /* Transitions */
  --tf: 100ms ease;
  --tn: 180ms ease;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--f12);
  scroll-behavior: smooth;
  scrollbar-color: var(--bg-3) var(--bg-0);
  scrollbar-width: thin;
}
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); }
::-webkit-scrollbar-thumb:hover { background: var(--b3); }

body {
  font-family: var(--ui);
  font-size: var(--f14);
  font-weight: 400;
  line-height: 1.55;
  color: var(--t1);
  background: var(--bg-0);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typographie ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ui);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--t1);
}

h1 { font-size: var(--f36); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--f28); }
h3 { font-size: var(--f22); }
h4 { font-size: var(--f18); }
h5 { font-size: var(--f14); font-weight: 600; }
h6 { font-size: var(--f13); font-weight: 600; }

p  { color: var(--t2); line-height: 1.65; font-size: var(--f14); }

a  { color: var(--amber); text-decoration: none; transition: color var(--tf); }
a:hover { color: #b99ffb; text-decoration: underline; text-underline-offset: 2px; }

code, kbd { font-family: var(--mono); font-size: 0.9em; }

/* Label section — plus doux, pas tout caps */
.label {
  font-family: var(--ui);
  font-size: var(--f11);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--t3);
}

.val {
  font-family: var(--mono);
  font-size: var(--f13);
  font-weight: 500;
  color: var(--t1);
}

.val-amber { color: var(--amber); }
.val-ok    { color: var(--ok); }
.val-warn  { color: var(--warn); }
.val-err   { color: var(--err); }
.val-info  { color: var(--info); }

/* ─── Layout ─────────────────────────────────────────────── */
.page { display: flex; flex-direction: column; min-height: 100svh; }

.main-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

.content {
  flex: 1;
  padding: var(--g6);
  min-width: 0;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .content { padding: var(--g8) var(--g10); }
}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: center;
  padding: 0 var(--g6);
  gap: var(--g6);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.nav-brand {
  font-family: var(--ui);
  font-size: var(--f14);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--amber);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--g3);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand:hover { color: #b99ffb; text-decoration: none; }

/* Indicateur d'état live */
.nav-live {
  display: flex;
  align-items: center;
  gap: var(--g2);
  font-size: var(--f11);
  font-family: var(--ui);
  font-weight: 500;
  color: var(--ok);
}

.live-dot {
  width: 6px; height: 6px;
  background: var(--ok);
  border-radius: 50%;
  animation: blink 1.4s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--g1);
  list-style: none;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-menu a {
  display: flex;
  align-items: center;
  gap: var(--g2);
  padding: var(--g2) var(--g4);
  font-family: var(--ui);
  font-size: var(--f13);
  font-weight: 500;
  color: var(--t2);
  border: 1px solid transparent;
  border-radius: var(--r1);
  white-space: nowrap;
  transition: all var(--tf);
  text-decoration: none;
}

.nav-menu a:hover { color: var(--t1); background: var(--bg-3); text-decoration: none; }
.nav-menu a.active { color: var(--amber); border-color: var(--b2); background: var(--bg-2); }

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--g3);
  margin-left: auto;
  flex-shrink: 0;
}

.nav-clock {
  font-size: var(--f11);
  color: var(--t3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--g2);
}
.nav-toggle span {
  display: block; width: 18px; height: 1.5px;
  background: var(--t2); border-radius: 1px;
  transition: all var(--tn);
}

@media (max-width: 767px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--bg-1);
    border-bottom: 1px solid var(--b1);
    flex-direction: column;
    align-items: stretch;
    padding: var(--g3);
    gap: var(--g1);
    overflow-x: visible;
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { justify-content: flex-start; }
  .nav-clock { display: none; }
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--b1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: var(--nav-h);
  height: calc(100svh - var(--nav-h));
}

.side-section {
  padding: var(--g5) var(--g4) var(--g3);
  border-bottom: 1px solid var(--b0);
}

.side-section:last-child { border-bottom: none; }

.side-label {
  font-family: var(--ui);
  font-size: var(--f11);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--t3);
  padding: 0 var(--g3) var(--g3);
  display: block;
}

.side-nav { list-style: none; }

.side-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--g2) var(--g3);
  font-family: var(--ui);
  font-size: var(--f13);
  font-weight: 400;
  color: var(--t2);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all var(--tf);
  gap: var(--g3);
}

.side-nav a:hover { color: var(--t1); background: var(--bg-3); text-decoration: none; }

.side-nav a.active {
  color: var(--amber);
  border-left-color: var(--amber);
  background: var(--amber-dim);
}

.side-nav .side-icon {
  width: 14px; height: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}

.side-nav a.active .side-icon { opacity: 1; }

.side-nav .side-count {
  font-size: var(--f10);
  font-family: var(--cond);
  font-weight: 700;
  color: var(--t3);
  margin-left: auto;
}

/* Statut système en bas */
.side-status {
  margin-top: auto;
  border-top: 1px solid var(--b1);
  padding: var(--g4);
  display: flex;
  flex-direction: column;
  gap: var(--g3);
}

.sys-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--f11);
}

.sys-bar {
  height: 2px;
  background: var(--bg-3);
  border-radius: 1px;
  overflow: hidden;
}

.sys-bar-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 1px;
  transition: width 0.5s ease;
}

.sys-bar-fill.ok   { background: var(--ok); }
.sys-bar-fill.warn { background: var(--warn); }
.sys-bar-fill.err  { background: var(--err); }

@media (max-width: 1023px) {
  .sidebar { display: none; }
}

/* ─── Panel / Card ───────────────────────────────────────── */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--b1);
  border-radius: var(--r1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--g3) var(--g5);
  border-bottom: 1px solid var(--b1);
  gap: var(--g4);
  min-height: 32px;
}

.panel-title {
  font-family: var(--ui);
  font-size: var(--f13);
  font-weight: 600;
  color: var(--t1);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--g3);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: var(--g2);
  flex-shrink: 0;
}

.panel-body { padding: var(--g6); }
.panel-body-tight { padding: 0; }

.panel-foot {
  padding: var(--g3) var(--g5);
  border-top: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--f11);
  color: var(--t3);
  min-height: 28px;
}

/* Panel accent amber */
.panel-amber {
  border-color: rgba(240,165,0,0.25);
}
.panel-amber .panel-head {
  border-bottom-color: rgba(240,165,0,0.15);
  background: var(--amber-dim);
}

/* Panel err */
.panel-err { border-color: rgba(255,51,51,0.25); }
.panel-err .panel-head {
  border-bottom-color: rgba(255,51,51,0.15);
  background: var(--err-dim);
}

/* ─── Stat (compact) ─────────────────────────────────────── */
.stat {
  background: var(--bg-1);
  border: 1px solid var(--b1);
  border-radius: var(--r1);
  padding: var(--g4) var(--g5);
  position: relative;
}

.stat::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--amber);
  opacity: 0;
  transition: opacity var(--tn);
}

.stat:hover::after { opacity: 1; }

.stat .s-label {
  font-family: var(--ui);
  font-size: var(--f11);
  font-weight: 500;
  color: var(--t3);
  margin-bottom: var(--g2);
}

.stat .s-val {
  font-family: var(--mono);
  font-size: var(--f28);
  font-weight: 600;
  line-height: 1;
  color: var(--t1);
  margin-bottom: var(--g2);
  font-variant-numeric: tabular-nums;
}

.stat .s-delta {
  font-size: var(--f11);
  display: flex;
  align-items: center;
  gap: var(--g1);
  color: var(--t3);
}

.stat .s-delta.up   { color: var(--ok); }
.stat .s-delta.down { color: var(--err); }
.stat .s-delta.neutral { color: var(--warn); }

/* ─── Grid dense ─────────────────────────────────────────── */
.g2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--g4); }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--g4); }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--g4); }
.ga { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: var(--g4); }

@media (max-width: 599px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .g3, .g4 { grid-template-columns: repeat(2,1fr); }
}

.row   { display: flex; gap: var(--g4); flex-wrap: wrap; align-items: flex-start; }
.row.c { align-items: center; }
.col   { display: flex; flex-direction: column; gap: var(--g3); }
.ml    { margin-left: auto; }
.mb4   { margin-bottom: var(--g4); }
.mb6   { margin-bottom: var(--g6); }
.mb8   { margin-bottom: var(--g8); }
.w100  { width: 100%; }
.flex1 { flex: 1; min-width: 0; }
.gap2  { gap: var(--g2); }
.gap3  { gap: var(--g3); }
.gap4  { gap: var(--g4); }

/* ─── Boutons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--g3);
  padding: 0 var(--g6);
  height: 34px;
  font-family: var(--ui);
  font-size: var(--f14);
  font-weight: 500;
  border: 1px solid var(--b2);
  border-radius: var(--r1);
  background: var(--bg-2);
  color: var(--t2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--tf);
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover { background: var(--bg-4); color: var(--t1); border-color: var(--b3); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.btn-amber {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
  font-weight: 600;
}
.btn-amber:hover {
  background: #b99ffb;
  border-color: #b99ffb;
  box-shadow: var(--amber-glow);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--amber);
  border-color: rgba(167,139,250,0.35);
}
.btn-outline:hover {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: var(--amber);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--t2); }
.btn-ghost:hover { background: var(--bg-3); border-color: transparent; color: var(--t1); }

.btn-err { background: transparent; color: var(--err); border-color: rgba(248,113,113,0.3); }
.btn-err:hover { background: var(--err-dim); border-color: var(--err); color: var(--err); }

.btn-ok { background: transparent; color: var(--ok); border-color: rgba(52,211,153,0.3); }
.btn-ok:hover { background: var(--ok-dim); border-color: var(--ok); color: var(--ok); }

/* Tailles */
.btn-xs { height: 24px; padding: 0 var(--g3); font-size: var(--f12); }
.btn-sm { height: 28px; padding: 0 var(--g4); font-size: var(--f13); }
.btn-lg { height: 40px; padding: 0 var(--g8); font-size: var(--f15); }
.btn-sq { padding: 0; width: 34px; justify-content: center; }
.btn-sq.btn-sm { width: 28px; height: 28px; }
.btn-sq.btn-xs { width: 24px; height: 24px; }

/* ─── Badges ─────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--g2);
  padding: 0 var(--g3);
  height: 20px;
  font-family: var(--ui);
  font-size: var(--f11);
  font-weight: 500;
  border-radius: var(--r1);
  white-space: nowrap;
}

.tag::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tag-amber { background: var(--amber-mid); color: var(--amber); border: 1px solid rgba(240,165,0,0.3); }
.tag-ok    { background: var(--ok-dim);    color: var(--ok);    border: 1px solid rgba(0,204,102,0.25); }
.tag-warn  { background: var(--warn-dim);  color: var(--warn);  border: 1px solid rgba(255,149,0,0.25); }
.tag-err   { background: var(--err-dim);   color: var(--err);   border: 1px solid rgba(255,51,51,0.25); }
.tag-info  { background: var(--info-dim);  color: var(--info);  border: 1px solid rgba(51,153,255,0.25); }
.tag-muted { background: var(--bg-3);      color: var(--t3);    border: 1px solid var(--b2); }

.tag.no-dot::before { display: none; }

/* Dot seul */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-ok    { background: var(--ok); }
.dot-warn  { background: var(--warn); animation: blink 1.4s infinite; }
.dot-err   { background: var(--err); animation: blink 0.8s infinite; }
.dot-amber { background: var(--amber); }
.dot-muted { background: var(--t3); }

/* ─── Tables ─────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--b1);
  border-radius: var(--r2);
  background: var(--bg-1);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--f12);
}

thead th {
  padding: var(--g2) var(--g4);
  text-align: left;
  font-family: var(--ui);
  font-size: var(--f11);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--t3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--b1);
  white-space: nowrap;
}

thead th:first-child { padding-left: var(--g5); }
thead th:last-child  { padding-right: var(--g5); text-align: right; }

tbody tr {
  border-bottom: 1px solid var(--b0);
  transition: background var(--tf);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-2); }

td {
  padding: var(--g2) var(--g4);
  color: var(--t2);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td:first-child { padding-left: var(--g5); color: var(--t1); font-weight: 500; }
td:last-child  { padding-right: var(--g5); text-align: right; }

/* Ligne sélectionnée / alerte */
tbody tr.row-warn { background: rgba(255,149,0,0.04); border-left: 2px solid var(--warn); }
tbody tr.row-err  { background: rgba(255,51,51,0.04);  border-left: 2px solid var(--err);  }
tbody tr.row-ok   { background: rgba(0,204,102,0.04); }

/* ─── Formulaires ────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--g2);
  margin-bottom: var(--g4);
}

.field-label {
  font-family: var(--ui);
  font-size: var(--f13);
  font-weight: 500;
  color: var(--t2);
}

.field-label.req::after { content: ' *'; color: var(--err); }

.field-hint  { font-size: var(--f10); color: var(--t3); }
.field-error { font-size: var(--f10); color: var(--err); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
textarea,
select {
  width: 100%;
  height: 34px;
  padding: 0 var(--g4);
  background: var(--bg-2);
  border: 1px solid var(--b2);
  border-radius: var(--r1);
  font-family: var(--ui);
  font-size: var(--f14);
  color: var(--t1);
  outline: none;
  transition: border-color var(--tf), box-shadow var(--tf);
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--t3); }
input:hover, textarea:hover, select:hover  { border-color: var(--b3); }

input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-dim);
  background: var(--bg-3);
}

input.ok    { border-color: rgba(0,204,102,0.5); }
input.ok:focus    { box-shadow: 0 0 0 2px var(--ok-dim); }
input.error { border-color: rgba(255,51,51,0.5); }
input.error:focus { box-shadow: 0 0 0 2px var(--err-dim); }

textarea { height: auto; padding: var(--g3); resize: vertical; min-height: 72px; line-height: 1.5; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  cursor: pointer;
}

/* Input group */
.input-row {
  display: flex;
  align-items: stretch;
}
.input-row input  { border-radius: var(--r1) 0 0 var(--r1); flex: 1; }
.input-row .btn   { border-radius: 0 var(--r1) var(--r1) 0; border-left: none; height: 28px; }

/* Input avec préfixe texte */
.input-prefix {
  display: flex;
  align-items: stretch;
}
.prefix-label {
  display: flex;
  align-items: center;
  padding: 0 var(--g3);
  background: var(--bg-3);
  border: 1px solid var(--b2);
  border-right: none;
  border-radius: var(--r1) 0 0 var(--r1);
  font-size: var(--f11);
  color: var(--t3);
  white-space: nowrap;
}
.input-prefix input { border-radius: 0 var(--r1) var(--r1) 0; }

/* Checkbox / Radio compacts */
.check {
  display: flex;
  align-items: center;
  gap: var(--g3);
  cursor: pointer;
  font-size: var(--f12);
  color: var(--t2);
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
  transition: color var(--tf);
}
.check:hover { color: var(--t1); }

.check input[type="checkbox"],
.check input[type="radio"] {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; flex-shrink: 0;
  border: 1px solid var(--b3);
  background: var(--bg-2);
  cursor: pointer;
  position: relative;
  transition: all var(--tf);
}
.check input[type="checkbox"] { border-radius: var(--r1); }
.check input[type="radio"]    { border-radius: 50%; }

.check input:checked {
  background: var(--amber);
  border-color: var(--amber);
}
.check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 5px; height: 8px;
  border: 1.5px solid #000;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.check input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: #000;
  border-radius: 50%;
}

/* Toggle compact */
.toggle { display: flex; align-items: center; gap: var(--g3); cursor: pointer; -webkit-user-select: none; user-select: none; }
.toggle input { display: none; }
.toggle-rail {
  width: 32px; height: 16px;
  background: var(--bg-4);
  border: 1px solid var(--b2);
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
  transition: all var(--tn);
}
.toggle-rail::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  background: var(--t3);
  border-radius: 50%;
  transition: all 200ms cubic-bezier(0.34,1.56,0.64,1);
}
.toggle input:checked ~ .toggle-rail {
  background: var(--amber-dim);
  border-color: var(--amber);
}
.toggle input:checked ~ .toggle-rail::after {
  transform: translateX(16px);
  background: var(--amber);
}
.toggle-txt { font-size: var(--f12); color: var(--t2); }

/* Range */
input[type="range"] {
  height: 3px; width: 100%;
  -webkit-appearance: none; appearance: none;
  background: var(--bg-4);
  border-radius: 2px;
  outline: none; cursor: pointer;
  border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: var(--amber-glow);
  transition: transform var(--tf);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* ─── Progress ───────────────────────────────────────────── */
.bar {
  height: 3px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--amber);
  transition: width 0.4s ease;
}
.bar-fill.ok   { background: var(--ok); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.err  { background: var(--err); }
.bar.thick { height: 6px; }
.bar.thin  { height: 2px; }

/* ─── Tabs compacts ──────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--b1);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--g3) var(--g5);
  font-family: var(--ui);
  font-size: var(--f13);
  font-weight: 500;
  color: var(--t3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--tf);
  margin-bottom: -1px;
}
.tab:hover { color: var(--t2); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); font-weight: 600; }

.tab-panel { display: none; padding-top: var(--g5); }
.tab-panel.active { display: block; }

/* ─── Alertes compactes ──────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--g3);
  padding: var(--g3) var(--g4);
  border: 1px solid transparent;
  border-radius: var(--r1);
  font-size: var(--f12);
  line-height: 1.5;
  border-left-width: 3px;
  margin-bottom: var(--g4);
}
.alert-ok   { background: var(--ok-dim);   border-color: rgba(0,204,102,0.2);  border-left-color: var(--ok);   color: var(--ok); }
.alert-warn { background: var(--warn-dim); border-color: rgba(255,149,0,0.2);  border-left-color: var(--warn); color: var(--warn); }
.alert-err  { background: var(--err-dim);  border-color: rgba(255,51,51,0.2);  border-left-color: var(--err);  color: var(--err); }
.alert-info { background: var(--info-dim); border-color: rgba(51,153,255,0.2); border-left-color: var(--info); color: var(--info); }
.alert strong { color: inherit; font-family: var(--cond); font-size: var(--f13); letter-spacing: 0.04em; text-transform: uppercase; }
.alert p { color: inherit; opacity: 0.8; font-size: var(--f11); margin-top: 2px; }

/* ─── Log / Terminal ─────────────────────────────────────── */
.logbox {
  background: var(--bg-0);
  border: 1px solid var(--b1);
  border-radius: var(--r2);
  font-family: var(--mono);
  font-size: var(--f11);
  line-height: 1.6;
  overflow: auto;
  max-height: 280px;
  padding: var(--g4);
}

.log-line {
  display: flex;
  gap: var(--g4);
  padding: 1px 0;
  transition: background var(--tf);
  white-space: nowrap;
}
.log-line:hover { background: var(--bg-2); margin: 0 calc(-1*var(--g4)); padding: 1px var(--g4); }

.log-ts   { color: var(--t3); flex-shrink: 0; }
.log-lvl  { width: 48px; flex-shrink: 0; text-align: center; font-family: var(--cond); font-weight: 700; font-size: var(--f10); }
.log-src  { color: var(--amber); flex-shrink: 0; }
.log-msg  { color: var(--t2); overflow: hidden; text-overflow: ellipsis; }

.log-lvl.info  { color: var(--info); }
.log-lvl.ok    { color: var(--ok); }
.log-lvl.warn  { color: var(--warn); }
.log-lvl.err   { color: var(--err); }

/* ─── Code inline ────────────────────────────────────────── */
code:not([class]) {
  font-family: var(--mono);
  font-size: 0.95em;
  color: var(--amber);
  background: var(--amber-dim);
  padding: 0 var(--g2);
  border-radius: var(--r1);
}

pre {
  background: var(--bg-0);
  border: 1px solid var(--b1);
  border-radius: var(--r2);
  padding: var(--g5);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: var(--f11);
  line-height: 1.65;
  color: var(--t2);
}
pre code { background: none; color: inherit; padding: 0; }

/* ─── Kbd ────────────────────────────────────────────────── */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--g2);
  height: 18px;
  background: var(--bg-3);
  border: 1px solid var(--b3);
  border-bottom-width: 2px;
  border-radius: var(--r1);
  font-family: var(--mono);
  font-size: var(--f10);
  color: var(--t2);
}

/* ─── Breadcrumb ─────────────────────────────────────────── */
.crumb {
  display: flex;
  align-items: center;
  gap: var(--g2);
  font-family: var(--cond);
  font-size: var(--f11);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t3);
  list-style: none;
  margin-bottom: var(--g6);
  flex-wrap: wrap;
}
.crumb li + li::before { content: '/'; opacity: 0.4; margin-right: var(--g2); }
.crumb a { color: var(--t2); text-decoration: none; }
.crumb a:hover { color: var(--amber); text-decoration: none; }
.crumb .active { color: var(--t1); }

/* ─── Separator ──────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--b1);
  margin: var(--g5) 0;
}

.sep-amber {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, var(--amber), transparent);
  margin: var(--g5) 0;
}

/* ─── Pagination compacte ────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  gap: var(--g2);
  list-style: none;
  flex-wrap: wrap;
}
.pager a, .pager button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  font-family: var(--cond);
  font-size: var(--f11);
  font-weight: 600;
  color: var(--t2);
  background: var(--bg-2);
  border: 1px solid var(--b1);
  border-radius: var(--r1);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--tf);
}
.pager a:hover, .pager button:hover { color: var(--t1); border-color: var(--b3); text-decoration: none; }
.pager .cur a  { background: var(--amber); color: #000; border-color: var(--amber); font-weight: 700; }
.pager .dis a  { opacity: 0.25; cursor: not-allowed; pointer-events: none; }

/* ─── Tooltip ────────────────────────────────────────────── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-4);
  border: 1px solid var(--b2);
  color: var(--t1);
  font-size: var(--f10);
  font-family: var(--cond);
  letter-spacing: 0.04em;
  padding: var(--g2) var(--g3);
  border-radius: var(--r1);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tf);
  z-index: 50;
}
[data-tip]:hover::after { opacity: 1; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: var(--g6);
  animation: fadein 150ms ease;
}
@keyframes fadein { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--bg-1);
  border: 1px solid var(--b2);
  border-radius: var(--r2);
  width: 100%;
  max-width: 480px;
  max-height: 90svh;
  overflow-y: auto;
  animation: slideup 180ms cubic-bezier(0.34,1.4,0.64,1);
}
@keyframes slideup { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--g4) var(--g6);
  border-bottom: 1px solid var(--b1);
  background: var(--bg-2);
}
.modal-title {
  font-family: var(--ui);
  font-size: var(--f14);
  font-weight: 600;
  color: var(--t1);
}
.modal-close {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--b2);
  border-radius: var(--r1);
  color: var(--t2);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: all var(--tf);
}
.modal-close:hover { background: var(--err-dim); color: var(--err); }

.modal-body   { padding: var(--g5) var(--g6); }
.modal-foot   {
  padding: var(--g4) var(--g6);
  border-top: 1px solid var(--b1);
  display: flex; justify-content: flex-end;
  gap: var(--g3);
}

/* ─── Toast ──────────────────────────────────────────────── */
.toasts {
  position: fixed;
  bottom: var(--g5);
  right: var(--g5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--g3);
  max-width: 320px;
  width: calc(100% - var(--g10));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--g3);
  padding: var(--g3) var(--g4);
  background: var(--bg-2);
  border: 1px solid var(--b2);
  border-left: 3px solid transparent;
  border-radius: var(--r2);
  font-size: var(--f12);
  animation: toastin 200ms cubic-bezier(0.34,1.4,0.64,1);
}
@keyframes toastin { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

.toast-ok   { border-left-color: var(--ok); }
.toast-err  { border-left-color: var(--err); }
.toast-warn { border-left-color: var(--warn); }
.toast-info { border-left-color: var(--info); }

.toast-title { font-family: var(--ui); font-size: var(--f13); font-weight: 600; color: var(--t1); }
.toast-msg   { font-size: var(--f12); color: var(--t2); margin-top: 1px; }

/* ─── Skeleton ───────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  border-radius: var(--r1);
  animation: skelwave 1.4s infinite;
}
@keyframes skelwave { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ─── Utilitaires ────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mono     { font-family: var(--mono); }
.cond     { font-family: var(--cond); }
.text-amber { color: var(--amber); }
.text-ok    { color: var(--ok); }
.text-warn  { color: var(--warn); }
.text-err   { color: var(--err); }
.text-muted { color: var(--t2); }
.text-dim   { color: var(--t3); }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.tabular    { font-variant-numeric: tabular-nums; }
.upper      { text-transform: uppercase; letter-spacing: 0.06em; }
.cursor-pointer { cursor: pointer; }

:focus-visible { outline: 1px solid var(--amber); outline-offset: 1px; }

@media print {
  body { background: white; color: black; }
  .navbar, .sidebar { display: none; }
}
