/* ════════════════════════════════════════════════════════════════
   DESIGN TOKENS — v2
   Dark theme par défaut + light theme via [data-theme="light"]
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Scale */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius:    10px;
  --radius-lg: 14px;

  --sidebar-w: 300px;
  --panel-w:   360px;
  --nav-h:     56px;
  --footer-h:  36px;

  /* Source colours — identiques entre thèmes */
  --src-meshmap:    #3b82f6;
  --src-liamcottle: #f97066;
  --src-gaulix:     #22c55e;

  /* Role colours — identiques entre thèmes */
  --role-router:   #7d56c2;
  --role-repeater: #2d81d6;
  --role-client:   #64748b;
  --role-tracker:  #d29922;
  --role-sensor:   #39a3c7;
}

/* ── Thème sombre (défaut) ───────────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg:            #0d1117;
  --bg-elevated:   #161b22;
  --sidebar-bg:    #161b22;
  --panel-bg:      #1c2128;
  --surface:       #21262d;
  --surface-hover: #2d333b;
  --surface-2:     #21262d;
  --surface-3:     #2d333b;
  --surface-4:     #373e47;

  --border:        #30363d;
  --border-strong: #444c56;
  --border-light:  #21262d;

  --text:          #e6edf3;
  --text-muted:    #8b949e;
  --text-dim:      #484f58;

  --accent:        #58a6ff;
  --accent-hover:  #79b8ff;
  --accent-contrast:#0d1117;
  --accent-soft:   rgba(88,166,255,0.12);
  --accent-ring:   rgba(88,166,255,0.35);
  --accent-glow:   rgba(88,166,255,0.20);

  --st-online:  #3fb950;
  --st-recent:  #d29922;
  --st-offline: #6e7681;
  --st-unknown: #3d444d;
  --st-danger:  #f85149;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-accent: 0 4px 14px rgba(88,166,255,0.28);

  --nav-bg: rgba(22,27,34,0.85);
  --map-bg: #0d1117;

  color-scheme: dark;
}

/* ── Thème clair ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:            #fafafa;
  --bg-elevated:   #ffffff;
  --sidebar-bg:    #ffffff;
  --panel-bg:      #ffffff;
  --surface:       #f4f4f5;
  --surface-hover: #e4e4e7;
  --surface-2:     #f4f4f5;
  --surface-3:     #e4e4e7;
  --surface-4:     #d4d4d8;

  --border:        rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.22);
  --border-light:  rgba(0,0,0,0.05);

  --text:          #09090b;
  --text-muted:    #52525b;
  --text-dim:      #a1a1aa;

  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-contrast:#ffffff;
  --accent-soft:   rgba(37,99,235,0.10);
  --accent-ring:   rgba(37,99,235,0.28);
  --accent-glow:   rgba(37,99,235,0.16);

  --st-online:  #16a34a;
  --st-recent:  #d97706;
  --st-offline: #71717a;
  --st-unknown: #d4d4d8;
  --st-danger:  #dc2626;

  --shadow-sm: 0 1px 2px rgba(24,24,27,0.06);
  --shadow-md: 0 8px 24px rgba(24,24,27,0.08), 0 2px 4px rgba(24,24,27,0.04);
  --shadow-lg: 0 20px 48px rgba(24,24,27,0.12), 0 4px 8px rgba(24,24,27,0.06);
  --shadow-accent: 0 4px 14px rgba(37,99,235,0.25);

  --nav-bg: rgba(255,255,255,0.78);
  --map-bg: #e6eef0;

  color-scheme: light;
}

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

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

@supports (font-variation-settings: normal) {
  body { font-family: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: none; }

button { font-family: inherit; }

::selection { background: var(--accent-soft); color: var(--accent); }

/* Scrollbars globaux */
*::-webkit-scrollbar        { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb  { background: var(--surface-3); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--surface-4); }

/* Chiffres tabulaires sur les éléments numériques */
.tabular { font-variant-numeric: tabular-nums; }

/* ── Shared animation ────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility classes ─────────────────────────────────────────── */
.hidden { display: none !important; }
.muted  { color: var(--text-muted); }
.small  { font-size: 11px; }
