@import url('/assets/fonts.css');
:root {
  --bg: #060B18; --bg2: #0A1226; --panel: #0E1731; --panel2: #121D3C; --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14);
  --text: #EEF2FA; --mute: #8FA3C7; --dim: #5C6E92;
  --accent: #FF2D55; --accent2: #B5123A; --cyan: #36D6FF; --ok: #3DDC97; --warn: #FFB13D; --bad: #FF5A36;
  --r: 12px; --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.n { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; }
h1 { font: 900 italic 40px 'Barlow Condensed', sans-serif; letter-spacing: .01em; }
h2 { font: 800 22px 'Barlow Condensed', sans-serif; letter-spacing: .04em; text-transform: uppercase; }
h3 { font: 700 12px Inter, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--mute); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* --- structure */
.app { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.brand .pill { align-self: flex-start; display: flex; align-items: center; gap: 8px; background: var(--accent); padding: 5px 12px 5px 9px; border-radius: 4px; transform: skewX(-10deg); }
.brand .pill span { transform: skewX(10deg); font: 800 italic 20px 'Barlow Condensed'; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.brand small { color: var(--mute); font-weight: 600; letter-spacing: .18em; font-size: 11px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 600; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.05); }
.nav a.active { background: rgba(255,45,85,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .sec { margin: 14px 12px 6px; font: 700 10.5px Inter; letter-spacing: .2em; color: var(--dim); text-transform: uppercase; }
.nav .ev { font-weight: 500; font-size: 13px; }
.nav .ev .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--mute); font-size: 12px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(6,11,24,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.content { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 20px; }
.crumb { color: var(--mute); font-size: 12px; font-weight: 600; letter-spacing: .08em; }

/* --- éléments */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panel.tight { padding: 0; overflow-x: auto; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.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)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.sp { flex: 1; }
.muted { color: var(--mute); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.hide { display: none !important; }
@media (max-width: 1200px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .side { display: none; } }

button, .btn { font: 700 13px Inter, sans-serif; letter-spacing: .02em; border: 0; border-radius: 9px; padding: 10px 16px; min-height: 40px; cursor: pointer; background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: transform .08s, background .15s, box-shadow .15s; white-space: nowrap; }
button:hover, .btn:hover { background: #18254B; text-decoration: none; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); box-shadow: none; color: #fff; }
.primary:hover { background: #ff4b6d; }
.cyan { background: var(--cyan); color: #04101f; box-shadow: none; }
.cyan:hover { background: #6ae1ff; }
.ok { background: var(--ok); color: #04150c; box-shadow: none; }
.ok:hover { background: #63e7ad; }
.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px rgba(255,90,54,.5); }
.danger:hover { background: rgba(255,90,54,.12); }
.ghost { background: transparent; box-shadow: none; color: var(--mute); }
.ghost:hover { color: #fff; background: rgba(255,255,255,.05); }
.sm { min-height: 30px; padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.xl { min-height: 64px; padding: 14px 22px; font-size: 16px; border-radius: 12px; flex-direction: column; gap: 2px; }
.xl small { font-weight: 500; font-size: 11px; opacity: .75; letter-spacing: .04em; }

label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12px; color: var(--mute); letter-spacing: .03em; }
input, select, textarea { font: 500 14px Inter, sans-serif; color: var(--text); background: #091127; border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; min-height: 40px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(54,214,255,.15); }
input[type=color] { padding: 3px; width: 48px; min-height: 36px; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 120px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 700 11px Inter; letter-spacing: .12em; text-transform: uppercase; background: rgba(255,255,255,.07); color: var(--mute); white-space: nowrap; }
.badge .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-ok { background: rgba(61,220,151,.14); color: var(--ok); }
.b-warn { background: rgba(255,177,61,.14); color: var(--warn); }
.b-bad { background: rgba(255,90,54,.14); color: var(--bad); }
.b-live { background: rgba(255,45,85,.16); color: #ff6d88; }
.b-cyan { background: rgba(54,214,255,.12); color: var(--cyan); }
.b-live .d { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 700 10.5px Inter; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
td input, td select { min-height: 34px; padding: 6px 9px; }
.num { text-align: right; font-family: 'Barlow Condensed'; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 800 30px 'Barlow Condensed'; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font: 700 10.5px Inter; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 4px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; font-weight: 700; color: var(--mute); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a.active { color: #fff; border-color: var(--accent); }

.evcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--r); background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line); text-decoration: none !important; color: var(--text); transition: border-color .15s; }
.evcard:hover { border-color: rgba(255,45,85,.5); }
.bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }

.clock { font: 900 italic 64px 'Barlow Condensed'; line-height: .9; font-variant-numeric: tabular-nums; }
.state-pill { font: 800 13px Inter; letter-spacing: .2em; padding: 8px 14px; border-radius: 8px; text-transform: uppercase; }
.st-idle { background: rgba(255,255,255,.07); color: var(--mute); }
.st-armed { background: rgba(255,177,61,.15); color: var(--warn); }
.st-countdown { background: rgba(255,177,61,.25); color: #ffd08a; }
.st-racing { background: rgba(255,45,85,.2); color: #ff7590; }
.st-paused { background: rgba(54,214,255,.15); color: var(--cyan); }
.st-finished { background: rgba(61,220,151,.15); color: var(--ok); }

.monitor { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line2); }
.monitor.portrait { aspect-ratio: 9 / 16; max-height: 420px; width: auto; margin: 0 auto; }
.monitor iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.monitor .tag { position: absolute; left: 10px; top: 10px; z-index: 2; }
.mon-pgm { box-shadow: 0 0 0 3px var(--accent); }
.mon-pvw { box-shadow: 0 0 0 3px var(--ok); }
.progs { display: flex; gap: 8px; flex-wrap: wrap; }
.progs button.sel { box-shadow: inset 0 0 0 2px var(--ok); color: #fff; }
.progs button.onair { background: rgba(255,45,85,.2); box-shadow: inset 0 0 0 2px var(--accent); }

.log { font-family: var(--mono); font-size: 12px; }
.log-row { display: grid; grid-template-columns: 92px 62px minmax(0,1fr) minmax(0,1fr); gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: start; }
.log-row:hover { background: rgba(255,255,255,.03); }
.log-row .raw, .log-row .tr { white-space: pre-wrap; word-break: break-all; max-height: 74px; overflow: hidden; color: #cdd6ea; }
.log-row .tr { color: #9fe9c5; }
.log-row.err .tr { color: var(--bad); }
.log-row.sys .raw { color: var(--warn); }
.log-head { display: grid; grid-template-columns: 92px 62px minmax(0,1fr) minmax(0,1fr); gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font: 700 10.5px Inter; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; position: sticky; top: 0; background: var(--panel); }
.logbox { max-height: 560px; overflow: auto; }
pre.json { margin: 0; padding: 14px; background: #070d1e; border-radius: 8px; border: 1px solid var(--line); overflow: auto; max-height: 60vh; font: 12.5px/1.5 var(--mono); color: #d7e0f2; white-space: pre-wrap; word-break: break-word; }
.k { color: #8fd3ff; } .s { color: #ffd38a; } .nm { color: #b9f6a6; } .bl { color: #ff9ab0; }

.copy { display: flex; align-items: center; gap: 8px; background: #091127; border: 1px solid var(--line2); border-radius: 8px; padding: 4px 4px 4px 12px; }
.copy code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cfe3ff; }

.modal-bg { position: fixed; inset: 0; background: rgba(2,5,12,.75); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal { width: min(1100px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--panel2); box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 1px var(--line2); font-weight: 600; max-width: 420px; }
.toast.err { box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 1px var(--bad); }
.empty { padding: 40px; text-align: center; color: var(--mute); }
.kbd { font: 700 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.08); color: var(--mute); }
.lane-chip { display: inline-flex; width: 26px; height: 26px; border-radius: 6px; align-items: center; justify-content: center; color: #050A18; font: 900 17px 'Barlow Condensed'; }
.ovl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ovl-btn { min-height: 74px; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; white-space: normal; padding: 12px 14px; }
.ovl-btn b { font-size: 14px; }
.ovl-btn small { font-weight: 500; color: var(--mute); font-size: 11.5px; }
.warnbox { padding: 12px 16px; border-radius: 10px; background: rgba(255,177,61,.1); box-shadow: inset 0 0 0 1px rgba(255,177,61,.35); color: #ffd9a0; }
.infobox { padding: 12px 16px; border-radius: 10px; background: rgba(54,214,255,.08); box-shadow: inset 0 0 0 1px rgba(54,214,255,.3); color: #cdefff; }

/* liaison perdue / démo */
.linkbar { position: sticky; top: 0; z-index: 20; margin: 0 0 14px; padding: 14px 18px; border-radius: 12px; background: #5a0f1e; color: #fff; box-shadow: inset 0 0 0 2px #FF2D55; font-size: 15px; animation: linkpulse 1.4s ease-in-out infinite; }
.linkbar[hidden] { display: none; }
@keyframes linkpulse { 50% { background: #7a1428; } }
#demo-speed button.sel { box-shadow: inset 0 0 0 2px var(--warn, #FFB13D); color: #fff; }
.demo-panel { border-left: 4px solid var(--warn, #FFB13D); }
