/* ============================================================
   APPEL 112 — socle visuel : tokens, reset, composants
   ============================================================ */

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bahnschrift", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;

  --r-xs: 6px;
  --r-sm: 9px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --topbar-h: 62px;
  --nav-w: 238px;
  --rail-w: 330px;
  --bottom-h: 64px;

  --ease: cubic-bezier(.22, .8, .28, 1);
  --fast: .16s var(--ease);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050a11;
  --bg-2: #070f19;
  --panel: #0b1521;
  --panel-2: #0f1c2a;
  --panel-3: #152538;
  --panel-glass: rgba(10, 20, 32, .82);
  --input-bg: #08121d;
  --line: #17293c;
  --line-2: #223a52;
  --line-3: #2f4a66;
  --text: #e9f1fa;
  --text-2: #c3d2e1;
  --muted: #869bb2;
  --faint: #5d738c;
  --accent: #2ad4e8;
  --accent-2: #38bdf8;
  --accent-soft: rgba(42, 212, 232, .12);
  --accent-ink: #02131a;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .13);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .13);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .13);
  --gold: #f3c969;
  --gold-soft: rgba(243, 201, 105, .12);
  --violet: #a78bfa;
  --shadow-1: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-2: 0 16px 44px rgba(0, 0, 0, .5);
  --map-filter: none;
  --grid-line: rgba(90, 140, 180, .045);
  --glow: radial-gradient(60% 60% at 20% 0%, rgba(42, 212, 232, .10), transparent 70%),
          radial-gradient(50% 50% at 90% 10%, rgba(56, 130, 246, .08), transparent 70%);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e9eef5;
  --bg-2: #f1f5fa;
  --panel: #ffffff;
  --panel-2: #f6f9fc;
  --panel-3: #eaf0f7;
  --panel-glass: rgba(255, 255, 255, .88);
  --input-bg: #f4f8fc;
  --line: #dbe4ee;
  --line-2: #c8d5e3;
  --line-3: #b0c2d4;
  --text: #0d1a29;
  --text-2: #2b3d52;
  --muted: #5b7189;
  --faint: #8396aa;
  --accent: #0e9fb5;
  --accent-2: #0284c7;
  --accent-soft: rgba(14, 159, 181, .10);
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .09);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .10);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, .10);
  --gold: #b37d0c;
  --gold-soft: rgba(179, 125, 12, .10);
  --violet: #7c3aed;
  --shadow-1: 0 1px 3px rgba(15, 35, 60, .08);
  --shadow-2: 0 18px 40px rgba(15, 35, 60, .16);
  --grid-line: rgba(60, 100, 140, .06);
  --glow: radial-gradient(60% 60% at 20% 0%, rgba(14, 159, 181, .08), transparent 70%),
          radial-gradient(50% 50% at 90% 10%, rgba(2, 132, 199, .06), transparent 70%);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  mask-image: radial-gradient(80% 60% at 50% 0%, #000, transparent);
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(42, 212, 232, .3); }

h1 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
h3 { font-size: 15px; font-weight: 650; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.strong { font-weight: 650; }
.upper { text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.sep { height: 1px; background: var(--line); margin: 12px 0; border: 0; }

/* ── Scrollbars ───────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Boutons ──────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--panel-2);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--text);
  font-size: 13px; font-weight: 600; letter-spacing: .1px;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast), opacity var(--fast);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--panel-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(180deg, #45e4f3, #12b3c8);
  border-color: transparent; color: #03151b;
  box-shadow: 0 8px 22px rgba(42, 212, 232, .22);
}
.btn.primary:hover { background: linear-gradient(180deg, #61ecf8, #17c1d6); }
.btn.danger { background: linear-gradient(180deg, #f45b5b, #d32f2f); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(239, 68, 68, .2); }
.btn.danger:hover { background: linear-gradient(180deg, #ff6d6d, #de3a3a); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--panel-2); color: var(--text); }
.btn.ok { background: linear-gradient(180deg, #34d574, #17a34a); border-color: transparent; color: #04160b; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; color: #fff;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: var(--fast);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(42, 212, 232, .25); }

/* ── Formulaires ──────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 42px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
  outline: none;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--line-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23869bb2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.field-error { color: var(--danger); font-size: 12px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-3); border-radius: 5px; background: var(--input-bg); flex: none; margin-top: 1px; display: grid; place-items: center; transition: var(--fast); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: rotate(-45deg) translateY(-1px); }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); border: 0; transition: var(--fast); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: var(--fast); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }

/* ── Chips / badges ───────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text-2); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(42, 212, 232, .22); }
.chip.red { color: #ff8080; background: var(--danger-soft); border-color: rgba(239, 68, 68, .22); }
.chip.green { color: #5be38f; background: var(--ok-soft); border-color: rgba(34, 197, 94, .22); }
.chip.amber { color: var(--gold); background: var(--gold-soft); border-color: rgba(243, 201, 105, .2); }
.chip.violet { color: var(--violet); background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .22); }
.chip.plain { background: transparent; }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.badge.red { background: var(--danger); color: #fff; }

/* ── Cartes / surfaces ────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.card-head h3 svg { width: 15px; height: 15px; color: var(--accent); }
.card-body { padding: 16px; }
.hoverable { transition: border-color var(--fast), transform var(--fast), box-shadow var(--fast); }
.hoverable:hover { border-color: var(--line-3); box-shadow: 0 10px 30px rgba(0,0,0,.22); }

.divider { height: 1px; background: var(--line); }

/* ── Utilitaires de couleur ───────────────────────────────── */
.c-accent { color: var(--accent); }
.c-muted { color: var(--muted); }
.c-danger { color: var(--danger); }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-gold { color: var(--gold); }
.c-red { color: #f87171; }
.c-green { color: #4ade80; }
.c-blue { color: #60a5fa; }
.c-violet { color: var(--violet); }
.bg-soft { background: var(--panel-2); }
.w-100 { width: 100%; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes pulse-ring {
  0% { transform: scale(.7); opacity: .9; }
  80%, 100% { transform: scale(2.1); opacity: 0; }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
@keyframes shimmer { to { background-position: 200% 0; } }
.anim-in { animation: fade-up .28s var(--ease) both; }
.anim-fade { animation: fade-in .2s var(--ease) both; }

/* ── Boot ─────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: var(--bg);
  background-image: var(--glow);
  padding: 24px;
}
.boot-logo { display: flex; align-items: center; gap: 16px; }
.boot-title { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.boot-title span { color: var(--accent); }
.boot-sub { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.boot-bar { width: 220px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: bootbar 1.4s var(--ease) infinite; }
@keyframes bootbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.boot-status { font-size: 11px; color: var(--faint); letter-spacing: .12em; text-transform: uppercase; }
.boot.fade-out { animation: fade-in .35s reverse both; pointer-events: none; }

/* ── Logo ─────────────────────────────────────────────────── */
.logo-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(160deg, #34e0f0, #0b9db2 70%);
  color: #02141a;
  box-shadow: 0 6px 18px rgba(42, 212, 232, .3), inset 0 1px 0 rgba(255, 255, 255, .35);
  flex: none;
}
.logo-mark svg { width: 21px; height: 21px; }
.logo-word { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.logo-word span { color: var(--accent); }
.logo-tag { font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
