/* ============================================================================
   RUSH · SPEC — design system
   Console de supervision : rail de navigation, scène video au centre,
   panneau joueurs a droite. Full black, sobre, lisible, sans effets gratuits.
   ============================================================================ */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2-variations'), url('/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Surfaces */
  --bg:        #000;
  --bg-1:      #070708;
  --bg-2:      #0c0c0e;
  --bg-3:      #121215;
  --bg-4:      #18181c;
  --hover:     #141417;
  --line:      #1b1b20;
  --line-2:    #26262d;
  --line-3:    #34343d;

  /* Texte */
  --txt:   #ededf0;
  --txt-2: #a0a0ab;
  --txt-3: #66666f;
  --txt-4: #45454d;

  /* Marque */
  --acc:      #e8b64c;
  --acc-2:    #f3c868;
  --acc-bg:   rgba(232,182,76,.10);
  --acc-line: rgba(232,182,76,.28);
  --acc-ink:  #120d02;

  /* Etats */
  --ok:     #3ddc97;  --ok-bg:   rgba(61,220,151,.10);  --ok-line:   rgba(61,220,151,.26);
  --mid:    #f5b942;  --mid-bg:  rgba(245,185,66,.10);
  --bad:    #ff5d5d;  --bad-bg:  rgba(255,93,93,.10);   --bad-line:  rgba(255,93,93,.28);
  --info:   #7aa7ff;  --info-bg: rgba(122,167,255,.10);
  --live:   #ff4d4d;

  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 18px;
  --sh-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.45);
  --sh-2: 0 24px 64px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(232,182,76,.22);

  --rail-w: 72px;
  --panel-w: 344px;
  --head-h: 64px;
  --tab-h: 62px;

  --ease: cubic-bezier(.2,.7,.2,1);
  --t1: .12s; --t2: .2s;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden; -webkit-tap-highlight-color: transparent;
}
#app { height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); }
::selection { background: var(--acc); color: var(--acc-ink); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--txt-2); } .dim { color: var(--txt-3); }
.hidden { display: none !important; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ============================== Marque ================================ */
.brand { display: inline-flex; align-items: center; gap: 10px; user-select: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(145deg, #f3c868, #c8902c); color: var(--acc-ink);
  font-weight: 850; font-size: 17px; letter-spacing: -.02em;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 6px 18px rgba(232,182,76,.18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-word { font-weight: 800; letter-spacing: .2em; font-size: 15px; }
.brand-sub { font-size: 9.5px; letter-spacing: .3em; color: var(--txt-3); font-weight: 600; margin-top: 3px; }

/* ============================== Boutons =============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--txt);
  font-weight: 550; font-size: 13px; white-space: nowrap; user-select: none;
  transition: background var(--t1), border-color var(--t1), color var(--t1), opacity var(--t1);
}
.btn:hover { background: var(--bg-4); border-color: var(--line-3); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 46px; font-size: 14.5px; border-radius: var(--r); }
.btn.block { width: 100%; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 650; }
.btn.primary:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn.ghost:hover { background: var(--hover); color: var(--txt); }
.btn.danger { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.btn.danger:hover { background: rgba(255,93,93,.16); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: var(--r-sm); color: var(--txt-2); border: 1px solid transparent;
  transition: background var(--t1), color var(--t1), border-color var(--t1);
}
.icon-btn:hover { background: var(--hover); color: var(--txt); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.bordered { border-color: var(--line-2); background: var(--bg-2); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-bg); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; }
.seg button {
  height: 28px; padding: 0 11px; border-radius: 6px; display: inline-flex; align-items: center; gap: 7px;
  color: var(--txt-3); font-size: 12.5px; font-weight: 600; transition: background var(--t1), color var(--t1);
}
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--txt); }
.seg button.on { background: var(--bg-4); color: var(--txt); box-shadow: 0 0 0 1px var(--line-3) inset; }
.seg button:disabled { opacity: .35; pointer-events: none; }

/* ============================== Champs ================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--txt-2); }
.input, .select {
  height: 38px; width: 100%; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--bg-1); border: 1px solid var(--line-2);
  transition: border-color var(--t1), background var(--t1);
}
.input::placeholder { color: var(--txt-3); }
.input:hover, .select:hover { border-color: var(--line-3); }
.input:focus, .select:focus { outline: none; border-color: var(--acc-line); background: var(--bg-2); box-shadow: var(--ring); }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2366666f' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.select option { background: var(--bg-2); }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--txt-3); pointer-events: none; }
.input-wrap > .input { padding-left: 35px; }
.input-wrap .kbd-hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--txt-2); }
.check input { width: 16px; height: 16px; accent-color: var(--acc); }
kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--txt-3); }

/* ============================== Badges ================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--bg-3); color: var(--txt-2); border: 1px solid var(--line-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.acc  { background: var(--acc-bg); color: var(--acc); border-color: var(--acc-line); }
.badge.ok   { background: var(--ok-bg);  color: var(--ok);  border-color: var(--ok-line); }
.badge.bad  { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: rgba(122,167,255,.26); }
.badge.mute { color: var(--txt-3); }

/* Statut (pastille) */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-2); font-weight: 550; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--txt-4); flex: 0 0 auto; }
.status.on i { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.status.off i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.status.wait i { background: var(--mid); box-shadow: 0 0 0 3px var(--mid-bg); }

/* Qualite de ping : barres */
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.sig span { width: 3px; border-radius: 1px; background: var(--line-3); }
.sig span:nth-child(1) { height: 5px; } .sig span:nth-child(2) { height: 8px; } .sig span:nth-child(3) { height: 12px; }
.sig.good span { background: var(--ok); }
.sig.ok span:nth-child(-n+2) { background: var(--mid); }
.sig.bad span:nth-child(1) { background: var(--bad); }
.ping-txt.good { color: var(--ok); } .ping-txt.ok { color: var(--mid); } .ping-txt.bad { color: var(--bad); } .ping-txt.unk { color: var(--txt-3); }

/* ============================== Shell ================================= */
.shell { flex: 1; display: flex; min-height: 0; }

.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w); display: none; flex-direction: column; align-items: center;
  padding: 14px 0 12px; gap: 6px; background: var(--bg-1); border-right: 1px solid var(--line);
}
.rail .brand { margin-bottom: 14px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rail-item {
  position: relative; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px;
  color: var(--txt-3); transition: background var(--t1), color var(--t1);
}
.rail-item svg { width: 21px; height: 21px; }
.rail-item:hover { background: var(--hover); color: var(--txt); }
.rail-item.active { background: var(--bg-4); color: var(--acc); box-shadow: 0 0 0 1px var(--line-2) inset; }
.rail-item.active::before { content: ''; position: absolute; left: -13px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--acc); }
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-status { width: 46px; height: 30px; display: grid; place-items: center; }

/* Tooltips (rail) */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; padding: 6px 10px; border-radius: 7px; background: var(--bg-4); border: 1px solid var(--line-3);
    color: var(--txt); font-size: 12px; font-weight: 550; box-shadow: var(--sh-1); z-index: 60; pointer-events: none;
  }
}

.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--bg-4); border: 1px solid var(--line-3); color: var(--txt); font-weight: 700; font-size: 12.5px; letter-spacing: .02em;
}
.avatar.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 17px; }
button.avatar:hover { border-color: var(--acc-line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
}
.topbar .title { flex: 1; font-weight: 650; font-size: 15px; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.content.fill { overflow: hidden; }

.tabbar {
  flex: 0 0 auto; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--bg-1); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--txt-3); font-size: 10.5px; font-weight: 600; transition: color var(--t1);
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--acc); }

/* Menu utilisateur (popover) */
.popover {
  position: fixed; z-index: 120; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line-3); box-shadow: var(--sh-2);
}
.popover .pop-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.popover .pop-head .u { font-weight: 650; }
.popover .pop-head .r { font-size: 11.5px; color: var(--txt-3); }
.popover .pop-item { width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--txt-2); font-size: 13px; }
.popover .pop-item svg { width: 16px; height: 16px; }
.popover .pop-item:hover { background: var(--hover); color: var(--txt); }
.popover .pop-item.danger:hover { color: var(--bad); background: var(--bad-bg); }

/* ============================== Pages classiques ====================== */
.page { max-width: 1240px; margin: 0 auto; padding: 22px 16px 28px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { flex: 1; min-width: 200px; }
.h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-sub { margin: 4px 0 0; color: var(--txt-3); font-size: 13px; }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--txt-3); }

.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card.pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 200px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi .k { font-size: 11.5px; color: var(--txt-3); font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 48px 20px; color: var(--txt-3); }
.empty svg { width: 36px; height: 36px; opacity: .5; margin-bottom: 12px; }
.empty .t { color: var(--txt-2); font-weight: 650; font-size: 14px; }
.empty .d { margin-top: 4px; font-size: 13px; max-width: 360px; margin-left: auto; margin-right: auto; }

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line-2); color: var(--txt-2); font-size: 12.5px; line-height: 1.5; }
.note svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; color: var(--mid); }

/* Tables */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; background: var(--bg-1); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th { text-align: left; font-size: 11px; font-weight: 650; color: var(--txt-3); letter-spacing: .04em; text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-1); position: sticky; top: 0; z-index: 1; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--bg-2); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .n { font-weight: 600; }
.cell-user .s { font-size: 11.5px; color: var(--txt-3); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ============================== Console (Surveillance) ================= */
.console {
  height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w);
  transition: grid-template-columns var(--t2) var(--ease);
}
.console.panel-closed { grid-template-columns: minmax(0, 1fr) 0; }
.console-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.c-head {
  height: var(--head-h); flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: var(--bg-1);
}
.c-title { display: flex; flex-direction: column; min-width: 0; flex: 0 0 auto; }
.c-title .h2 { font-size: 15.5px; white-space: nowrap; }
.c-title .status { font-size: 11.5px; margin-top: 2px; white-space: nowrap; }
.c-stats { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.c-stat { display: inline-flex; align-items: baseline; gap: 6px; height: 30px; padding: 0 11px; align-items: center;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); font-size: 12px; color: var(--txt-3); white-space: nowrap; }
.c-stat b { color: var(--txt); font-weight: 650; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.c-spacer { flex: 1; }
.c-actions { display: flex; gap: 8px; align-items: center; }

.stage { flex: 1; min-height: 0; padding: 16px; background: var(--bg); overflow: auto; }

/* --- Agencements des flux --- */
.streams { height: 100%; min-height: 0; display: grid; gap: 12px; }
.streams.grid[data-n="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.streams.grid[data-n="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; align-items: center; }
.streams.grid[data-n="2"] > .tile { height: auto; aspect-ratio: 16/9; }
.streams.grid[data-n="3"], .streams.grid[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.streams.focus { display: flex; gap: 12px; }
.focus-main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.focus-main > .tile { flex: 1; }
.focus-side { width: 264px; flex: 0 0 264px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.focus-side > .tile, .focus-side > .slot { flex: 0 0 auto; aspect-ratio: 16/9; height: auto; }

/* --- Tuile --- */
.tile {
  position: relative; min-width: 0; min-height: 0; height: 100%; border-radius: var(--r-lg); overflow: hidden;
  background: #050506; border: 1px solid var(--line-2); isolation: isolate;
  transition: border-color var(--t1);
}
.tile:hover { border-color: var(--line-3); }
.tile.is-primary { border-color: var(--acc-line); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: none; }
.tile[data-state="live"] video { display: block; }
.tile:fullscreen { border-radius: 0; border: 0; }

.tile-top, .tile-bot { position: absolute; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 10px 12px; pointer-events: none; }
.tile-top { top: 0; background: linear-gradient(to bottom, rgba(0,0,0,.78), rgba(0,0,0,0)); }
.tile-bot { bottom: 0; background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0)); }
.tile-top > *, .tile-bot > * { pointer-events: auto; }
.tile-idx { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.1); color: var(--txt); font-variant-numeric: tabular-nums; }
.tile-name { font-weight: 650; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tile-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.tile-sub { font-size: 11.5px; color: rgba(255,255,255,.55); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile-sp { flex: 1; }
/* Vignettes (mode focus, colonne laterale) : version compacte. */
.focus-side .tile-top, .focus-side .tile-bot { padding: 7px 8px; gap: 6px; }
.focus-side .tile-sub, .focus-side .tile-stats, .focus-side .tile-center .d,
.focus-side .live-badge span, .focus-side .tbtn-sep, .focus-side .tile-ctrls .tbtn:not(.close):not([title="Mettre en principal"]) { display: none; }
.focus-side .live-badge { padding: 0 6px; height: 18px; }
.focus-side .tile-name { font-size: 12px; }
.focus-side .tile-idx { width: 18px; height: 18px; font-size: 10px; }
.focus-side .tbtn { width: 26px; height: 26px; border-radius: 7px; }
.focus-side .tbtn svg { width: 14px; height: 14px; }
.focus-side .tile-center .box { gap: 6px; }
.focus-side .tile-center .t { font-size: 11.5px; }
.focus-side .tile-center .spinner { width: 18px; height: 18px; border-width: 2px; }
.focus-side .tile-center .btn { height: 26px; font-size: 11.5px; padding: 0 8px; }
.focus-side .tile { cursor: pointer; }
.live-badge { white-space: nowrap; flex: 0 0 auto; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 750; letter-spacing: .08em; background: rgba(0,0,0,.55); color: var(--txt-2); border: 1px solid rgba(255,255,255,.1); }
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--txt-3); }
.tile[data-state="live"] .live-badge { color: #fff; background: rgba(255,77,77,.16); border-color: rgba(255,77,77,.4); }
.tile[data-state="live"] .live-badge i { background: var(--live); }
.tile[data-state="lost"] .live-badge, .tile[data-state="failed"] .live-badge { color: var(--bad); }
.tile-stats { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile-ctrls { display: flex; gap: 4px; opacity: 0; transition: opacity var(--t2); }
.tile:hover .tile-ctrls, .tile:focus-within .tile-ctrls { opacity: 1; }
@media (hover: none) { .tile-ctrls { opacity: 1; } }
.tbtn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); transition: background var(--t1), border-color var(--t1); }
.tbtn svg { width: 16px; height: 16px; }
.tbtn:hover { background: rgba(255,255,255,.14); }
.tbtn.close:hover { background: rgba(255,77,77,.3); border-color: rgba(255,77,77,.5); }
.tbtn:disabled { opacity: .38; cursor: not-allowed; }
.tbtn-sep { width: 1px; background: rgba(255,255,255,.12); margin: 6px 2px; }

.tile-center { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; text-align: center; padding: 20px; }
.tile-center .box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 280px; }
.tile-center .t { font-weight: 650; font-size: 13px; }
.tile-center .d { font-size: 12px; color: var(--txt-3); }
.tile[data-state="live"] .tile-center { display: none; }
.tile-center .err-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bad-bg); color: var(--bad); }
.tile-center .err-ic svg { width: 18px; height: 18px; }

.slot {
  min-height: 0; height: 100%; border-radius: var(--r-lg); border: 1px dashed var(--line-3); color: var(--txt-3);
  display: grid; place-items: center; text-align: center; transition: border-color var(--t1), color var(--t1), background var(--t1);
}
.slot:hover { border-color: var(--acc-line); color: var(--acc); background: var(--acc-bg); }
.slot .in { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.slot svg { width: 20px; height: 20px; }

.stage-empty { height: 100%; display: grid; place-items: center; }
.stage-empty .box { text-align: center; max-width: 420px; padding: 24px; }
.stage-empty .ill { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--txt-3); }
.stage-empty .ill svg { width: 28px; height: 28px; }
.stage-empty .t { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.stage-empty .d { margin-top: 6px; color: var(--txt-3); font-size: 13px; line-height: 1.55; }

/* --- Onglets mobiles --- */
.m-tabs { display: none; }
.seg .cnt:not(:empty) { font-size: 11px; font-weight: 700; padding: 0 6px; height: 18px; line-height: 18px; border-radius: 5px;
  background: var(--bg-3); color: var(--txt-2); font-variant-numeric: tabular-nums; }
.seg button.on .cnt:not(:empty) { background: var(--acc-bg); color: var(--acc); }

/* --- Panneau joueurs --- */
.panel {
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-1); border-left: 1px solid var(--line);
}
.console.panel-closed .panel { border-left: 0; }
.p-head { height: var(--head-h); flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.p-head .h2 { flex: 1; display: flex; align-items: center; gap: 8px; }
.p-count { font-size: 11.5px; font-weight: 650; color: var(--txt-2); background: var(--bg-3); border: 1px solid var(--line-2); padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.p-tools { padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.p-filters { display: flex; gap: 6px; align-items: center; }
.chip { height: 28px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--txt-3);
  border: 1px solid var(--line-2); background: transparent; display: inline-flex; align-items: center; gap: 6px; transition: all var(--t1); }
.chip b { font-weight: 650; color: var(--txt-3); font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--txt); border-color: var(--line-3); }
.chip.on { color: var(--txt); background: var(--bg-4); border-color: var(--line-3); }
.chip.on b { color: var(--acc); }
.p-filters .select { height: 28px; width: auto; margin-left: auto; font-size: 12px; padding: 0 28px 0 9px; background-position: right 8px center; border-radius: 7px; }

.p-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.p-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; cursor: pointer;
  transition: background var(--t1); position: relative;
}
.p-row:hover { background: var(--hover); }
.p-row.sel { background: var(--bg-4); }
.p-row.watched::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--live); }
.p-av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto;
  font-size: 11px; font-weight: 750; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--txt-2); }
.p-av.staff { background: var(--acc-bg); border-color: var(--acc-line); color: var(--acc); }
.p-main { flex: 1; min-width: 0; }
.p-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-meta { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--txt-3); white-space: nowrap; overflow: hidden; }
.p-meta .grp { color: var(--acc); font-weight: 600; }
.p-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.p-ping { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 58px; justify-content: flex-end; }
.p-act { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--txt-2);
  border: 1px solid var(--line-2); background: var(--bg-2); opacity: 0; transition: opacity var(--t1), background var(--t1), color var(--t1); }
.p-act svg { width: 15px; height: 15px; }
.p-row:hover .p-act, .p-act:focus-visible { opacity: 1; }
.p-act:hover { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.p-act.live { opacity: 1; color: var(--live); border-color: rgba(255,77,77,.4); background: rgba(255,77,77,.08); }
.p-act:disabled { opacity: .3 !important; pointer-events: none; }
@media (hover: none) { .p-act { opacity: 1; } }
.p-foot { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--txt-3); }
.p-foot b { color: var(--txt-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.p-empty { padding: 36px 16px; text-align: center; color: var(--txt-3); font-size: 12.5px; }
.p-empty .t { color: var(--txt-2); font-weight: 650; font-size: 13px; margin-bottom: 4px; }

/* --- Fiche joueur (glisse par-dessus le panneau) --- */
.sheet {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--bg-1);
  transform: translateX(100%); transition: transform var(--t2) var(--ease); visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.sheet-head { height: var(--head-h); flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.sheet-head .h2 { flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; }
.sheet-id { display: flex; gap: 14px; align-items: center; }
.sheet-id .n { font-size: 17px; font-weight: 700; letter-spacing: -.01em; word-break: break-word; }
.sheet-id .s { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fact { background: var(--bg-2); padding: 11px 13px; }
.fact .k { font-size: 11px; color: var(--txt-3); font-weight: 600; }
.fact .v { margin-top: 3px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; word-break: break-all; }
.spark-card { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); padding: 12px 13px; }
.spark-card .hd { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.spark-card .hd .k { font-size: 11px; color: var(--txt-3); font-weight: 600; }
.spark-card .hd .v { font-size: 11.5px; color: var(--txt-2); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 56px; display: block; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-actions .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gone { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bad-line); background: var(--bad-bg); color: var(--bad); font-size: 12.5px; font-weight: 600; }

/* ============================== Modale / toasts ======================== */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px); opacity: 0; transition: opacity var(--t2); }
.overlay.in { opacity: 1; }
.modal { width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--sh-2);
  transform: translateY(8px) scale(.985); transition: transform var(--t2) var(--ease); }
.overlay.in .modal { transform: none; }
.modal.wide { max-width: 560px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head .h2 { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.form-err { display: none; padding: 9px 12px; border-radius: var(--r-sm); background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); font-size: 12.5px; }
.form-err.show { display: block; }

#toasts { position: fixed; z-index: 200; top: 14px; left: 14px; right: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; width: 100%; max-width: 360px; display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line-3); box-shadow: var(--sh-2);
  opacity: 0; transform: translateY(-8px); transition: opacity var(--t2), transform var(--t2) var(--ease); cursor: pointer; }
.toast.in { opacity: 1; transform: none; }
.toast .ic { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.toast .msg { flex: 1; min-width: 0; font-size: 13px; }
.toast .msg .t { font-weight: 650; }
.toast .msg .d { color: var(--txt-2); font-size: 12.5px; margin-top: 1px; }
.toast.ok .ic { color: var(--ok); } .toast.err .ic { color: var(--bad); } .toast.warn .ic { color: var(--mid); } .toast.info .ic { color: var(--info); }
.toast.err { border-color: var(--bad-line); }

/* Bandeau de connexion perdue */
.conn-banner { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 12px;
  background: var(--mid-bg); border-bottom: 1px solid rgba(245,185,66,.25); color: var(--mid); font-size: 12.5px; font-weight: 600; }
.conn-banner .spinner { width: 13px; height: 13px; border-width: 2px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-3); border-top-color: var(--acc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== Login ================================= */
.auth { flex: 1; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(700px 380px at 50% -5%, rgba(232,182,76,.08), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 26px; }
.auth-logo .brand-mark { width: 44px; height: 44px; font-size: 21px; border-radius: 13px; }
.auth-logo .brand-word { font-size: 18px; }
.auth-box { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 26px 24px; box-shadow: var(--sh-1); }
.auth-box h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.auth-box .sub { color: var(--txt-3); font-size: 13px; margin: 4px 0 22px; }
.auth-box form { display: flex; flex-direction: column; gap: 14px; }
.auth-box .input { height: 42px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--txt-4); }

/* ============================== Responsive ============================ */
.only-mobile { display: none !important; }
@media (min-width: 860px) {
  .rail { display: flex; }
  .topbar, .tabbar { display: none; }
  .page { padding: 28px 32px 40px; }
  #toasts { left: auto; right: 16px; align-items: flex-end; }
}
@media (max-width: 1279px) and (min-width: 860px) {
  .console { grid-template-columns: minmax(0, 1fr) 0; }
  .console .panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 50;
    transform: translateX(100%); transition: transform var(--t2) var(--ease); box-shadow: var(--sh-2); }
  .console.panel-open .panel { transform: none; }
  .c-stats .c-stat.opt { display: none; }
}
@media (min-width: 1280px) {
  .only-narrow { display: none !important; }
}
/* Compteurs secondaires masques quand la place manque (panneau ouvert). */
@media (max-width: 1599px) {
  .c-stats .c-stat.opt { display: none; }
}
@media (max-width: 859px) {
  .only-mobile { display: inline-flex !important; }
  .only-desktop { display: none !important; }
  .console { display: flex !important; flex-direction: column; }
  .console-main, .console .panel { flex: 1; min-height: 0; }
  .m-tabs { display: block; flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
  .m-tabs .seg { display: flex; width: 100%; }
  .m-tabs .seg button { flex: 1; justify-content: center; height: 34px; white-space: nowrap; font-size: 13px; }
  .console[data-tab="screens"] .panel { display: none; }
  .console[data-tab="players"] .console-main { display: none; }
  .console .panel { border-left: 0; }
  .c-head { padding: 0 12px; gap: 10px; height: 56px; }
  .c-title, .c-stats { display: none; }
  .stage { padding: 10px; }
  .streams.grid[data-n="2"], .streams.grid[data-n="3"], .streams.grid[data-n="4"] {
    grid-template-columns: 1fr; grid-template-rows: none; height: auto; align-content: start; }
  .streams.grid > .tile, .streams.grid > .slot { height: auto; aspect-ratio: 16/9; }
  .streams.grid[data-n="1"] { height: auto; }
  .streams.focus { flex-direction: column; height: auto; }
  .focus-main > .tile { aspect-ratio: 16/9; height: auto; }
  .focus-side { width: auto; flex: 0 0 auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .focus-side > .tile, .focus-side > .slot { width: 46%; flex: 0 0 46%; }
  .p-head { display: none; }
  .sheet-head { height: 52px; }
  .p-act { opacity: 1; }
  .facts { grid-template-columns: 1fr 1fr; }
  .modal { max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; margin-top: auto; }
  .overlay { padding: 0; align-items: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
