/* ============================================================
   Vibin.bet — Design Tokens
   Midnight violet product shell. Brand color is kept separate
   from Radiant/Dire and win/loss semantics.
   ============================================================ */

:root {
  color-scheme: dark;

  /* ---- Brand ---- */
  --brand-violet: #8b5cf6;
  --brand-pink: #ed4f9b;
  --brand-orange: #ff9d17;
  --brand-gradient: linear-gradient(120deg, var(--brand-violet), var(--brand-pink) 58%, var(--brand-orange));

  /* ---- Surfaces ---- */
  --bg:        #080611;
  --bg-1:      #0d0817;
  --panel:     #120b1d;
  --panel-2:   #1a1028;
  --raised:    #241536;
  --input:     #10091a;

  /* ---- Lines ---- */
  --line:        rgba(184, 173, 200, .22);
  --line-soft:   rgba(184, 173, 200, .13);
  --line-strong: rgba(184, 173, 200, .38);

  /* ---- Text ---- */
  --text:      #f8f4ff;
  --text-2:    #d8cfe5;
  --text-dim:  #b8adc8;
  --text-faint:#7d718f;

  /* ---- Accents (L~0.80, C~0.13) ---- */
  --mint:      oklch(0.82 0.135 168);
  --mint-dim:  oklch(0.70 0.10 168);
  --mint-bg:   oklch(0.30 0.05 168);

  --amber:     oklch(0.83 0.125 78);
  --amber-dim: oklch(0.72 0.10 78);
  --amber-bg:  oklch(0.30 0.045 70);

  --coral:     oklch(0.70 0.155 26);
  --coral-2:   oklch(0.64 0.165 24);
  --coral-dim: oklch(0.58 0.12 26);
  --coral-bg:  oklch(0.30 0.06 26);

  --sky:       oklch(0.78 0.085 232); /* sparing, info only */

  /* ---- Semantic ---- */
  --pos: var(--mint);
  --neg: var(--coral);
  --live: var(--mint);
  --edge: var(--amber);
  --brand: var(--brand-violet);
  --violet: var(--brand-violet);

  /* ---- Accent intensity (tweakable) ---- */
  --accent-sat: 1;

  /* ---- Radius ---- */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* ---- Spacing scale ---- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  /* ---- Density (tweakable) ---- */
  --row-pad-y: 14px;
  --gap: 16px;

  /* ---- Elevation ---- */
  --sh-1: 0 1px 0 oklch(0.10 0 0 / 0.5), 0 1px 2px oklch(0 0 0 / 0.3);
  --sh-2: 0 2px 4px oklch(0 0 0 / 0.35), 0 8px 24px oklch(0 0 0 / 0.30);
  --sh-pop: 0 12px 40px oklch(0 0 0 / 0.55);

  /* ---- Type ---- */
  --font: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --fz-mega: 40px;
  --fz-h1: 26px;
  --fz-h2: 18px;
  --fz-h3: 15px;
  --fz-base: 14px;
  --fz-sm: 13px;
  --fz-xs: 11.5px;
  --fz-2xs: 10px;
}

[data-density="compact"] {
  --row-pad-y: 9px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background:
    radial-gradient(circle at 78% -10%, rgba(139, 92, 246, .15), transparent 35rem),
    radial-gradient(circle at 18% 42%, rgba(237, 79, 155, .07), transparent 32rem),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fz-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
}

::selection { background: color-mix(in oklch, var(--brand-violet) 42%, transparent); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin: 0; }

/* Numbers everywhere mono + tabular */
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--fz-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}

.dim  { color: var(--text-dim); }
.faint{ color: var(--text-faint); }
.pos  { color: var(--mint); }
.neg  { color: var(--coral); }
.amber{ color: var(--amber); }

.hr { height: 1px; background: var(--line-soft); border: 0; margin: 0; }

/* ============================================================
   Components & Layout
   ============================================================ */

/* ---------------- App shell ---------------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, .08), transparent 28%),
    linear-gradient(180deg, var(--bg-1), var(--bg));
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  overflow-y: auto;
}

/* Logo / wordmark */
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-home { color: inherit; text-decoration: none; }
.brand-home:hover .brand-name { color: var(--text); }
/* Official brand mark, inlined as crisp SVG — no box/clip/crop. */
.brand-mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 0 16px rgba(139, 92, 246, .28)); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { display: block; font-weight: 900; letter-spacing: -.035em; font-size: 18px; line-height: 1; }
.brand-name b { color: var(--brand-violet); }
.brand-tag {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint); margin-top: 5px;
}

.nav-group { margin-top: 6px; }
.nav-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; cursor: pointer;
  position: relative; transition: background .12s, color .12s;
  font-size: var(--fz-sm);
}
.nav-item .ni-ic { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav-item .ni-meta {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint);
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item > span { white-space: nowrap; }
.nav-item > span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(139, 92, 246, .22), rgba(237, 79, 155, .09));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .2);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 3px; background: var(--brand-gradient);
}
.nav-spacer { flex: 1; }

.safety-card {
  margin-top: 10px; padding: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: color-mix(in oklch, var(--mint-bg) 22%, var(--panel));
}
.safety-card .sc-head { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: var(--fz-sm); white-space: nowrap; }
.safety-card p { margin: 7px 0 0; color: var(--text-dim); font-size: var(--fz-xs); line-height: 1.5; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px color-mix(in oklch, var(--mint) 22%, transparent); flex: none; }
.dot.amber { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in oklch, var(--amber) 22%, transparent); }
.dot.coral { background: var(--coral); box-shadow: 0 0 0 3px color-mix(in oklch, var(--coral) 22%, transparent); }
.dot.gray { background: var(--text-faint); box-shadow: 0 0 0 3px color-mix(in oklch, var(--text-faint) 22%, transparent); }
.dot.live { animation: pulse 1.8s ease-in-out infinite; }
[data-pulse="off"] .dot.live { animation: none; }
@keyframes pulse { 0%,100%{ opacity: 1 } 50%{ opacity: .45 } }

/* ---------------- Main / topbar ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 28px;
  background: rgba(8, 6, 17, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: var(--fz-sm); color: var(--text-dim); }
.topbar .crumb-home { color: var(--text); font-weight: 600; text-decoration: none; }
.topbar .crumb-home:hover { color: var(--brand); }
.topbar .spacer { flex: 1; }
.content { padding: 26px 32px 80px; max-width: 1760px; width: 100%; margin: 0 auto; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font-family: var(--font); font-size: var(--fz-sm);
  font-weight: 600; cursor: pointer; transition: .12s; white-space: nowrap;
}
.btn:hover { background: var(--raised); border-color: var(--line-strong); }
.btn .ic { width: 15px; height: 15px; }
.btn.sm { padding: 6px 10px; font-size: var(--fz-xs); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn.brand {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 28px rgba(139, 92, 246, .2);
}
.btn.brand:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.mint { background: transparent; border-color: color-mix(in oklch, var(--mint) 45%, var(--line)); color: var(--mint); }
.btn.mint:hover { background: color-mix(in oklch, var(--mint-bg) 30%, transparent); }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--input); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--text-dim);
  font-family: var(--font); font-weight: 600; font-size: var(--fz-xs);
  padding: 5px 11px; border-radius: var(--r-xs); cursor: pointer; white-space: nowrap;
}
.seg button.on {
  background: linear-gradient(120deg, rgba(139, 92, 246, .3), rgba(237, 79, 155, .18));
  color: var(--text);
  box-shadow: var(--sh-1);
}

/* ---------------- Pills ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: var(--fz-2xs); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--text-2);
  background: var(--panel-2); white-space: nowrap;
}
.pill.bet   { color: var(--mint); border-color: color-mix(in oklch, var(--mint) 40%, var(--line)); background: color-mix(in oklch, var(--mint-bg) 30%, transparent); }
.pill.skip  { color: var(--text-dim); }
.pill.win   { color: var(--mint); border-color: color-mix(in oklch, var(--mint) 40%, var(--line)); }
.pill.loss  { color: var(--coral); border-color: color-mix(in oklch, var(--coral) 40%, var(--line)); }
.pill.pending { color: var(--amber); border-color: color-mix(in oklch, var(--amber) 35%, var(--line)); }
.pill.live  { color: var(--mint); border-color: color-mix(in oklch, var(--mint) 45%, var(--line)); background: color-mix(in oklch, var(--mint-bg) 28%, transparent); }
.pill.posted{ color: var(--mint); }
.pill.unposted{ color: var(--text-faint); border-style: dashed; }
.pill.tier-pro { color: var(--coral); border-color: color-mix(in oklch, var(--coral) 45%, var(--line)); }
.pill.tier-vip { color: var(--amber); border-color: color-mix(in oklch, var(--amber) 45%, var(--line)); }
.pill.amber { color: var(--amber); border-color: color-mix(in oklch, var(--amber) 38%, var(--line)); }
.pill.mint { color: var(--mint); border-color: color-mix(in oklch, var(--mint) 40%, var(--line)); }
.pill.ghost { background: transparent; }

.status-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--sky); cursor: pointer; font-size: var(--fz-sm); }
.status-link:hover { text-decoration: underline; }
.status-link .ic { width: 14px; height: 14px; }
.status-link.dead { color: var(--text-faint); cursor: default; font-style: italic; }
.status-link.dead:hover { text-decoration: none; }
.status-link.skip { color: var(--amber); cursor: default; font-weight: 600; font-size: var(--fz-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.status-link.skip:hover { text-decoration: none; }

/* ---------------- Cards / panels ---------------- */
.panel {
  background: linear-gradient(155deg, rgba(26, 16, 40, .72), rgba(18, 11, 29, .96) 42%);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.panel-pad { padding: 18px 20px; }
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { margin: 0; font-size: var(--fz-h2); font-weight: 700; letter-spacing: -0.01em; }
.panel-head .sub { color: var(--text-dim); font-size: var(--fz-sm); }
.panel-head .spacer { flex: 1; }

.section-title { display: flex; align-items: baseline; gap: 12px; margin: 28px 2px 14px; }
.section-title h2 { margin: 0; font-size: var(--fz-h2); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.section-title .meta { color: var(--text-dim); font-size: var(--fz-sm); margin-left: auto; }
.section-title a.meta:hover { color: var(--brand-pink); cursor: pointer; }
.dashboard-flow { display: flex; flex-direction: column; gap: 24px; }
.dashboard-section { min-width: 0; }
.dashboard-flow .section-title { margin: 0 2px 14px; }
.dashboard-flow .footnote { margin-top: 0; }

/* Dashboard brand hero */
.brand-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  min-height: 480px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, .27);
  border-radius: 22px;
  background:
    radial-gradient(circle at 78% 22%, rgba(237, 79, 155, .22), transparent 27%),
    radial-gradient(circle at 58% 78%, rgba(255, 157, 23, .11), transparent 27%),
    linear-gradient(135deg, #170d27, #0b0714 62%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .35), inset 0 1px rgba(255, 255, 255, .05);
}
.brand-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--brand-gradient);
}
.brand-hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(36px, 5vw, 72px);
}
.brand-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  color: var(--text-2);
  font: 700 10px var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.brand-hero-tagline {
  color: var(--brand-orange);
  font: 800 11px var(--mono);
  letter-spacing: .18em;
}
.brand-hero h1 {
  margin: 9px 0 18px;
  font-size: clamp(58px, 7vw, 104px);
  font-weight: 950;
  letter-spacing: -.075em;
  line-height: .78;
}
.brand-hero h1 span {
  color: transparent;
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
}
.brand-hero-lede {
  max-width: 55ch;
  color: var(--text-dim);
  font-size: clamp(14px, 1.25vw, 17px);
}
.brand-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.brand-hero-metrics > span {
  display: grid;
  min-width: 112px;
  gap: 2px;
  padding: 10px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 6, 17, .45);
}
.brand-hero-metrics b { font: 750 18px var(--mono); }
.brand-hero-metrics small { color: var(--text-faint); font: 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.brand-hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.brand-hero-actions .btn { min-height: 42px; }
.brand-hero-art {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(34px, 4vw, 56px) clamp(24px, 3vw, 44px);
}
.brand-hero-art::after {
  content: "";
  position: absolute;
  left: 13%;
  right: 13%;
  bottom: 8%;
  height: 20%;
  border-radius: 50%;
  background: rgba(139, 92, 246, .3);
  filter: blur(30px);
}
.brand-hero-art img {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(167, 139, 250, .16);
  border-radius: clamp(22px, 2.5vw, 30px);
  background: #090810;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, .38),
    0 0 44px rgba(139, 92, 246, .12);
}
.dashboard-console-head {
  align-items: center;
  margin: 0;
  padding: 4px 2px;
}
.dashboard-console-head h1 { font-size: var(--fz-h2); }
.dashboard-console-head .ph-sub { font-size: var(--fz-sm); }

/* Page header */
.page-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-head .ph-main { min-width: 0; }
.page-head h1 { margin: 6px 0 0; font-size: var(--fz-h1); font-weight: 850; letter-spacing: -0.035em; }
.page-head .ph-sub { color: var(--text-dim); margin-top: 5px; font-size: var(--fz-base); }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* ---------------- KPI ---------------- */
.kpi-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--gap); }
.kpi {
  background: linear-gradient(155deg, rgba(26, 16, 40, .78), rgba(18, 11, 29, .94)); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 15px 16px 16px;
  position: relative; overflow: hidden;
}
.kpi .k-label { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 9px; line-height: 1; }
.kpi .k-foot { color: var(--text-dim); font-size: var(--fz-xs); margin-top: 8px; }
.kpi.accent-mint .k-val { color: var(--mint); }
.kpi.accent-coral .k-val { color: var(--coral); }
.kpi.accent-amber .k-val { color: var(--amber); }

/* ---------------- My Bets: balance / status / stats ---------------- */
/* Consistent vertical rhythm so the strips and the bets list never butt
   together or overlap. */
.mybets-flow { display: flex; flex-direction: column; gap: var(--gap); }
/* Responsive auto-fit grids: cards keep a sensible min width and wrap with even
   gaps instead of being forced into a fixed 5-column track (the cause of the
   overlap/misalignment with 3- and 4-card strips and the zero spacing before
   the bets list). */
.mybets-flow .kpi-strip {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi.kpi-status .k-val { font-size: 26px; }
.kpi.kpi-status.status-on { border-color: color-mix(in oklch, var(--mint) 45%, var(--line-soft)); }
.kpi.kpi-status.status-on .k-val { color: var(--mint); }
.kpi.kpi-status.status-off { border-color: color-mix(in oklch, var(--coral) 45%, var(--line-soft)); }
.kpi.kpi-status.status-off .k-val { color: var(--coral); }

/* ---------------- Match / hero strip ---------------- */
.match-id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.teams { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fz-base); }
.teams .vs { color: var(--text-faint); font-weight: 500; font-size: var(--fz-xs); font-family: var(--mono); }
.teams .t-rad { color: var(--text); }
.teams .t-dire { color: var(--text); }
.match-meta { color: var(--text-dim); font-size: var(--fz-xs); font-family: var(--mono); letter-spacing: .02em; }

.hero-strip { display: flex; gap: 4px; flex-wrap: wrap; }

/* Team logo tile (real logo or monogram fallback) */
.team-logo {
  position: relative; display: inline-grid; flex: none; overflow: hidden;
  border-radius: 6px; border: 1px solid oklch(1 0 0 / .08); background: var(--panel-2);
  vertical-align: middle;
}
.team-logo .img-ph { position: absolute; inset: 0; }
.team-logo .ph-fallback span { font-size: 9px; }
.gs-team .gt-row { display: flex; align-items: center; gap: 10px; }
.gs-team.dire .gt-row { flex-direction: row-reverse; }

/* Hero icon (small square tile) */
.hero-ic {
  width: 30px; height: 30px; border-radius: var(--r-xs); flex: none;
  display: grid; place-items: center; position: relative; overflow: hidden;
  border: 1px solid oklch(1 0 0 / 0.06);
  font-family: var(--mono); font-size: 8.5px; font-weight: 700; color: oklch(1 0 0 / .82);
  letter-spacing: .02em;
}

/* Hero portrait (16:9, uncropped, for live/detail) */
.hero-portrait {
  border-radius: var(--r-sm); overflow: hidden; position: relative;
  border: 1px solid oklch(1 0 0 / 0.07); flex: none;
  display: flex; align-items: flex-end;
}
.hero-portrait .hp-grad { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, oklch(0 0 0 / .72)); }
.hero-portrait .hp-name {
  position: relative; z-index: 1; padding: 4px 6px;
  font-family: var(--mono); font-size: 9px; font-weight: 600; color: oklch(1 0 0 / .92);
  letter-spacing: .02em; line-height: 1.1;
}

/* ---------------- Prob bar ---------------- */
.prob { display: flex; align-items: center; gap: 12px; }
.prob .p-label { font-weight: 700; font-size: var(--fz-base); white-space: nowrap; }
.prob .p-label .num { font-family: var(--mono); }
.prob-track {
  flex: 1; height: 7px; border-radius: 99px; background: var(--input);
  overflow: hidden; position: relative; min-width: 80px;
  border: 1px solid var(--line-soft);
}
.prob-fill { height: 100%; border-radius: 99px; }
.prob-fill.rad { background: linear-gradient(90deg, color-mix(in oklch, var(--mint) 75%, transparent), var(--mint)); }
.prob-fill.dire{ background: linear-gradient(90deg, color-mix(in oklch, var(--coral) 70%, transparent), var(--coral)); }
.prob-fill.skip{ background: var(--text-faint); }

/* Prediction ledger cell: side + pick%, green-vs-red split bar, decision pill */
.pred-cell { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.pred-cell .pred-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pred-cell .pred-side { font-weight: 700; font-size: var(--fz-sm); }
.pred-cell .pred-side.rad, .pred-cell .pred-side.radiant { color: var(--mint); }
.pred-cell .pred-side.dire { color: var(--coral); }
.pred-cell .pred-side.skip { color: var(--text-dim); }
.pred-cell .pred-head .num { font-family: var(--mono); font-weight: 600; font-size: var(--fz-sm); }
.pred-cell .split-bar { width: 100%; }
.pred-cell .pred-pill { display: block; }

/* Split prob bar (radiant vs dire) */
.split-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--input); }
.split-bar .sb-rad { background: var(--mint); }
.split-bar .sb-dire { background: var(--coral); }
.split-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: var(--fz-xs); margin-top: 7px; }
.split-legend .l-rad { color: var(--mint); }
.split-legend .l-dire { color: var(--coral); }

/* ---------------- Ledger table ---------------- */
.ledger { display: flex; flex-direction: column; }
.ledger-head, .ledger-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) 128px minmax(170px, 1.2fr) 86px 118px 84px 104px;
  align-items: center; gap: 16px;
}
.ledger-head > *, .ledger-row > * { min-width: 0; }
.mini-draft { display: flex; flex-direction: column; gap: 3px; }
.mini-draft .md-row { display: flex; gap: 2px; }
.ledger-head {
  padding: 0 18px 10px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
}
.ledger-head .r { text-align: center; }
.ledger-row {
  padding: var(--row-pad-y) 18px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer; transition: background .1s;
}
.ledger-row:hover { background: color-mix(in oklch, var(--panel-2) 60%, transparent); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .r { text-align: center; }
.ledger-row .pnl { font-family: var(--mono); font-weight: 600; }
.ledger-row .odds { font-family: var(--mono); font-size: var(--fz-sm); }
.ledger-row .odds .book { color: var(--text-faint); font-size: var(--fz-2xs); display: block; text-transform: uppercase; letter-spacing: .06em; }
/* My Bets table — own column widths (Match / Pick / Odds / Stake / Result / PnL / Market) */
.bets-table .ledger-head,
.bets-table .ledger-row {
  grid-template-columns: minmax(200px, 1.55fr) 120px 84px 80px minmax(150px, .9fr) 92px 96px;
}
.bets-table .result-status {
  display: block;
  line-height: 1.25;
}
.bets-table .order-status-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: var(--fz-2xs);
  line-height: 1.2;
  text-transform: none;
}

/* ---------------- Filters / search ---------------- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.input, .select {
  background: var(--input); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 8px 11px; font-family: var(--font); font-size: var(--fz-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 16%, transparent); }
.input::placeholder { color: var(--text-faint); }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search .input { padding-left: 33px; min-width: 220px; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px; }
.pagination .pg-info { color: var(--text-dim); font-size: var(--fz-sm); font-family: var(--mono); }
.pagination .pg-btns { display: flex; gap: 6px; }
.pg-num { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); font-family: var(--mono); font-size: var(--fz-sm); cursor: pointer; }
.pg-num:hover { border-color: var(--line-strong); }
.pg-num.on { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.pg-num:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- Empty state ---------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  color: var(--text-dim); background: color-mix(in oklch, var(--panel) 40%, transparent);
}
.empty .e-ic { width: 30px; height: 30px; color: var(--text-faint); }
.empty .e-title { color: var(--text-2); font-weight: 600; }
.empty .e-sub { font-size: var(--fz-sm); color: var(--text-faint); }

/* ---------------- Live board ---------------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: var(--gap); }
.live-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s; }
.live-card:hover { border-color: var(--line-strong); }
.live-card .lc-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); background: color-mix(in oklch, var(--mint-bg) 8%, transparent); }
.live-card .lc-clock { margin-left: auto; font-family: var(--mono); font-size: var(--fz-sm); color: var(--text-2); }
.live-card .lc-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.live-card .lc-foot { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.live-card .lc-foot .lc-right { margin-left: auto; }
.live-score { display: flex; align-items: center; gap: 14px; }
.live-score .ls-side { flex: 1; min-width: 0; }
.live-score .ls-num { font-family: var(--mono); font-size: 26px; font-weight: 600; }
.live-score .ls-rad .ls-num { color: var(--mint); }
.live-score .ls-dire .ls-num { color: var(--coral); }
.live-score .ls-mid { font-family: var(--mono); color: var(--text-faint); }
.gold-lead { font-family: var(--mono); font-size: var(--fz-xs); text-align: center; }

/* ============================================================
   Detail, live game, draft, admin, tiers
   ============================================================ */

/* ---------------- Definition rows / stat list ---------------- */
.dl { display: flex; flex-direction: column; }
.dl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.dl-row:last-child { border-bottom: 0; }
.dl-row .dt { font-family: var(--mono); font-size: var(--fz-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.dl-row .dd { font-weight: 600; text-align: right; }
.dl-row .dd.mono { font-family: var(--mono); }

/* Prediction detail summary cards */
.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.sum-grid.two { grid-template-columns: 1fr 1fr; }
.sum-card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; }
.sum-card .s-label { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.sum-card .s-val { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.01em; line-height: 1; }
.sum-card .s-val.mono { font-family: var(--mono); font-weight: 600; }
.sum-card .s-foot { color: var(--text-dim); font-size: var(--fz-xs); margin-top: auto; padding-top: 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: var(--gap); }
.detail-grid.no-factors { grid-template-columns: 1fr 1fr 1fr; }
.detail-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; margin-bottom: 18px; }
.detail-hero .dh-call { font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.detail-hero .dh-call.rad { color: var(--mint); }
.detail-hero .dh-call.dire { color: var(--coral); }
.detail-hero .dh-call.skip { color: var(--text-dim); }
/* draft card: centered, compact hero portrait tiles (matches the mock) */
.draft-body { display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.draft-body .draftgrp { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.draftgrp .dgh { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.draftgrp .dgh.rad { color: var(--mint); }
.draftgrp .dgh.dire { color: var(--coral); }
.draft-body .hrow { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.draft-body .hic { width: 48px; height: 48px; border-radius: var(--r-sm); }
.factor-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.factor-row .f-name { width: 130px; flex: none; font-size: var(--fz-sm); color: var(--text-2); }
.factor-row .f-val { margin-left: auto; font-family: var(--mono); font-size: var(--fz-sm); font-weight: 600; width: 52px; text-align: right; }
/* ---------------- Game state header (integrated) ---------------- */
.gs-header {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  padding: 20px 24px; border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(80% 140% at 0% 50%, color-mix(in oklch, var(--mint-bg) 14%, transparent), transparent 60%),
    radial-gradient(80% 140% at 100% 50%, color-mix(in oklch, var(--coral-bg) 16%, transparent), transparent 60%);
}
.gs-team { display: flex; flex-direction: column; gap: 4px; }
.gs-team.rad { align-items: flex-start; }
.gs-team.dire { align-items: flex-end; text-align: right; }
.gs-team .gt-side { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.gs-team.rad .gt-side { color: var(--mint); }
.gs-team.dire .gt-side { color: var(--coral); }
.gs-team .gt-name { font-weight: 700; font-size: var(--fz-h2); letter-spacing: -.01em; }
.gs-center { text-align: center; }
.gs-center .gc-clock { font-family: var(--mono); font-size: var(--fz-xs); color: var(--text-dim); letter-spacing: .1em; }
.gs-center .gc-score { font-family: var(--mono); font-size: 38px; font-weight: 700; display: flex; align-items: center; gap: 14px; line-height: 1; margin: 4px 0; justify-content: center; }
.gs-center .gc-score .sc-rad { color: var(--mint); } .gs-center .gc-score .sc-dire { color: var(--coral); } .gs-center .gc-score .sc-dash { color: var(--text-faint); font-size: 24px; }
.gs-center .gc-gold { font-family: var(--mono); font-size: var(--fz-xs); color: var(--amber); }
.gs-center .gc-gold.dire-lead { color: var(--coral); }
.gs-center .gc-gold.unknown { color: var(--text-faint); }

/* Players grid */
.players-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.players-cols .pc { padding: 18px 20px; }
.players-cols .pc.rad { border-right: 1px solid var(--line-soft); }
.pc-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 12px; font-size: var(--fz-h3); }
.pc-head .ph-side { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.pc.rad .ph-side { color: var(--mint); border-color: color-mix(in oklch, var(--mint) 40%, var(--line)); }
.pc.dire .ph-side { color: var(--coral); border-color: color-mix(in oklch, var(--coral) 40%, var(--line)); }

.player {
  display: grid; grid-template-columns: 78px 1fr; gap: 13px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.player:last-child { border-bottom: 0; }
.player .p-portrait { width: 78px; height: 44px; }
.player .p-main { min-width: 0; }
.player .p-top { display: flex; align-items: baseline; gap: 8px; }
.player .p-name { font-weight: 700; font-size: var(--fz-sm); }
.player .p-hero { color: var(--text-dim); font-size: var(--fz-xs); }
.player .p-kda { margin-left: auto; font-family: var(--mono); font-size: var(--fz-xs); font-weight: 600; }
.player .p-kda .k { color: var(--mint); } .player .p-kda .d { color: var(--coral); } .player .p-kda .a { color: var(--text-2); } .player .p-kda .sl { color: var(--text-faint); }
.player .p-net { font-family: var(--mono); font-size: var(--fz-2xs); color: var(--amber); }
.player .p-net.unknown { color: var(--text-faint); }

.item-empty { color: var(--text-faint); font-size: var(--fz-xs); font-style: italic; padding: 4px 0; }

/* ---------------- Building / summary tiles ---------------- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.stat-tile { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 13px 15px; }
.stat-tile .st-label { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.stat-tile .st-val { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 6px; }
.stat-tile .st-val.small { font-size: 16px; }
.stat-tile .st-foot { color: var(--text-dim); font-size: var(--fz-xs); margin-top: 4px; }

/* ---------------- Draft Lab ---------------- */
.draft-lab { display: grid; grid-template-columns: 1fr 340px; gap: var(--gap); align-items: start; }
.draft-board { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.draft-side { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 16px; }
.draft-side.rad { border-top: 2px solid var(--mint); }
.draft-side.dire { border-top: 2px solid var(--coral); }
.draft-side.rad.picking { outline: 1px solid var(--mint); }
.draft-side.dire.picking { outline: 1px solid var(--coral); }
.draft-side .ds-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.draft-side .ds-head .ds-count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.draft-slots { display: flex; flex-direction: column; gap: 7px; }
.draft-class-group { display: grid; gap: 7px; padding: 9px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: color-mix(in srgb, var(--panel-2) 72%, transparent); }
.draft-class-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-dim); font-size: var(--fz-xs); }
.draft-class-head span { font: var(--fz-2xs) var(--mono); color: var(--text-faint); }
.draft-slot {
  display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--r-sm);
  border: 1px dashed var(--line); background: var(--input); cursor: pointer; transition: .12s; min-height: 52px;
}
.draft-slot:hover { border-color: var(--line-strong); }
.draft-slot.filled { border-style: solid; background: var(--panel-2); }
.draft-slot .slot-pos { font-family: var(--mono); font-size: var(--fz-2xs); color: var(--text-faint); width: 68px; flex: none; }
.draft-slot .slot-name { font-weight: 600; font-size: var(--fz-sm); }
.draft-slot .slot-empty { color: var(--text-faint); font-size: var(--fz-sm); font-style: italic; }
.draft-slot .slot-x { margin-left: auto; color: var(--text-faint); cursor: pointer; opacity: 0; background: none; border: none; display: grid; place-items: center; padding: 2px; }
.draft-slot:hover .slot-x { opacity: 1; }

/* Slot-click hero picker (modal) */
.picker-scrim { position: fixed; inset: 0; background: oklch(0 0 0 / .55); z-index: 90; }
.hero-picker {
  position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, 94vw); max-height: min(640px, 86vh);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--sh-pop); display: flex; flex-direction: column; overflow: hidden;
}
.hero-picker .hp-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.hero-picker .hp-head h3 { margin: 0; font-size: var(--fz-h3); }
.hero-picker .hp-head .x { margin-left: auto; cursor: pointer; color: var(--text-dim); background: none; border: none; display: grid; place-items: center; }
.hero-picker .hp-search { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.hero-picker .hp-search .input { width: 100%; }
.hp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  grid-auto-rows: max-content;
  gap: 8px; padding: 14px 16px 18px; overflow-y: auto;
}
.hp-hero {
  display: flex; flex-direction: column; gap: 6px; padding: 7px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--panel-2); cursor: pointer; transition: .1s; text-align: center;
}
.hp-hero:hover { border-color: var(--coral); transform: translateY(-1px); }
.hp-hero.used { opacity: .28; pointer-events: none; }
.hp-hero .hp-art { width: 100%; aspect-ratio: 256/144; border-radius: var(--r-xs); position: relative; overflow: hidden; flex: 0 0 auto; }
.hp-hero .hp-name { font-size: var(--fz-xs); font-weight: 600; color: var(--text-2); line-height: 1.15; }

.draft-result { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 18px; position: sticky; top: 80px; }
.draft-result .dr-prob { text-align: center; padding: 8px 0 16px; }
.draft-result .dr-prob .num { font-family: var(--mono); font-size: 46px; font-weight: 700; line-height: 1; }
.draft-result .dr-prob .side { font-family: var(--mono); font-size: var(--fz-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }
.draft-error { color: var(--coral); font-size: var(--fz-sm); margin-top: 10px; text-align: center; min-height: 18px; line-height: 1.4; }

/* ---------------- Tiers ---------------- */
.tiers-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.tier-card { border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 24px; background: var(--panel); position: relative; }
.tier-card.pro { border-color: color-mix(in oklch, var(--coral) 40%, var(--line)); background: linear-gradient(160deg, color-mix(in oklch, var(--coral-bg) 26%, var(--panel)), var(--panel)); }
.tier-card.vip { border-color: color-mix(in oklch, var(--amber) 42%, var(--line)); background: linear-gradient(160deg, color-mix(in oklch, var(--amber-bg) 24%, var(--panel)), var(--panel)); }
.tier-card .tc-name { font-family: var(--mono); font-size: var(--fz-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }
.tier-card .tc-price { font-size: 34px; font-weight: 800; margin: 8px 0 4px; letter-spacing: -.02em; }
.tier-card .tc-price small { font-size: var(--fz-sm); color: var(--text-dim); font-weight: 500; }
.tier-card ul { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.tier-card li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fz-sm); color: var(--text-2); }
.tier-card li .ch { color: var(--mint); flex: none; margin-top: 1px; }
.tier-card.pro li .ch { color: var(--coral); }

/* ---------------- Admin ---------------- */
.operator-shell {
  --r-lg: 12px;
  --r-md: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.operator-page-head {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(110deg, rgba(139, 92, 246, .11), rgba(18, 11, 29, .7) 48%);
}
.operator-session-meta { display: flex; align-items: center; gap: 16px; }
.operator-session-meta .mini-field { display: grid; gap: 3px; min-width: 54px; }
.operator-session-meta .mini-field > label {
  color: var(--text-faint);
  font: 9px var(--mono);
  letter-spacing: .09em;
  line-height: 1;
  text-transform: uppercase;
}
.operator-session-meta .mini-field > span {
  color: var(--text);
  font-size: var(--fz-xs);
  line-height: 1.2;
}
.operator-shell .panel { border-radius: 12px; }
.operator-shell .panel-pad { padding: 14px 16px; }
.operator-shell .panel-head { padding: 12px 16px; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab { padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim); font-weight: 600; font-size: var(--fz-sm); cursor: pointer; }
.admin-tab:hover { color: var(--text); border-color: var(--line-strong); }
.admin-tab.on {
  background: linear-gradient(110deg, rgba(139, 92, 246, .28), rgba(237, 79, 155, .14));
  color: var(--text);
  border-color: rgba(139, 92, 246, .48);
}

.admin-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--gap); align-items: stretch; }
.admin-col { display: flex; flex-direction: column; gap: 16px; }
/* Right-hand panel stretches to match the left column height */
.admin-grid > .panel.fill-col { display: flex; flex-direction: column; }
.admin-grid > .panel.fill-col .tourn-list { flex: 1; min-height: 0; overflow-y: auto; }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.health-card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 15px 16px; }
.health-card .hc-label { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.health-card .hc-val { font-family: var(--mono); font-size: 22px; font-weight: 600; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; }

.tourn-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.tourn-row:last-child { border-bottom: 0; }
.tourn-row .tr-main { min-width: 0; }
.tourn-row .tr-name { font-weight: 600; font-size: var(--fz-sm); }
.tourn-row .tr-src { display: flex; gap: 5px; margin-top: 6px; }
.tourn-row .tr-counts { margin-left: auto; text-align: right; font-family: var(--mono); font-size: var(--fz-xs); color: var(--text-dim); white-space: nowrap; }
.tourn-row .tr-counts .tr-next { font-size: 10px; color: var(--text-faint); }
.admin-user,
.admin-tournament { min-width: 0; }
.admin-user .tr-counts { min-width: 220px; white-space: normal; }
.admin-user .tr-counts .input { width: 100%; margin-top: 6px; }
.src-chip { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; padding: 2px 6px; border-radius: var(--r-xs); border: 1px solid var(--line); color: var(--text-dim); }
.src-chip.grid { color: var(--sky); border-color: color-mix(in oklch, var(--sky) 40%, var(--line)); }
.src-chip.hawk { color: var(--amber); border-color: color-mix(in oklch, var(--amber) 40%, var(--line)); }

.toggle { width: 38px; height: 22px; border-radius: 99px; background: var(--input); border: 1px solid var(--line); position: relative; cursor: pointer; flex: none; transition: .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: .15s; }
.toggle.on { background: color-mix(in oklch, var(--mint) 40%, var(--input)); border-color: color-mix(in oklch, var(--mint) 50%, var(--line)); }
.toggle.on::after { left: 18px; background: var(--mint); }
.toggle.busy { opacity: .5; pointer-events: none; }

/* ============================================================
   Hero Features, ML Labeling, Tweaks, image fallbacks, login
   ============================================================ */

/* ---------------- Image + fallback (real CDN art) ---------------- */
.img-ph { position: relative; overflow: hidden; background: var(--panel-2); }
/* The img must paint ABOVE the branded fallback (which sits inset:0) so a
   loaded image actually covers the monogram placeholder. */
.img-ph img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.img-ph.icon img { object-fit: contain; }
.ph-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; color: oklch(1 0 0 / .82);
  letter-spacing: .02em; text-align: center; line-height: 1;
}
.ph-fallback::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(125deg, transparent 0 6px, oklch(0 0 0 / .15) 6px 7px);
}
.ph-fallback span { position: relative; z-index: 1; text-shadow: 0 1px 2px oklch(0 0 0 / .6); padding: 2px; }

/* ---------------- ML Labeling (rebuilt) ---------------- */
.lab-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.lab-progress { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.lab-progress .lp-count { font-family: var(--mono); font-size: var(--fz-h3); font-weight: 600; }
.lab-progress .lp-count b { color: var(--mint); }
.lab-progress .bar { width: 200px; height: 8px; border-radius: 99px; background: var(--input); overflow: hidden; border: 1px solid var(--line-soft); }
.lab-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint-dim), var(--mint)); }

.lab-stage { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.lab-sample-meta { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--line-soft); }
.lab-sample-meta .sample-id { font-family: var(--mono); font-size: var(--fz-sm); color: var(--text-dim); }
.lab-sample-meta .ls-right { margin-left: auto; }

.lab-draft { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 0; }
.lab-team { padding: 26px 28px; position: relative; }
.lab-team.rad { background: linear-gradient(180deg, color-mix(in oklch, var(--mint-bg) 12%, transparent), transparent 60%); }
.lab-team.dire { background: linear-gradient(180deg, color-mix(in oklch, var(--coral-bg) 14%, transparent), transparent 60%); }
.lab-team .lt-label { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: var(--fz-xs); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 16px; }
.lab-team.rad .lt-label { color: var(--mint); }
.lab-team.dire .lt-label { color: var(--coral); justify-content: flex-end; }
.lab-heroes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lab-hero { display: flex; flex-direction: column; gap: 6px; }
.lab-hero .lh-portrait { width: 100%; aspect-ratio: 256/144; border-radius: var(--r-sm); }
.lab-hero .lh-name { font-size: var(--fz-xs); font-weight: 600; text-align: center; line-height: 1.15; color: var(--text-2); }
.lab-hero .lh-role { font-family: var(--mono); font-size: 8.5px; color: var(--text-faint); text-align: center; min-height: 11px; }
.lab-vs { display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.lab-vs span { font-family: var(--mono); font-size: var(--fz-h3); color: var(--text-faint); font-weight: 600; }

/* Probability ruler (click to label) */
.lab-ruler-wrap { padding: 24px 28px 28px; border-top: 1px solid var(--line-soft); }
.lab-ruler-wrap.no-top { padding-top: 0; border-top: none; }
.ruler-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: var(--fz-xs); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.ruler-legend .rl-dire { color: var(--coral); } .ruler-legend .rl-mid { color: var(--text-faint); } .ruler-legend .rl-rad { color: var(--mint); }
.ruler {
  display: flex; gap: 2px; height: 72px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line); position: relative; background: var(--input);
}
.prob-ruler {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}
.ruler-bucket {
  flex: 1; position: relative; cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px; transition: .08s; border: none; background: transparent;
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: oklch(1 0 0 / .55);
}
.ruler-bucket::before {
  content: ""; position: absolute; inset: 0; opacity: .42; transition: opacity .1s;
  background: var(--bucket-color);
}
.ruler-bucket:hover { color: oklch(1 0 0 / .95); }
.ruler-bucket:hover::before { opacity: .72; }
.ruler-bucket.chosen::before { opacity: 1; }
.ruler-bucket.chosen { color: oklch(0.16 0.01 60); }
.ruler-bucket .rb-num { position: relative; z-index: 1; }
.ruler-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: oklch(1 0 0 / .35); z-index: 2; }
.ruler-hint { text-align: center; margin-top: 12px; color: var(--text-faint); font-size: var(--fz-xs); }
.ruler-hint b { color: var(--text-2); }

/* Label history strip */
.lab-history { margin-top: 18px; }
.lab-history .lh-title { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hist-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.hist-chip {
  flex: none; width: 96px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 8px; cursor: pointer; background: var(--panel-2); transition: .1s;
}
.hist-chip:hover { border-color: var(--line-strong); }
.hist-chip.current { border-color: var(--coral); }
.hist-chip .hc-id { font-family: var(--mono); font-size: 9px; color: var(--text-faint); }
.hist-chip .hc-val { font-family: var(--mono); font-size: 18px; font-weight: 700; margin-top: 3px; }
.hist-chip .hc-val.rad { color: var(--mint); } .hist-chip .hc-val.dire { color: var(--coral); }
.hist-chip .hc-mini { display: flex; gap: 1px; margin-top: 6px; }
.hist-chip .hc-mini i { flex: 1; height: 3px; border-radius: 2px; }

/* ---------------- Tweaks panel ---------------- */
.tweak-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-2);
}
.tweak-fab:hover { background: var(--raised); }
.tweak-panel {
  position: fixed; right: 22px; bottom: 80px; z-index: 60; width: 300px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--sh-pop); overflow: hidden;
}
.tweak-panel .tp-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.tweak-panel .tp-head h3 { margin: 0; font-size: var(--fz-h3); }
.tweak-panel .tp-head .x { margin-left: auto; cursor: pointer; color: var(--text-dim); background: none; border: none; display: grid; place-items: center; }
.tweak-panel .tp-body { padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.tweak-row label { display: block; font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-card { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--sh-2); }
.login-card .lc-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.login-card h1 { margin: 0 0 6px; font-size: var(--fz-h1); letter-spacing: -.02em; text-align: center; }
.login-card .lc-sub { color: var(--text-dim); font-size: var(--fz-sm); text-align: center; margin-bottom: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-error { color: var(--coral); font-size: var(--fz-sm); text-align: center; min-height: 18px; }

/* message toast */
.admin-msg { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid color-mix(in oklch, var(--mint) 35%, var(--line)); background: color-mix(in oklch, var(--mint-bg) 25%, var(--panel)); color: var(--text-2); font-size: var(--fz-sm); }
.admin-msg.error { border-color: color-mix(in oklch, var(--coral) 40%, var(--line)); background: color-mix(in oklch, var(--coral-bg) 25%, var(--panel)); }

.footnote { color: var(--text-dim); font-size: 12px; margin-top: 14px; display: flex; gap: 7px; align-items: center; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 821px) and (max-width: 1399px) {
  .ledger-head, .ledger-row {
    grid-template-columns: minmax(160px, 1.45fr) 100px minmax(126px, 1.1fr) 68px 84px 64px 78px;
    gap: 10px;
  }
  .bets-table .ledger-head,
  .bets-table .ledger-row {
    grid-template-columns: minmax(170px, 1.45fr) 104px 68px 68px minmax(120px, .9fr) 72px 78px;
  }
}
@media (max-width: 1100px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .detail-grid, .sum-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid.no-factors { grid-template-columns: 1fr 1fr; }
  .detail-hero { grid-template-columns: 1fr; }
  .draft-lab { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
.menu-btn { display: none; }
@media (max-width: 1279px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 80;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: none; box-shadow: var(--sh-pop); }
  .scrim { position: fixed; inset: 0; background: oklch(0 0 0 / .5); z-index: 70; }
  .menu-btn { display: grid; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 80; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--sh-pop); }
  .scrim { position: fixed; inset: 0; background: oklch(0 0 0 / .5); z-index: 70; }
  .content { padding: 18px 16px 80px; }
  .topbar { padding: 12px 16px; }
  .menu-btn { display: grid; }

  /* Ledger → cards */
  .ledger-head { display: none; }
  .ledger-row { grid-template-columns: 1fr; gap: 10px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); margin-bottom: 10px; }
  .ledger-row .r { text-align: left; }
  .ledger-row .lr-cell { display: flex; justify-content: space-between; align-items: center; }
  .ledger-row .lr-cell::before { content: attr(data-l); font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }

  .sum-grid, .stat-tiles { grid-template-columns: 1fr 1fr; }
  .detail-grid, .detail-grid.no-factors { grid-template-columns: 1fr; }
  .players-cols { grid-template-columns: 1fr; }
  .players-cols .pc.rad { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .gs-header { grid-template-columns: 1fr; gap: 14px; text-align: center; }
  .gs-team.dire { align-items: center; text-align: center; }
  .gs-team.rad { align-items: center; }
  .lab-draft { grid-template-columns: 1fr; }
  .lab-vs { padding: 8px; }
  .tiers-grid { grid-template-columns: 1fr; }
  .draft-board { grid-template-columns: 1fr; }
  .live-grid { grid-template-columns: 1fr; }
  .brand-hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .brand-hero-copy { padding: 40px 24px 20px; }
  .brand-hero-art { min-height: 310px; padding: 12px 24px 32px; }
  .brand-hero-art img { width: min(82%, 380px); }
  .dashboard-console-head .ph-actions { display: none; }
}

/* ---- Account page (2-column redesign) ---- */
.acc-layout { max-width: 1180px; margin: 0 auto; }
.acc-grid2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }
.acc-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.acc-rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }

.acard { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 18px 20px; }
.acard .ah { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.acard .ah svg { width: 17px; height: 17px; color: var(--text-2); flex: none; }
.acard .asub { color: var(--text-dim); font-size: 13px; margin-top: 8px; line-height: 1.5; }
.acard .asub b, .acard .asub strong { color: var(--text); }
.acard.ok { border-color: color-mix(in oklch, var(--mint) 32%, var(--line)); background: linear-gradient(160deg, color-mix(in oklch, var(--mint-bg) 16%, var(--panel)), var(--panel)); }
.acard.ok .ah svg { color: var(--mint); }
.acard.secure { background: color-mix(in oklch, var(--mint-bg) 14%, var(--panel)); border-color: color-mix(in oklch, var(--mint) 26%, var(--line)); }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kv { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-soft); border-radius: var(--r-pill); padding: 5px 11px; white-space: nowrap; }
.kv .k { font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); }
.kv code { font-family: var(--mono); }

.steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.steps .sn { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); margin-top: 1px; }
.steps .stxt { flex: 1; min-width: 0; }
.steps li b { color: var(--text); }
.steps .neg { color: var(--coral); font-weight: 600; }
.code { font-family: var(--mono); font-size: 13px; color: var(--mint); background: var(--input); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; margin-top: 9px; overflow-x: auto; }
.note-good { margin-top: 14px; padding: 13px 15px; border-radius: var(--r-md); border: 1px solid color-mix(in oklch, var(--mint) 30%, var(--line)); background: color-mix(in oklch, var(--mint-bg) 20%, transparent); font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.note-good b { color: var(--text); }

.acard .actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.rail-links { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rail-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); background: var(--panel-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: .12s; white-space: nowrap; color: inherit; }
.rail-link:hover { border-color: var(--line-strong); background: var(--raised); }
.rail-link svg { width: 15px; height: 15px; color: var(--text-2); flex: none; }
.rail-link .stxt { flex: 1; min-width: 0; }
.rail-link .ext { margin-left: auto; color: var(--text-faint); }

@media (max-width: 1080px) {
  .acc-grid2 { grid-template-columns: 1fr; }
  .acc-rail { position: static; }
}

/* ---- Model Lab (admin research) ---- */
.ml-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ml-bar-note { color: var(--text-dim); font-size: var(--fz-sm); }
.ml-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.ml-left { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.ml-prof { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fz-sm); }
.ml-prof .input { padding: 6px 8px; max-width: 230px; }
.ml-runs .panel-head .sub, .ml-snaps .panel-head .sub { margin-left: auto; color: var(--text-faint); }
.ml-run-list { max-height: 52vh; overflow-y: auto; }
.ml-snap-list { max-height: 26vh; overflow-y: auto; }
.ml-snap-row { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.ml-snap-row:last-child { border-bottom: 0; }
.ml-run-row { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.ml-run-row:hover { background: var(--panel-2); }
.ml-run-row.on { background: color-mix(in oklch, var(--coral-bg) 18%, var(--panel)); border-left: 3px solid var(--coral); padding-left: 13px; }
.ml-run-row .mrr-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ml-run-row .mrr-meta { font-size: var(--fz-2xs); margin-top: 3px; }
.ml-run-row .mrr-headline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ml-run-row .mrr-headline .kv { font-size: var(--fz-xs); border: 1px solid var(--line-soft); border-radius: var(--r-pill); padding: 2px 8px; white-space: nowrap; }
.ml-run-row .mrr-headline .k { font-family: var(--mono); color: var(--text-faint); text-transform: uppercase; font-size: 9px; letter-spacing: .06em; }
.ml-detail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ml-detail .section-title { margin-top: 4px; }
.ml-metrics, .ml-cases { width: 100%; border-collapse: collapse; font-size: var(--fz-sm); }
.ml-metrics th, .ml-cases th { text-align: right; font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ml-metrics th:first-child, .ml-cases th:first-child { text-align: left; }
.ml-metrics td, .ml-cases td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.ml-metrics td:first-child, .ml-cases td:first-child { text-align: left; }
.ml-metrics tr:last-child td, .ml-cases tr:last-child td { border-bottom: 0; }
.ml-calib-wrap { display: flex; flex-wrap: wrap; gap: 16px 26px; margin-top: 14px; }
.ml-calib { flex: 1; min-width: 240px; }
.ml-calib-h { font-size: var(--fz-2xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
.ml-calib-row { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fz-xs); padding: 3px 0; }

/* ---- setup panel ---- */
.ml-setup { margin-bottom: 12px;padding:12px 14px; }
.ml-setup-head { display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:10px; }
.ml-setup-head h2 { margin:2px 0 0;font-size:18px; }
.ml-setup-grid { display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr) minmax(0,.65fr);gap:10px;align-items:start; }
.ml-setup-grid-benchmark { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr) minmax(0,.65fr) 160px; }
.ml-setup-grid > .ml-field { min-width: 0; }
.ml-field { display: flex; flex-direction: column; gap: 6px; }
.ml-field > label { font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.ml-field > .ml-field-placeholder { visibility:hidden; }
.ml-field .input { padding:7px 9px;min-width:0;width:100%; }
.ml-mode-field { min-width:0; }
.ml-fixed-model { display:flex;align-items:center;gap:6px;min-height:34px;padding:7px 9px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--input);font-size:12px; }
.ml-fixed-model span { margin-left:auto;color:var(--text-faint);font:9px var(--mono);text-transform:uppercase; }
.ml-field-run { align-self:start;width:160px; }
.ml-field-run .btn { min-height:34px;width:100%;white-space:nowrap; }
.ml-field-help { display:block;max-width:310px;color:var(--text-faint);font-size:10px;line-height:1.35; }
.ml-set-meta { min-height:1.4em;margin-top:4px;max-width:100%;overflow:hidden;color:var(--text-faint);font-size:var(--fz-2xs);line-height:1.4;text-overflow:ellipsis;white-space:nowrap; }
.ml-run-note { max-width:310px;margin-top:6px;color:var(--text-dim);font-size:10px;line-height:1.35; }
.ml-run-options { margin-top:9px;border-top:1px solid var(--line-soft);padding-top:8px; }
.ml-run-options > summary { cursor:pointer;width:max-content;color:var(--text-dim);font-size:var(--fz-xs); }
.ml-run-options > .ml-field { margin-top:10px; }
.ml-history-drawer { margin-bottom:14px;border:1px solid var(--line-soft);border-radius:var(--r-md);background:var(--panel); }
.ml-history-drawer > summary { display:flex;align-items:center;gap:7px;cursor:pointer;padding:11px 14px;color:var(--text-dim);font-size:var(--fz-sm); }
.ml-history-drawer > summary span { margin-left:auto;color:var(--text-faint);font:10px var(--mono); }
.ml-history-grid { display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,.55fr);gap:12px;padding:12px;border-top:1px solid var(--line-soft); }
.ml-history-grid-single { grid-template-columns:1fr; }
.inspector-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}
.inspector-search { position: sticky; top: 84px; min-width: 0; }
.inspector-search form { display: flex; gap: 8px; }
.inspector-search form .input { min-width: 0; width: 100%; }
.inspector-search-results { display: grid; gap: 8px; margin-top: 12px; max-height: 68vh; overflow: auto; }
.inspector-search-result { width: 100%; min-width: 0; padding: 13px 14px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: inherit; cursor: pointer; }
.inspector-search-result:hover { border-color: var(--line-strong); background: var(--panel-2); }
.inspector-search-result.active { border-color: var(--mint); background: color-mix(in oklch, var(--mint-bg) 24%, var(--panel)); }
.inspector-search-result > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inspector-search-result small { display: block; margin-top: 6px; color: var(--text-dim); line-height: 1.4; overflow-wrap: anywhere; }
.inspector-workspace { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.inspector-game .panel-head > div { min-width: 0; }
.inspector-game .panel-head h2 { margin-top: 5px; overflow-wrap: anywhere; }
.inspector-draft { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.inspector-draft-side { min-width: 0; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel-2); }
.inspector-draft-label { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; color: var(--text-dim); font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .08em; text-transform: uppercase; }
.inspector-draft-label b { min-width: 0; margin-left: auto; color: var(--text); font-family: var(--sans); font-size: var(--fz-sm); letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
.inspector-draft-side .hrow { display: flex; flex-wrap: wrap; gap: 8px; }
.inspector-draft-side .hic { width: 48px; height: 48px; border-radius: var(--r-sm); }
.inspector-primary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.inspector-call { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.inspector-call > div, .inspector-inputs > div, .inspector-model-result { display: flex; flex-direction: column; gap: 7px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel-2); min-width: 0; }
.inspector-call .s-label, .inspector-inputs span { color: var(--text-dim); font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .09em; text-transform: uppercase; }
.inspector-call strong { font-size: var(--fz-h3); overflow-wrap: anywhere; }
.inspector-call > div > span:last-child { color: var(--text-dim); font-size: var(--fz-sm); }
.inspector-why { margin-top: 18px; }
.inspector-why h3 { margin: 0 0 10px; font-size: var(--fz-sm); }
.inspector-inputs { display: grid; gap: 9px; }
.inspector-inputs b { line-height: 1.4; overflow-wrap: anywhere; }
.inspector-actions .btn[data-inspector-run] { margin-top: 4px; }
.inspector-benchmark, .inspector-technical { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.inspector-benchmark > summary, .inspector-technical > summary { color: var(--text-2); cursor: pointer; font-weight: 650; }
.inspector-benchmark-body { display: grid; gap: 9px; margin-top: 12px; }
.inspector-benchmark-body .input { width: 100%; min-width: 0; }
.inspector-benchmark-body .note-good { margin-top: 0; }
.inspector-result { min-width: 0; }
.inspector-preview-note { margin-bottom: 14px; line-height: 1.55; }
.inspector-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.inspector-model-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inspector-model-call { font-size: var(--fz-h3); font-weight: 750; overflow-wrap: anywhere; }
.inspector-model-call span { color: var(--mint); white-space: nowrap; }
.inspector-technical[open] { display: grid; gap: 14px; }
.inspector-technical h3 { margin: 8px 0 0; font-size: var(--fz-sm); }
.inspector-wrap { max-width: 100%; overflow-wrap: anywhere; }
.inspector-warning-list { margin: 0; padding-left: 20px; color: var(--text-dim); font-size: var(--fz-sm); }
@media (max-width: 1100px) {
  .inspector-layout { grid-template-columns: 1fr; }
  .inspector-search { position: static; }
  .inspector-search-results { max-height: 38vh; }
}
@media (max-width: 680px) {
  .inspector-search form, .inspector-draft, .inspector-primary-grid, .inspector-call { grid-template-columns: 1fr; flex-direction: column; }
  .inspector-search form .btn { width: 100%; justify-content: center; }
  .inspector-draft-label { align-items: flex-start; flex-wrap: wrap; }
  .inspector-draft-label b { width: 100%; margin-left: 0; }
}
.ml-seg { display: inline-flex; background: var(--input); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.ml-seg button { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: var(--fz-sm); padding: 6px 12px; border-radius: calc(var(--r-sm) - 2px); cursor: pointer; }
.ml-seg button.on { background: var(--raised); color: var(--text); box-shadow: var(--sh-1); }
.ml-modelsel { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ml-slots { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.ml-slot { display: flex; align-items: center; gap: 6px; }
.ml-slot .input { min-width: 170px; }
.ml-slot-x { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: inline-flex; padding: 2px; border-radius: 50%; }
.ml-slot-x:hover { color: var(--coral); background: color-mix(in oklch, var(--coral) 16%, transparent); }
.ml-add-slot { border: 1px dashed var(--line); background: transparent; color: var(--text-dim); font: inherit; font-size: var(--fz-xs); padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.ml-add-slot:hover { color: var(--text); border-color: var(--line-strong); }
.ml-field-models { flex: 1 1 auto; }
.ml-field-run { margin-left: auto; }
/* ---- bet policy inputs ---- */
.ml-field-policy > label .dim { text-transform: none; letter-spacing: 0; }
.ml-policy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ml-pol { display: inline-flex; flex-direction: column; gap: 4px; }
.ml-pol .pl { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--text-faint); }
.ml-pol .input { min-width: 0; width: 84px; padding: 7px 8px; }

/* ---- run-row mode badge ---- */
.ml-badge { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--text-faint); margin-right: 4px; }
.ml-badge.cmp { color: var(--amber); border-color: color-mix(in oklch, var(--amber) 38%, var(--line)); }

/* ---- detail head + primary metrics table ---- */
.ml-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ml-detail-title { display: flex; align-items: center; gap: 8px; }
.ml-detail-title h2 { margin:0;font-size:22px; }
.ml-run-hero .ml-detail-head { margin:0; }
.ml-run-sub { margin-top:5px;color:var(--text-dim);font-size:var(--fz-xs); }
.ml-summary-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px; }
.ml-summary-card { display:grid;gap:4px;padding:14px;border:1px solid var(--line-soft);border-radius:var(--r-md);background:var(--panel); }
.ml-summary-card span { color:var(--text-dim);font-size:var(--fz-xs); }
.ml-summary-card strong { font:700 25px var(--mono); }
.ml-summary-card small { color:var(--text-faint); }
.ml-research-details { border:1px solid var(--line-soft);border-radius:var(--r-md);background:var(--panel); }
.ml-research-details > summary { cursor:pointer;padding:12px 16px;color:var(--text-dim);font-size:var(--fz-sm); }
.ml-research-details[open] > summary { border-bottom:1px solid var(--line-soft); }
.ml-research-details > .section-title,.ml-research-details > .panel,.ml-research-details > details { margin-left:12px;margin-right:12px; }
.ml-metrics.ml-primary { font-size: 14px; }
.ml-metrics.ml-primary td:first-child { color: var(--text-dim); }
.ml-metrics.ml-primary tbody tr:hover { background: var(--panel-2); }
.ml-ci { font-size: var(--fz-2xs); margin-top: 1px; }
.ml-table-note { font-size: var(--fz-xs); margin-top: 10px; }
.ml-legacy { display: flex; align-items: center; gap: 8px; font-size: var(--fz-sm); }
.ml-legacy svg { flex: none; }

/* ---- reliability disclosure (calibration buckets only) ---- */
.ml-advanced { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.ml-advanced > summary { cursor: pointer; padding: 12px 16px; font-size: var(--fz-sm); color: var(--text-dim); font-family: var(--mono); letter-spacing: .03em; }
.ml-advanced[open] > summary { border-bottom: 1px solid var(--line-soft); color: var(--text); }

/* ---- compare highlighting: TEXT color only (no cell fill) ---- */
.ml-compare td.pos { font-weight: 650; }
.ml-compare td.neg { font-weight: 650; }

/* ---- expandable per-case ---- */
.ml-case-row { cursor: pointer; transition: background .12s; }
.ml-case-row:hover { background: var(--panel-2); }
.ml-case-row.open { background: color-mix(in oklch, var(--coral-bg) 12%, var(--panel)); }
.ml-case-row td:first-child svg { vertical-align: -1px; color: var(--text-faint); }
.ml-case-row .mlc-match { display: flex; align-items: center; gap: 6px; }
.ml-view-breakdown { margin-left:auto;color:var(--text-faint);font-size:10px;font-weight:500;white-space:nowrap; }
.ml-case-row .mlc-sub { font-size: var(--fz-2xs); margin-top: 2px; padding-left: 19px; }
.ml-case-detail > td { text-align: left; white-space: normal; background: var(--panel-2); padding: 12px 16px 14px; }
.ml-case-drafts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; font-size: var(--fz-sm); }
.ml-case-drafts .draftgrp { display: flex; flex-direction: column; gap: 7px; }
.ml-case-drafts .dgh { margin-bottom: 1px; }
.ml-case-drafts .hrow { display: flex; gap: 6px; flex-wrap: wrap; }
.ml-case-drafts .ml-hic { display: inline-flex; }
.ml-case-drafts .hic { width: 40px; height: 40px; border-radius: var(--r-sm); }
.ml-case-models { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ml-case-models .kv { font-size: var(--fz-xs); border: 1px solid var(--line-soft); border-radius: var(--r-pill); padding: 3px 10px; }
.ml-case-models .k { font-family: var(--mono); color: var(--text-faint); text-transform: uppercase; font-size: 9px; letter-spacing: .06em; margin-right: 4px; }
.ml-case-meta { font-size: var(--fz-xs); margin-top: 10px; }

/* ---- benchmark sets manager + tournament replay picker ---- */
.ml-sets-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.ml-sets-left { position: sticky; top: 84px; }
.ml-sets-build { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bset-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bset-cases { max-height: 56vh; overflow-y: auto; }
.bset-case { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.bset-case:last-child { border-bottom: 0; }
.bset-case-main { min-width: 0; flex: 1; }
.bset-case-teams { font-size: var(--fz-sm); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bset-case-sub { font-size: var(--fz-2xs); margin: 2px 0 5px; }
.bset-heroes { display: inline-flex; gap: 3px; vertical-align: middle; }
.bset-heroes .hic { width: 26px; height: 26px; border-radius: var(--r-xs, 4px); }
.bset-case-drafts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.bset-case-ctl { flex: none; }
.bset-check input { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }
.btn.xs { padding: 3px 8px; font-size: var(--fz-2xs); }
.mcase-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.mcase-fields .input { width: 100%; min-width: 0; }
@media (max-width: 1080px) { .ml-sets-grid { grid-template-columns: 1fr; } .ml-sets-left { position: static; } }

@media (max-width: 760px) {
  .ml-setup-grid { display:grid;grid-template-columns:1fr;width:100%; }
  .ml-field-run { width:100%;margin-left:0; }
  .ml-field-run .btn { width:100%; }
  .ml-view-breakdown { display:none; }
}

@media (max-width: 1080px) {
  .ml-grid { grid-template-columns: 1fr; }
  .ml-runs { position: static; }
  .ml-field-run { margin-left: 0; }
}
@media (max-width: 640px) {
  .ml-setup-grid > .ml-field { min-width: 0; max-width: 100%; }
  .ml-seg { display: flex; flex-wrap: wrap; max-width: 100%; }
  .ml-seg button { flex: 1 1 120px; }
  .ml-case-drafts { grid-template-columns: 1fr; }
  .ml-case-panel .panel-pad { overflow-x: visible; padding: 0; }
  .ml-cases, .ml-cases tbody { display: block; width: 100%; }
  .ml-cases thead { display: none; }
  .ml-cases .ml-case-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; width: 100%; padding: 12px; }
  .ml-cases .ml-case-row td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .ml-cases .ml-case-row td:first-child { grid-column: 1 / -1; }
  .ml-cases .ml-case-row td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--text-faint); font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
  .ml-cases .ml-case-row td[data-label]:empty { display: none; }
  .ml-cases .ml-case-detail { display: block; width: 100%; }
  .ml-cases .ml-case-detail > td { display: block; width: 100%; max-width: 100%; padding: 12px; overflow-wrap: anywhere; }
  .ml-case-row .mlc-match { align-items: flex-start; flex-wrap: wrap; }
}

/* ---------------- Layer 1 Hero Features ---------------- */
.hf-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}
.hf-page-head h2 { margin-top: 5px; font-size: var(--fz-h1); }
.hf-page-head p { margin-top: 5px; color: var(--text-dim); }
.hf-page-actions { display: flex; align-items: flex-end; gap: 8px; }
.hf-page-actions .field { min-width: 190px; }
.hf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-stage-filter { display: flex; flex-wrap: wrap; gap: 5px; }
.hf-stage-filter button,
.hf-position-list button,
.hf-profile-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--input);
  color: var(--text-dim);
  cursor: pointer;
}
.hf-stage-filter button { padding: 5px 11px; }
.hf-stage-filter button.on,
.hf-position-list button.on,
.hf-profile-tabs button.on {
  border-color: color-mix(in oklch, var(--amber) 60%, var(--line));
  background: color-mix(in oklch, var(--amber-bg) 55%, var(--input));
  color: var(--text);
}
.hf-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; min-width: 0; }
.hf-feature-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; min-width: 0; }
.hf-rail {
  position: sticky;
  top: 78px;
  align-self: start;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  overflow: hidden;
}
.hf-rail-head { display: flex; justify-content: space-between; padding: 13px 14px 9px; color: var(--text-2); }
.hf-rail-head span { color: var(--text-faint); font-family: var(--mono); font-size: var(--fz-xs); }
.hf-rail-search { margin: 0 10px 10px; }
.hf-rail-search .input { width: 100%; min-width: 0; }
.hf-rail-scroll { max-height: calc(100vh - 238px); overflow-y: auto; border-top: 1px solid var(--line-soft); }
.hf-feature-nav { max-height: calc(100vh - 238px); overflow-y: auto; border-top: 1px solid var(--line-soft); }
.hf-feature-nav section { border-left: 2px solid var(--hf-accent); border-bottom: 1px solid var(--line-soft); }
.hf-feature-nav-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 11px 6px;
  color: var(--text-dim);
  font-size: var(--fz-xs);
  font-weight: 700;
}
.hf-feature-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 11px 6px 30px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.hf-feature-nav button:hover { background: var(--panel-2); color: var(--text); }
.hf-feature-nav button.active { background: color-mix(in oklch, var(--hf-accent) 16%, var(--panel)); color: var(--text); }
.hf-feature-nav button i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--amber); }
.hf-hero-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 7px 11px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.hf-hero-item:hover { background: var(--panel-2); color: var(--text); }
.hf-hero-item.active { background: color-mix(in oklch, var(--coral-bg) 45%, var(--panel)); color: var(--text); }
.hf-hero-portrait { width: 42px; height: 28px; border-radius: var(--r-xs); object-fit: cover; }
.hf-hero-item small { display: flex; gap: 3px; }
.hf-role-badge {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
}
.hf-role-badge.core { border-color: color-mix(in oklch, var(--coral) 45%, var(--line)); }
.hf-role-badge.support { border-color: color-mix(in oklch, var(--sky) 55%, var(--line)); }
.hf-editor { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hf-feature-editor { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hf-feature-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-feature-head h2 { margin-top: 4px; font-size: var(--fz-h2); }
.hf-feature-filters { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.hf-feature-filters .search { min-width: min(230px, 100%); }
.hf-feature-list { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.hf-feature-row-card {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(190px, 1.2fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--panel);
}
.hf-feature-row-card.dirty { border-color: color-mix(in oklch, var(--amber) 55%, var(--line)); }
.hf-grid-hero { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hf-grid-hero > span { display: flex; flex-direction: column; min-width: 0; }
.hf-grid-hero b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-grid-hero small { color: var(--text-dim); text-transform: capitalize; }
.hf-grid-editor { min-width: 0; }
.hf-grid-editor > .hf-rating { max-width: 160px; margin-left: auto; display: block; }
.hf-grid-editor textarea { width: 100%; resize: vertical; }
.hf-hero-head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-hero-head h2 { font-size: var(--fz-h2); }
.hf-selected-portrait { width: 66px; height: 42px; border-radius: var(--r-sm); object-fit: cover; }
.hf-profile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.hf-profile-tabs { display: flex; gap: 4px; }
.hf-profile-tabs button { padding: 5px 11px; text-transform: capitalize; }
.hf-card {
  --hf-accent: var(--line-strong);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-top: 2px solid var(--hf-accent);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
button.hf-section-title { cursor: pointer; }
.hf-section-title > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hf-section-title span { display: flex; flex-direction: column; min-width: 0; }
.hf-section-title small { color: var(--text-dim); font-weight: 400; }
.hf-group-count { flex-direction: row !important; align-items: center; gap: 7px; color: var(--text-dim); font-size: var(--fz-xs); }
.hf-general-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 2px 15px 16px; }
.hf-general-grid .field > span { color: var(--text-dim); font-family: var(--mono); font-size: var(--fz-2xs); letter-spacing: .08em; text-transform: uppercase; }
.hf-description { grid-column: 1 / -1; }
.hf-description textarea { min-height: 94px; resize: vertical; }
.hf-position-list { display: flex; flex-wrap: wrap; gap: 5px; }
.hf-position-list button { width: 36px; padding: 4px; }
.hf-feature-rows { border-top: 1px solid var(--line-soft); }
.hf-feature-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(96px, 150px);
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
}
.hf-feature-row:last-child { border-bottom: 0; }
.hf-staged-row { grid-template-columns: minmax(170px, 1fr) minmax(230px, 1.4fr); }
.hf-stage-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 7px; min-width: 0; }
.hf-stage-values label { min-width: 0; }
.hf-stage-values small { display: block; margin-bottom: 3px; color: var(--text-faint); text-transform: capitalize; }
.hf-rating {
  width: 100%;
  min-width: 70px;
  background: color-mix(in oklch, var(--input), #8177d8 var(--hf-strength));
  font-family: var(--mono);
  font-weight: 700;
}
.hf-unsaved { color: var(--amber); }
.hf-save-bar {
  position: sticky;
  bottom: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--panel-2) 92%, transparent);
  box-shadow: var(--sh-2);
  backdrop-filter: blur(10px);
}
.hf-save-bar > span { margin-right: auto; color: var(--text-dim); }

@media (max-width: 820px) {
  .hf-page-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .hf-page-actions { flex-wrap: wrap; }
  .hf-page-actions .field { flex: 1 1 180px; min-width: 0; }
  .hf-toolbar { align-items: stretch; flex-direction: column; }
  .hf-toolbar > .seg { width: 100%; }
  .hf-toolbar > .seg button { flex: 1; }
  .hf-layout, .hf-feature-layout { grid-template-columns: minmax(0, 1fr); }
  .hf-rail { position: static; }
  .hf-rail-scroll { display: flex; max-height: none; overflow-x: auto; overflow-y: hidden; }
  .hf-feature-nav { display: flex; max-height: 250px; overflow-x: auto; overflow-y: auto; }
  .hf-feature-nav section { flex: 0 0 220px; }
  .hf-hero-item { flex: 0 0 150px; grid-template-columns: 38px minmax(0, 1fr); }
  .hf-hero-item small { grid-column: 2; }
  .hf-hero-portrait { width: 38px; }
  .hf-hero-head { align-items: flex-start; flex-wrap: wrap; }
  .hf-profile-actions { width: 100%; margin-left: 0; }
  .hf-feature-head { align-items: stretch; flex-direction: column; }
  .hf-feature-filters { justify-content: flex-start; }
  .hf-feature-filters .search { flex: 1 1 220px; }
}

@media (max-width: 520px) {
  .hf-page-actions > * { width: 100%; }
  .hf-stage-filter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hf-stage-filter button { width: 100%; padding-inline: 5px; }
  .hf-selected-portrait { width: 56px; height: 36px; }
  .hf-profile-actions .btn { flex: 1 1 auto; }
  .hf-general-grid { grid-template-columns: minmax(0, 1fr); }
  .hf-description { grid-column: auto; }
  .hf-feature-row, .hf-staged-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .hf-feature-row-card { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .hf-feature-filters, .hf-feature-filters .search, .hf-feature-filters .seg { width: 100%; }
  .hf-feature-filters .seg button { flex: 1; }
  .hf-grid-editor > .hf-rating { width: 100%; max-width: none; }
  .hf-stage-values { grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); }
  .hf-save-bar { bottom: 0; }
  .hf-save-bar > span { width: 100%; margin-right: 0; }
  .hf-save-bar .btn { flex: 1 1 120px; }
}

/* ---------------- Hero Features Layers 2–4 ---------------- */
.hf-workspace-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-workspace-tabs button {
  min-height: 36px;
  padding: 7px 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.hf-workspace-tabs button.on { background: var(--raised); color: var(--text); box-shadow: var(--sh-1); }
.hf-l2-section { display: grid; gap: 10px; }
.hf-l2-section > .section-title {
  padding: 12px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-l2-section > .section-title span { display: grid; gap: 3px; }
.hf-l2-section > .section-title small { color: var(--text-dim); font-weight: 400; }
.hf-l2-cards { display: grid; gap: 10px; min-width: 0; }
.hf-l2-feature-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel);
}
.hf-l2-feature-card.dirty { border-color: color-mix(in oklch, var(--amber) 60%, var(--line)); }
.hf-l2-feature-card.suggested { grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-style: dashed; }
.hf-l2-feature-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.hf-l2-feature-card h3 { margin: 3px 0; font-size: var(--fz-h3); }
.hf-l2-feature-card p { margin: 0; color: var(--text-dim); font-size: var(--fz-sm); }
.hf-l2-value-editor { display: grid; grid-template-columns: minmax(160px, .75fr) minmax(230px, 1.25fr); align-items: start; gap: 12px 18px; }
.hf-l2-value-editor > label > small { display: block; margin-bottom: 3px; color: var(--text-faint); }
.hf-l2-value-editor .field textarea { width: 100%; resize: vertical; }
.hf-l2-capabilities { grid-column: 1 / -1; display: grid; gap: 6px; }
.hf-l2-capabilities > small { color: var(--text-dim); }
.hf-l2-capabilities > div { display: flex; flex-wrap: wrap; gap: 5px; }
.hf-cap-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line-soft); border-radius: var(--r-pill); color: var(--text-dim); font-size: var(--fz-xs); cursor: pointer; }
.hf-cap-chip:has(input:checked) { border-color: color-mix(in oklch, var(--sky) 60%, var(--line)); color: var(--text); background: color-mix(in oklch, var(--sky) 10%, var(--panel)); }
.hf-l2-add-row { display: flex; align-items: center; gap: 8px; }
.hf-l2-add-row .input { flex: 1; min-width: 0; }

.hfo-workspace { display: grid; gap: 11px; min-width: 0; }
.hfo-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.hfo-toolbar .search { flex: 1 1 220px; }
.hfo-toolbar > .input { width: auto; min-width: 155px; }
.hfo-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-dim); font-size: var(--fz-xs); }
.hfo-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hfo-legend i { width: 22px; height: 3px; border-radius: 2px; background: var(--line-strong); }
.hfo-legend .calculates i { background: var(--sky); }
.hfo-legend .amplifies i { background: var(--mint); }
.hfo-legend .suppresses i { background: var(--coral); }
.hfo-legend .depends_on i { background: var(--amber); }
.hfo-legend .contributes_to i { background: #b991e8; }
.hfo-recursive { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 9px 12px; border: 1px solid color-mix(in oklch, var(--amber) 35%, var(--line)); border-radius: var(--r-sm); background: color-mix(in oklch, var(--amber-bg) 32%, var(--panel)); font-size: var(--fz-xs); }
.hfo-recursive span { padding: 3px 7px; border-radius: var(--r-pill); background: var(--input); font-family: var(--mono); }
.hfo-order { border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--panel); }
.hfo-order summary { padding: 9px 12px; cursor: pointer; color: var(--text-dim); }
.hfo-order ol { margin: 0; padding: 0 30px 12px 42px; color: var(--text-2); font-size: var(--fz-sm); }
.hfo-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); align-items: start; gap: 12px; min-width: 0; }
.hfo-canvas { position: relative; min-width: 0; padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); overflow: hidden; }
.hfo-columns { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 24px; min-width: 0; }
.hfo-layer { min-width: 0; }
.hfo-layer.filtered { display: none; }
.hfo-layer > header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 5px 7px; min-height: 51px; padding: 7px 6px; border-bottom: 1px solid var(--line-soft); }
.hfo-layer > header > span { color: var(--text-faint); font: 10px var(--mono); text-transform: uppercase; }
.hfo-layer > header > b { grid-column: 1 / 3; font-size: var(--fz-sm); }
.hfo-layer > header > .btn { grid-row: 1 / 3; grid-column: 3; }
.hfo-layer > div { display: grid; align-content: start; gap: 7px; padding: 9px 0; }
.hfo-node { display: grid; gap: 3px; width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--panel-2); color: var(--text-2); text-align: left; cursor: pointer; transition: opacity .12s, border-color .12s, transform .12s; }
.hfo-node:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.hfo-node.selected { border-color: var(--amber); box-shadow: 0 0 0 1px color-mix(in oklch, var(--amber) 30%, transparent); color: var(--text); }
.hfo-node.dimmed { opacity: .25; }
.hfo-node b { overflow-wrap: anywhere; font-size: var(--fz-xs); }
.hfo-node small { overflow: hidden; color: var(--text-faint); font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.hfo-edges { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.hfo-edge { fill: none; stroke-width: 1.7; opacity: .55; }
.hfo-edge.active { opacity: .9; stroke-width: 2.2; }
.hfo-edge.dimmed { opacity: .08; }
.hfo-edge.calculates { stroke: var(--sky); }
.hfo-edge.amplifies { stroke: var(--mint); }
.hfo-edge.suppresses { stroke: var(--coral); stroke-dasharray: 5 3; }
.hfo-edge.depends_on { stroke: var(--amber); stroke-dasharray: 2 3; }
.hfo-edge.contributes_to { stroke: #b991e8; }
.hfo-inspector { position: sticky; top: 78px; display: grid; gap: 12px; min-width: 0; max-height: calc(100vh - 92px); padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); overflow-y: auto; }
.hfo-inspector > p { margin: 0; color: var(--text-dim); font-size: var(--fz-sm); }
.hfo-inspector .section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.hfo-inspector .section-title > span:first-child { display: grid; gap: 3px; }
.hfo-inspector .section-title small { color: var(--text-faint); }
.hfo-node-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.hfo-links { display: grid; gap: 12px; }
.hfo-links h4, .hfo-add-edge h4 { margin: 0 0 6px; color: var(--text-dim); font-size: var(--fz-xs); text-transform: uppercase; letter-spacing: .06em; }
.hfo-links ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hfo-links li { display: grid; gap: 4px; padding: 7px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); }
.hfo-links li > button { border: 0; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; }
.hfo-links li > p { margin: 0; color: var(--text-faint); font-size: var(--fz-xs); }
.hfo-links li > span { display: flex; gap: 4px; }
.hfo-add-edge { padding-top: 11px; border-top: 1px solid var(--line-soft); }
.hfo-edge-form { display: grid; gap: 7px; }

@media (max-width: 1100px) {
  .hfo-main { grid-template-columns: minmax(0, 1fr); }
  .hfo-inspector { position: static; }
  .hfo-canvas { overflow-x: auto; }
}

@media (max-width: 700px) {
  .hf-workspace-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .hf-workspace-tabs button { min-width: 0; padding-inline: 7px; }
  .hf-l2-feature-card.suggested, .hf-l2-value-editor { grid-template-columns: minmax(0, 1fr); }
  .hf-l2-feature-card.suggested .btn { width: 100%; }
  .hf-l2-capabilities { grid-column: auto; }
  .hf-l2-add-row { align-items: stretch; flex-direction: column; }
  .hfo-toolbar { align-items: stretch; flex-direction: column; }
  .hfo-toolbar .search, .hfo-toolbar > .input, .hfo-toolbar > .seg { width: 100%; }
  .hfo-toolbar > .seg button { flex: 1; }
  .hfo-canvas { padding: 0; border: 0; overflow: visible; background: transparent; }
  .hfo-edges { display: none; }
  .hfo-columns { grid-template-columns: minmax(0, 1fr); gap: 9px; min-width: 0; }
  .hfo-layer { padding: 7px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
  .hfo-layer.filtered { display: none; }
  .hfo-layer > div { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  .hfo-node.dimmed { display: none; }
}

/* ============================================================
   Stage 5C: accessible interaction and resilient viewports
   ============================================================ */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--bg);
}
button { color: inherit; }
.main, .content, .panel, .panel-pad, .page-head, .ph-actions,
.dashboard-flow, .live-grid, .detail-grid, .draft-lab, .draft-board,
.admin-grid, .admin-body, .ml-grid, .ml-detail, .ml-setup-grid,
.acc-grid2, .acc-main, .acc-rail { min-width: 0; }
.content > *, .panel > *, .page-head > *, .topbar > * { min-width: 0; }
.crumb-current, .ph-sub, .match-meta, .admin-msg, .note, .note-good,
.ml-bar-note, .ml-set-meta, .mrr-meta, .dt, .dd, .asub, .stxt {
  overflow-wrap: anywhere;
}
.crumb-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { min-height: 62px; }
.topbar .btn, .topbar .pill { flex: none; }
.scrim, .picker-scrim {
  border: 0;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
}
.state-view { min-height: 150px; }
.panel .state-view { border: 0; border-radius: 0; }
.state-loading .e-ic, .state-pending .e-ic { color: var(--amber); }
.state-forbidden .e-ic, .state-failed .e-ic { color: var(--coral); }
.state-stale .e-ic, .state-unavailable .e-ic { color: var(--amber-dim); }

.ledger-row { cursor: default; }
.ledger-row[data-open-prediction] { cursor: pointer; }
.ledger-row[data-open-prediction]:focus-visible,
.ml-case-row[data-ml-case]:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: -3px;
}
.ledger-primary-link { color: inherit; border-radius: var(--r-xs); }
.ledger-primary-link:hover .teams { text-decoration: underline; text-underline-offset: 3px; }
.live-card { cursor: default; }
.live-open { color: inherit; border-radius: var(--r-xs); }
.live-open:hover { color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }

.draft-slot { padding: 0; gap: 0; cursor: default; }
.draft-slot .slot-open {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  align-self: stretch;
  min-width: 0;
  padding: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.draft-slot .slot-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-slot .slot-x { opacity: 1; margin: 0 8px 0 0; width: 30px; height: 30px; flex: none; }
.hero-picker .hp-head h2 { margin: 0; font-size: var(--fz-h3); }
.hp-hero { width: 100%; color: inherit; font: inherit; }
.hp-hero:hover { transform: none; }
.hp-hero:disabled { opacity: .32; cursor: not-allowed; pointer-events: auto; }

.ml-run-row, .hl-item, .sg-head, .sl-item, .check, .hist-chip, .mlc-match {
  font: inherit;
  color: inherit;
  text-align: left;
}
.ml-run-row, .hl-item, .sg-head, .sl-item {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
}
.ml-run-row { display: block; }
.hl-item { background: transparent; }
.sg-head { border-bottom: 0; }
.sl-item { border-right: 0; border-top: 0; border-bottom: 0; }
.check { border: 0; background: transparent; padding: 0; }
.hist-chip { color: inherit; }
.mlc-match { border: 0; background: transparent; padding: 3px; border-radius: var(--r-xs); }
.toggle { padding: 0; }
.swatch { padding: 0; }
.admin-tabs, .ml-seg { scrollbar-width: thin; }
table { max-width: 100%; }
.panel-pad:has(> table), .panel:has(> table) { overflow-x: auto; }

@media (max-width: 1100px) {
  .draft-result, .ml-left, .ml-sets-left, .acc-rail { position: static; }
  .live-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
  .page-head { align-items: flex-start; flex-wrap: wrap; }
  .page-head .ph-actions { flex-wrap: wrap; }
}

@media (max-width: 820px) {
  html, body, #app, .app { width: 100%; max-width: 100%; }
  body { overflow-x: clip; }
  .sidebar { width: min(300px, 86vw); max-width: 100%; }
  .topbar {
    min-height: 60px;
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar .crumbs { flex: 1 1 120px; min-width: 80px; }
  .topbar .spacer { display: none; }
  .topbar .btn { min-height: 36px; }
  .topbar .top-telegram { width: 36px; padding: 8px; justify-content: center; }
  .topbar .top-telegram span { display: none; }
  .content { width: 100%; padding: 18px 14px 88px; }
  .page-head { flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .page-head .ph-actions { width: 100%; margin-left: 0; align-items: flex-end; }
  .page-head .ph-actions > * { max-width: 100%; }
  .page-head h1, .teams, .ph-sub { max-width: 100%; }
  .teams { flex-wrap: wrap; }
  .panel-pad { padding: 16px; }
  .panel-head { padding: 14px 16px; flex-wrap: wrap; }
  .filters { width: 100%; align-items: stretch; }
  .filters .search, .filters .search .input { width: 100%; min-width: 0; }
  .filters .field { flex: 1 1 130px; margin-left: 0 !important; }
  .filters .select { width: 100%; }
  .pagination { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  .pagination .pg-btns { max-width: 100%; overflow-x: auto; padding: 3px; }
  .ledger-row .lr-cell { min-width: 0; gap: 12px; }
  .ledger-row .lr-cell > :last-child { min-width: 0; max-width: 72%; }
  .ledger-primary-link { display: flex; }
  .live-card .lc-top, .live-card .lc-foot { flex-wrap: wrap; }
  .live-card .lc-clock, .live-card .lc-foot .lc-right { margin-left: auto; }
  .live-score { gap: 8px; }
  .sum-grid, .stat-tiles, .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .k-val { font-size: clamp(22px, 7vw, 30px); }
  .detail-hero { gap: 18px; }
  .detail-hero .dh-call { font-size: clamp(30px, 10vw, 44px); overflow-wrap: anywhere; }
  .dl-row { align-items: flex-start; }
  .dl-row .dd { min-width: 0; max-width: 64%; }
  .hero-picker {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }
  .hp-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); padding: 12px; }
  .admin-tabs, .ml-seg { width: 100%; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .admin-tab, .ml-seg button { flex: 0 0 auto; min-height: 40px; }
  .ml-field, .ml-field .input, .ml-slot, .ml-slot .input { min-width: 0; max-width: 100%; }
  .ml-modelsel, .ml-slots, .ml-slot { width: 100%; }
  .ml-slot .input { flex: 1; width: 100%; }
  .lab-heroes { grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); }
  .ruler { min-width: 0; }
  .ruler-bucket { min-width: 24px; }
  .acc-grid2, .acard, .code { max-width: 100%; }
  .kv { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .tweak-fab, .tweak-panel { display: none; }
  :where(button, .btn, .nav-item, input, select) { min-height: 40px; }
}

@media (max-width: 520px) {
  :root { --fz-h1: 24px; }
  .content { padding-inline: 12px; }
  .topbar .top-role { display: none; }
  .ml-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }
  .ml-seg button { min-width: 0; width: 100%; white-space: normal; }
  .sum-grid, .stat-tiles, .kpi-strip, .mybets-flow .kpi-strip { grid-template-columns: 1fr; }
  .page-head .ph-actions .seg { width: 100%; }
  .page-head .ph-actions .seg button { flex: 1; }
  .ledger-row .lr-cell { align-items: flex-start; }
  .ledger-row .lr-cell > :last-child { max-width: 68%; }
  .live-score { align-items: flex-start; }
  .live-score .ls-num { font-size: 22px; }
  .players-cols .pc { padding: 14px; }
  .player { grid-template-columns: 64px minmax(0, 1fr); }
  .player .p-portrait { width: 64px; height: 38px; }
  .player .p-top { flex-wrap: wrap; }
  .player .p-kda { margin-left: 0; }
  .dl-row { flex-direction: column; gap: 5px; }
  .dl-row .dd { max-width: 100%; text-align: left; }
  .tier-card { padding: 20px; }
  .tier-card .tc-price { font-size: 30px; }
  .acard { padding: 16px; }
  .steps li { gap: 9px; }
  .ruler-bucket { font-size: 9px; }
  .brand-hero { border-radius: 18px; }
  .brand-hero-copy { padding: 36px 18px 16px; }
  .brand-hero h1 { font-size: clamp(52px, 19vw, 72px); }
  .brand-hero-lede { font-size: 14px; }
  .brand-hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .brand-hero-metrics > span { min-width: 0; padding: 9px; }
  .brand-hero-metrics b { font-size: 15px; }
  .brand-hero-actions { display: grid; width: 100%; }
  .brand-hero-actions .btn { justify-content: center; width: 100%; }
  .brand-hero-art { min-height: 0; padding: 8px 22px 28px; }
  .brand-hero-art img { width: min(88%, 330px); }
}

/* ---- Layer 3 Model Lab ---- */
.l3-profile-select {
  width: 92px;
  min-width: 92px;
  margin-right: 5px;
  padding: 5px 7px;
  font-size: var(--fz-xs);
}
.l3-empty { padding: 10px 2px; font-size: var(--fz-sm); }
.l3-result { display: grid; gap: 14px; min-width: 0; }
.l3-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.l3-result-meta > div:first-child { display: grid; gap: 4px; }
.l3-not-calculated { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.l3-not-calculated span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font: 10px var(--mono);
}
.l5-probability { display: grid; gap: 14px; overflow: hidden; }
.l5-probability-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.l5-probability-hero > div { display: grid; gap: 3px; }
.l5-probability-hero strong { font: 800 clamp(24px, 4vw, 38px) var(--mono); color: var(--mint); }
.l5-probability-hero small { color: var(--text-dim); }
.l5-decision {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font: 700 11px var(--mono);
  letter-spacing: .04em;
}
.l5-decision.bet { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 45%, var(--line)); }
.l5-decision.skip { color: var(--text-dim); }
.l5-phase-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.l5-phase-card {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--panel-2);
}
.l5-phase-card > span { color: var(--text-dim); font: 10px var(--mono); text-transform: uppercase; }
.l5-phase-card strong { font: 700 17px var(--mono); }
.l5-phase-card.radiant strong { color: var(--mint); }
.l5-phase-card.dire strong { color: var(--coral); }
.l5-phase-card small { overflow: hidden; color: var(--text-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.l5-timing { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.l5-timing summary { cursor: pointer; color: var(--text-dim); font-size: var(--fz-sm); }
.l5-weight-wrap { margin-top: 10px; overflow-x: auto; }
.l5-weight-wrap table { width: 100%; border-collapse: collapse; font: 11px var(--mono); }
.l5-weight-wrap th, .l5-weight-wrap td { padding: 7px; border-bottom: 1px solid var(--line-soft); text-align: right; }
.l5-weight-wrap th:first-child { text-align: left; }
.l5-conversion { display: grid; gap: 7px; margin-top: 12px; }
.l5-conversion-row {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) auto minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.l5-conversion-row small { color: var(--text-dim); }
.l4-evidence { min-width: 72px; text-align: right; }
.l3-stage-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--input);
}
.l3-stage-tabs button {
  min-width: 72px;
  padding: 6px 12px;
  border: 0;
  border-radius: calc(var(--r-sm) - 2px);
  background: transparent;
  color: var(--text-dim);
  font: 11px var(--mono);
  text-transform: uppercase;
  cursor: pointer;
}
.l3-stage-tabs button.on { background: var(--raised); color: var(--text); box-shadow: var(--sh-1); }
.l3-matrix-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.l3-matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fz-xs);
}
.l3-matrix th,
.l3-matrix td {
  min-width: 78px;
  padding: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
}
.l3-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 7px 5px;
  background: var(--panel);
  color: var(--text-dim);
  font: 9px/1.15 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: normal;
}
.l3-matrix thead tr:nth-child(2) th { top: 29px; }
.l3-matrix .l3-group {
  color: var(--text-2);
  border-bottom-color: var(--line);
}
.l3-matrix .l3-group-foundation { box-shadow: inset 0 2px var(--mint); }
.l3-matrix .l3-group-damage { box-shadow: inset 0 2px var(--coral); }
.l3-matrix .l3-group-engagement { box-shadow: inset 0 2px var(--amber); }
.l3-matrix .l3-group-support { box-shadow: inset 0 2px var(--sky); }
.l3-matrix .l3-group-map { box-shadow: inset 0 2px var(--violet, var(--coral)); }
.l3-matrix .l3-group-units { box-shadow: inset 0 2px var(--text-dim); }
.l3-matrix .l3-hero-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 230px;
  max-width: 230px;
  padding: 7px 10px;
  background: var(--panel);
  text-align: left;
}
.l3-matrix thead .l3-hero-cell { z-index: 5; }
.l3-matrix tbody tr:hover td,
.l3-matrix tbody tr:hover .l3-hero-cell { background: var(--panel-2); }
.l3-matrix tbody tr.side-break td,
.l3-matrix tbody tr.side-break th { border-top: 2px solid var(--coral); }
.l3-hero-wrap { display: flex; align-items: center; gap: 8px; }
.l3-portrait { width: 43px; height: 27px; flex: none; border-radius: var(--r-xs); object-fit: cover; }
.l3-side-dot { width: 6px; height: 26px; flex: none; border-radius: 4px; background: var(--mint); }
.l3-side-dot.dire { background: var(--coral); }
.l3-hero-copy { display: grid; min-width: 0; gap: 2px; }
.l3-hero-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l3-hero-copy small { color: var(--text-faint); font-size: 9px; text-transform: capitalize; }
.l3-role {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font: 9px var(--mono);
  text-transform: uppercase;
}
.l3-role.core { border-color: color-mix(in oklch, var(--coral) 45%, var(--line)); }
.l3-role.support { border-color: color-mix(in oklch, var(--sky) 55%, var(--line)); }
.l3-score {
  width: 100%;
  min-height: 43px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--l3-score-color, var(--text-2));
  font: 600 12px var(--mono);
  cursor: pointer;
}
.l3-score:hover { background: var(--raised); }
.l3-score.selected { outline: 2px solid var(--amber); outline-offset: -2px; background: var(--amber-bg); }
.l3-trace { min-width: 0; }
.l3-trace .panel-head h3 { margin-top: 4px; font-size: var(--fz-h3); }
.l3-final { display: grid; justify-items: end; }
.l3-final span { color: var(--text-dim); font: 9px var(--mono); text-transform: uppercase; }
.l3-final strong { color: var(--amber); font: 700 28px var(--mono); }
.l3-calc-path { display: grid; gap: 0; max-width: 1080px; margin: 0 auto; }
.l3-calc-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding-bottom: 12px;
}
.l3-calc-step:not(:last-child)::before {
  position: absolute;
  top: 30px;
  bottom: -2px;
  left: 16px;
  width: 2px;
  background: var(--line);
  content: "";
}
.l3-step-marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-dim);
  font: 700 11px var(--mono);
}
.l3-calc-step.intrinsic .l3-step-marker { border-color: var(--sky); color: var(--sky); }
.l3-calc-step.calculated .l3-step-marker { border-color: var(--violet); color: var(--violet); }
.l3-calc-step.positive .l3-step-marker { border-color: var(--mint); color: var(--mint); }
.l3-calc-step.negative .l3-step-marker { border-color: var(--coral); color: var(--coral); }
.l3-calc-step.final .l3-step-marker { border-color: var(--amber); color: var(--amber); }
.l3-step-content {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel-2);
}
.l3-step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.l3-step-head h4 { margin: 0; font-size: var(--fz-sm); }
.l3-step-head strong { color: var(--text); font: 700 18px var(--mono); }
.l3-calc-step.positive .l3-step-head strong { color: var(--mint); }
.l3-calc-step.negative .l3-step-head strong { color: var(--coral); }
.l3-calc-step.final .l3-step-head strong { color: var(--amber); }
.l3-formula-label { margin-top: 7px; color: var(--text-dim); font-size: var(--fz-xs); }
.l3-formula-explanation { margin: 7px 0 0; color: var(--text-2); font-size: var(--fz-xs); line-height: 1.5; }
.l3-formula-expression,
.l3-step-equation {
  margin-top: 7px;
  padding: 8px 10px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--input);
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
}
.l3-formula-parameters { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.l3-formula-components { margin-top: 9px; }
.l3-formula-components > summary { cursor: pointer; color: var(--text-dim); font-size: var(--fz-xs); }
.l3-formula-table-wrap,
.l3-evidence-table-wrap { margin-top: 8px; overflow-x: auto; }
.l3-formula-components table,
.l3-advanced-evidence table { width: 100%; border-collapse: collapse; font-size: var(--fz-xs); }
.l3-formula-components th,
.l3-formula-components td,
.l3-advanced-evidence th,
.l3-advanced-evidence td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
}
.l3-formula-components th:first-child,
.l3-formula-components td:first-child,
.l3-advanced-evidence th:first-child,
.l3-advanced-evidence td:first-child { text-align: left; }
.l3-effect-details { margin-top: 9px; }
.l3-effect-details > summary { width: max-content; cursor: pointer; color: var(--text-dim); font-size: var(--fz-xs); }
.l3-effect-list { display: grid; gap: 9px; margin: 10px 0 0; padding: 0; list-style: none; }
.l3-effect-list li { padding-top: 9px; border-top: 1px solid var(--line-soft); }
.l3-effect-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.l3-effect-head strong { flex: none; color: var(--amber); font: 11px var(--mono); }
.l3-effect-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.l3-effect-provenance {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-faint);
  font: 8px var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.l3-source {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sky);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.l3-source:hover { text-decoration: underline; text-underline-offset: 2px; }
.l3-effect-math { margin-top: 4px; color: var(--text-faint); font-size: 9px; }
.l3-profile-line { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--text-dim); font-size: var(--fz-xs); }
.l3-components { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.l3-authored-l2 > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.l3-advanced-evidence {
  max-width: 1080px;
  margin: 2px auto 0;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}
.l3-advanced-evidence > summary { cursor: pointer; color: var(--text-dim); font: 11px var(--mono); }
.l3-evidence-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr); gap: 10px; margin-top: 10px; }
.l3-evidence-grid > section {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--panel-2);
}
.l3-evidence-grid > section:first-child { grid-row: span 2; }
.l3-evidence-grid h4 { margin: 0 0 7px; font-size: var(--fz-xs); }
.l3-iteration-values { display: flex; flex-wrap: wrap; gap: 6px; }
.l3-saved > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 650;
}
.l3-saved[open] > summary { border-bottom: 1px solid var(--line); }
.l3-saved > summary span { color: var(--text-faint); font: 10px var(--mono); }
.l3-saved-grid { display: grid; grid-template-columns: minmax(260px, .65fr) minmax(0, 1fr); }
.l3-save-controls { display: flex; gap: 8px; }
.l3-save-controls .input { min-width: 0; flex: 1; }
.ml-badge.l3 { color: var(--sky); border-color: color-mix(in oklch, var(--sky) 42%, var(--line)); }
.l3-run-cases { overflow: hidden; }
.l3-run-case { border-bottom: 1px solid var(--line-soft); }
.l3-run-case:last-child { border-bottom: 0; }
.l3-run-case > button {
  display: grid;
  width: 100%;
  gap: 7px;
  padding: 12px 15px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.l3-run-case > button:hover,
.l3-run-case.open > button { background: var(--panel-2); }
.l3-case-drafts {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}
.l3-case-match-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.l3-case-expander {
  display: inline-flex;
  flex: none;
  color: var(--text-faint);
}
.l3-case-versus {
  flex: none;
  color: var(--text-faint);
  font-size: var(--fz-xs);
}
.l3-case-context-head {
  color: var(--text-faint);
  font: 10px var(--mono);
}
.l3-case-team {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: var(--fz-xs);
}
.l3-case-team b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.l3-case-result,
.l5-case-prediction {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 9px var(--mono);
  text-transform: uppercase;
}
.l3-case-result.radiant {
  border-color: color-mix(in oklch, var(--mint) 42%, var(--line));
  color: var(--mint);
}
.l3-case-result.dire {
  border-color: color-mix(in oklch, var(--coral) 42%, var(--line));
  color: var(--coral);
}
.l5-case-prediction b { color: var(--text-2); }
.l5-case-prediction strong { font: inherit; }
.l5-case-prediction.correct {
  border-color: color-mix(in oklch, var(--mint) 46%, var(--line));
  background: color-mix(in oklch, var(--mint) 10%, transparent);
  color: var(--mint);
}
.l5-case-prediction.wrong {
  border-color: color-mix(in oklch, var(--coral) 46%, var(--line));
  background: color-mix(in oklch, var(--coral) 10%, transparent);
  color: var(--coral);
}
.l5-case-prediction.skip {
  border-color: color-mix(in oklch, var(--amber) 42%, var(--line));
  background: color-mix(in oklch, var(--amber) 8%, transparent);
  color: var(--amber);
}
.l5-case-prediction.pick {
  border-color: color-mix(in oklch, var(--sky) 42%, var(--line));
  background: color-mix(in oklch, var(--sky) 8%, transparent);
  color: var(--sky);
}
.l3-case-draft-strip {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.l3-case-draft-heroes {
  display: flex;
  flex: none;
  gap: 3px;
}
.l3-case-hero {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}
.l3-case-draft-divider {
  width: 1px;
  height: 18px;
  flex: none;
  background: var(--line-strong);
}
.l3-diagnostic-wrap { display: grid; gap: 5px; }
.l3-diagnostic-note {
  color: var(--text-faint);
  font: 9px var(--mono);
  text-transform: uppercase;
}
.l3-diagnostic-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.l3-run-case-detail { display: grid; gap: 12px; padding: 12px; background: var(--bg); }
.l3-run-case.error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
}
.l3-run-case.error > div { display: grid; gap: 4px; }

@media (max-width: 760px) {
  .operator-page-head { padding: 12px; }
  .admin-user,
  .admin-tournament {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }
  .admin-user .tr-counts,
  .admin-tournament .tr-counts {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    text-align: left;
    white-space: normal;
  }
  .admin-user > div:last-child { width: 100%; min-width: 0 !important; }
  .admin-user > div:last-child > div { flex-wrap: wrap; }
  .admin-user > div:last-child .btn { flex: 1; justify-content: center; }
  .admin-tournament .toggle { align-self: flex-end; }
  .prob-ruler .ruler-bucket { flex: 0 0 34px; min-width: 34px; }
  .l4-panel { overflow-x: auto; }
  .l4-table { min-width: 500px; }
  .l3-result-meta,
  .l3-save-controls { align-items: stretch; flex-direction: column; }
  .l3-not-calculated { justify-content: flex-start; }
  .l5-probability-hero { align-items: flex-start; flex-direction: column; }
  .l5-phase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .l5-conversion-row { grid-template-columns: 1fr auto; }
  .l5-conversion-row small { grid-column: 1 / -1; }
  .l3-evidence-grid,
  .l3-saved-grid { grid-template-columns: 1fr; }
  .l3-evidence-grid > section:first-child { grid-row: auto; }
  .l3-matrix .l3-hero-cell { min-width: 150px; max-width: 150px; }
  .l3-stage-tabs { width: 100%; }
  .l3-stage-tabs button { min-width: 0; flex: 1; }
  .draft-slot .l3-profile-select { width: 82px; min-width: 82px; margin-right: 2px; }
  .l3-case-match-row { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
  .dot.live { animation: none !important; }
}

/* Layer 4 game concepts */
.l4-panel { display: grid; gap: 12px; }
.l4-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.l4-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.l4-table th[scope="col"] {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; opacity: .6; padding: 0 8px 6px;
}
.l4-table th[scope="col"]:nth-child(2), .l4-table th[scope="col"]:nth-child(4) { text-align: right; }
.l4-table th[scope="col"]:nth-child(3) { text-align: center; }
.l4-table th[scope="col"]:last-child { text-align: right; }
.l4-row { cursor: pointer; border-top: 1px solid var(--line, rgba(128,128,128,.18)); }
.l4-row:hover { background: rgba(128,128,128,.09); }
.l4-row th[scope="row"] { text-align: left; font-weight: 500; padding: 7px 8px; white-space: nowrap; }
.l4-num { text-align: right; padding: 7px 8px; opacity: .85; }
.l4-adv { text-align: right; padding: 7px 8px; font-weight: 600; }
.l4-bar-cell { padding: 7px 8px; width: 34%; min-width: 90px; }
.l4-bar { position: relative; display: block; height: 7px; border-radius: 4px; background: rgba(128,128,128,.16); }
.l4-bar::before {
  content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px;
  width: 1px; background: rgba(128,128,128,.45);
}
.l4-bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.l4-bar-even { display: none; }
.l4-radiant { color: #4a9d5f; }
.l4-dire { color: #c4574d; }
.l4-bar-fill.l4-radiant { background: #4a9d5f; }
.l4-bar-fill.l4-dire { background: #c4574d; }
.l4-adv.l4-even { opacity: .45; font-weight: 500; }
.l4-detail { display: grid; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line, rgba(128,128,128,.18)); }
.l4-detail-title { display: grid; gap: 3px; }
.l4-detail-title .dim { font-size: 12px; line-height: 1.45; }
.l4-detail-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.l4-detail-side { display: grid; gap: 6px; padding: 10px; border-radius: 8px; background: rgba(128,128,128,.07); }
.l4-detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.l4-detail-formula { font-size: 11px; line-height: 1.5; }
.l4-detail-inputs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.l4-detail-inputs li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 12px; align-items: baseline; }
.l4-detail-inputs small { grid-column: 1 / -1; font-size: 10px; opacity: .55; }
@media (max-width: 720px) {
  .l4-bar-cell { display: none; }
  .l4-table th[scope="col"]:nth-child(3) { display: none; }
}

/* Labeling: operator draft description */
.lab-comment { display: grid; gap: 7px; margin-bottom: 14px; }
.lc-title {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 600; letter-spacing: .02em; opacity: .75;
}
.lc-input { width: 100%; resize: vertical; min-height: 62px; line-height: 1.5; font-size: 13px; }
.lc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; }
.lc-foot .btn { padding: 4px 10px; font-size: 12px; }
.lc-ok { color: var(--mint, #4a9d5f); font-weight: 600; }

/* Laning — resolved once, not per stage */
.lane-panel { display: grid; gap: 10px; }
.lane-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.lane-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.lane-side { display: grid; gap: 5px; padding: 10px; border-radius: 8px; background: rgba(128,128,128,.07); }
.lane-side-head { font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.lane-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.lane-row img { border-radius: 4px; }
