/* Event Tech Live — live dashboard. Tokens from DESIGN.md (white-ground amendment). */
:root {
  --navy: #160822; --red: #C61530; --ink: #241d2e; --muted: #6f6879; --bg: #f8f7fa; --card: #ffffff; --line: #e9e6ee;
  --radius: 14px; --pill: 999px; --shadow: 0 1px 3px rgba(19,16,55,.06), 0 6px 18px rgba(19,16,55,.05);
  --font-head: 'Montserrat', system-ui, sans-serif; --font-body: 'Source Sans 3', system-ui, sans-serif;
  /* data: navy ordinal ramp (validated on white), 3 categorical slots (validated all-pairs) */
  --seq-1: #a89dbb; --seq-2: #8778a3; --seq-3: #66548b; --seq-4: #4a3a6d; --seq-5: #2f2249; --seq-6: #160822;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --deemph: #d9d5e0; --grid: #ece9f0; --axis: #cfc9d6;
  --good: #0ca30c; --warn: #fab219; --crit: #d03b3b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; }

/* ---- header */
.hdr { background: var(--card); border-bottom: 2px solid var(--navy); position: sticky; top: 0; z-index: 20; }
.hdr__in { max-width: 1400px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .hdr__in { padding: 10px 12px 8px; gap: 8px 12px; }
  .hdr__brand { flex: 1 1 auto; }
  .hdr__logo { height: 32px; }
  .hdr__right { margin-left: 0; flex: 0 0 auto; }
  .hdr__in .nav { flex: 1 0 100%; order: 3; display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -12px; padding: 2px 12px; width: calc(100% + 24px); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; }
  .toggle span { display: none; }
  .live { font-size: 12px; }
}
.hdr__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.hdr__logo { height: 40px; width: auto; display: block; }
.hdr__title { display: flex; align-items: center; }
.hdr__title small { display: inline-block; font: 700 11px/1.2 var(--font-body); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--pill); background: rgba(22,8,34,.07); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: var(--pill); font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.nav a:hover { background: var(--bg); }
.nav a.is-active { background: rgba(22,8,34,.07); color: var(--navy); }
.hdr__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.live__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(198,21,48,.5); animation: pulse 2s infinite; }
.live.is-stale .live__dot { animation: none; background: var(--crit); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(198,21,48,.45); } 70% { box-shadow: 0 0 0 8px rgba(198,21,48,0); } 100% { box-shadow: 0 0 0 0 rgba(198,21,48,0); } }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.toggle input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.toggle input:checked { background: var(--red); }
.toggle input:checked::after { left: 16px; }

/* ---- exhibitor-safe band */
.safeband { display: none; background: var(--red); color: #fff; font-weight: 700; text-align: center; padding: 8px 16px; font-size: 14px; letter-spacing: .01em; }
body.is-safe .safeband { display: block; }
body.is-safe .rebook-only { display: none !important; }

/* ---- layout */
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
.view { display: none; }
.view.is-active { display: block; }
.view.is-refetching { opacity: .6; transition: opacity .2s; }
h1 { font: 800 clamp(22px, 3vw, 28px)/1.15 var(--font-head); color: var(--navy); margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font: 700 17px/1.3 var(--font-head); color: var(--navy); margin: 0; }
.sub { color: var(--muted); margin: 0 0 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }
@media (max-width: 1000px) { .col-3 { grid-column: span 6; } .col-4 { grid-column: span 6; } .col-5, .col-6, .col-7, .col-8, .col-9 { grid-column: span 12; } }
@media (max-width: 600px) { .col-3, .col-4 { grid-column: span 12; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__head .hint { font-size: 13px; color: var(--muted); }
.ghost { background: none; border: 1px solid var(--line); color: var(--navy); border-radius: var(--pill); padding: 3px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ghost:hover { background: var(--bg); }
.ghost.is-on { background: rgba(22,8,34,.07); }

/* ---- stat tiles */
.tile { }
.tile__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile__value { font: 800 40px/1 var(--font-head); color: var(--navy); letter-spacing: -.02em; }
.tile__value.is-hero { font-size: 56px; }
.tile__delta { font-size: 13px; color: var(--muted); }
.tile__delta b { color: var(--ink); }
.tile__spark { height: 32px; margin-top: 4px; overflow: hidden; }
.tile__spark svg { display: block; width: 100%; height: 100%; }

/* ---- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-body); fill: var(--muted); font-size: 11.5px; }
.chart .lbl { fill: var(--ink); font-weight: 600; font-size: 12px; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .mark { transition: opacity .1s; }
.chart .mark:hover, .chart .mark:focus { opacity: .8; outline: none; }
.chart .hit { fill: transparent; cursor: default; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: 13px; color: var(--muted); min-width: 120px; display: none; }
.tip b { display: block; font-size: 16px; color: var(--ink); font-weight: 700; }
.tip i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* ---- html bar rows (horizontal bars) */
.hbars { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 6px 10px; align-items: center; }
.hbars__label { font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars__track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hbars__bar { height: 18px; border-radius: 0 4px 4px 0; background: var(--navy); flex: 0 0 auto; transition: width .2s; }
.hbars__bar.is-deemph { background: var(--deemph); }
.hbars__val { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hbars__row { display: contents; }
.hbars__row:hover .hbars__bar { opacity: .8; }

/* ---- tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th.is-sorted::after { content: ' ▾'; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: var(--bg); }
.tbl tr.is-on td { background: rgba(22,8,34,.05); }
.tbl a { font-weight: 700; color: var(--navy); text-decoration: none; }
.tbl-wrap { overflow-x: auto; }
.tbl .bar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--navy); vertical-align: middle; margin-right: 6px; }

/* ---- pills */
.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--pill); white-space: nowrap; }
.badge--neutral { background: #f2f0f5; color: var(--muted); }
.badge--navy { background: rgba(22,8,34,.07); color: var(--navy); }
.badge--good { background: rgba(12,163,12,.10); color: #006300; }
.badge--warn { background: rgba(250,178,25,.14); color: #7a5200; }
.badge--crit { background: rgba(208,59,59,.10); color: #a82f2f; }
.badge--red { background: rgba(198,21,48,.10); color: var(--red); }

/* ---- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
input[type=text], input[type=password], select, textarea { font: inherit; font-size: 16px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.cta { display: inline-block; background: var(--red); color: #fff; font-weight: 700; padding: 10px 22px; border-radius: var(--pill); border: 0; cursor: pointer; text-decoration: none; }
.cta:disabled { opacity: .5; cursor: default; }
.cta--ghost { background: none; color: var(--navy); border: 1px solid var(--line); }
.cta.is-rec { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1.5s infinite; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--pill); overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.is-on { background: var(--navy); color: #fff; }

/* ---- gate */
.gate { max-width: 420px; margin: 12vh auto; }
.gate .card { gap: 14px; }
.gate .err { color: var(--crit); font-size: 13px; font-weight: 600; }

/* ---- misc */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 12px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.sr { position: absolute; left: -9999px; }
