/* MAX Mission Control — BLXBX look: navy glass, corporate blue, status colour is the message.
   Green = good / done, yellow = waiting, yellow blinking = you must act, red = failed, blue = information. */
:root {
  --bg: #070b14; --ink: #e6ebf4; --ink2: #c9d2e3; --muted: #97a3b9; --dim: #55627a;
  --glass: rgba(255,255,255,0.055); --glass2: rgba(255,255,255,0.03); --line: rgba(255,255,255,0.10); --line2: rgba(255,255,255,0.06);
  --accent: #4f86f7; --btn: #2563eb; --accent-soft: rgba(79,134,247,0.16); --accent-ink: #b9cdfb;
  --g: #4ade80; --w: #facc15; --b: #f87171; --a: #4f86f7;
  --r: 18px; --r2: 12px; --r3: 10px;
  --display: "Sora", "Segoe UI", system-ui, sans-serif; --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; overflow-x: hidden; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 22px; }
body { min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* backdrop: faint grid and blue glows */
.backdrop { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.backdrop::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(79,134,247,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(79,134,247,0.05) 1px, transparent 1px); background-size: 48px 48px; }
.glow { position: absolute; border-radius: 50%; filter: blur(140px); }
.glow.g1 { width: 620px; height: 620px; left: -160px; top: -200px; background: #2563eb; opacity: .32; }
.glow.g2 { width: 520px; height: 520px; right: -120px; top: 380px; background: #4f86f7; opacity: .16; }
.glow.g3 { width: 560px; height: 560px; left: 30%; bottom: -260px; background: #2563eb; opacity: .2; }

.wrap { position: relative; z-index: 1; max-width: 1640px; margin: 0 auto; padding: 22px 20px 60px; display: flex; flex-direction: column; gap: 16px; }

/* glass panels with HUD corner brackets */
.glass { position: relative; background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.03)); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 20px 50px rgba(0,0,0,0.35); }
.hud::before, .hud::after { content: ""; position: absolute; width: 14px; height: 14px; border-color: rgba(79,134,247,.75); border-style: solid; pointer-events: none; }
.hud::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: var(--r); }
.hud::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: var(--r); }
.pad { padding: 16px 18px; }
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 17px; }
.h1 { font-family: var(--display); font-size: 26px; line-height: 32px; font-weight: 700; color: #fff; margin: 0; }
.h2 { font-family: var(--display); font-size: 18px; line-height: 24px; font-weight: 600; color: #fff; margin: 0; }
.big { font-family: var(--display); font-weight: 700; color: #fff; }

/* status colour = the message (text only, no dots) */
.k-g { color: var(--g); } .k-w, .k-wb { color: var(--w); } .k-b { color: var(--b); } .k-a { color: var(--a); }
.st { font-size: 12px; font-weight: 600; }
.blink { animation: mcfade 1.1s ease-in-out infinite alternate; }
@keyframes mcfade { from { opacity: 1; } to { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; text-decoration: underline; } * { transition: none !important; } }

/* buttons and chips */
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r3); background: var(--btn); border: 0; color: #fff; font-size: 13px; font-weight: 600; }
.btn.ghost { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); color: var(--ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 12px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.05); color: var(--ink2); border: 1px solid rgba(255,255,255,0.12); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--btn); color: #fff; border-color: var(--btn); }
.chip .ct { margin-left: 6px; font-size: 11px; opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 32px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.tap { cursor: pointer; text-align: left; border-radius: var(--r2); transition: background .15s; }
.tap:hover { background: rgba(255,255,255,0.08); }
select, input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], textarea { min-height: 44px; padding: 0 12px; border-radius: var(--r3); background: #111a2b; color: var(--ink); border: 1px solid rgba(255,255,255,0.14); }
textarea { padding: 10px 12px; min-height: 120px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 14px 20px; }
.brand { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; }
.brand b { font-family: var(--display); font-size: 28px; letter-spacing: .08em; color: #fff; }
.brand span.t { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .04em; }
.askbar { flex: 3 1 360px; display: flex; gap: 8px; align-items: center; }
.askbar label { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 48px; border-radius: var(--r2); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); }
.askbar input { flex: 1; min-width: 0; background: transparent; border: 0; min-height: 44px; padding: 0; font-size: 14px; outline: none; }
.iconbtn { min-height: 48px; min-width: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r2); background: var(--btn); border: 0; }
.clock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.clock .t { font-family: var(--mono); font-size: 22px; line-height: 26px; color: #fff; }
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.src { display: flex; flex-direction: column; align-items: flex-start; min-height: 52px; padding: 7px 12px; border-radius: var(--r2); }
.filters { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.crumbs button { background: none; border: 0; min-height: 32px; padding: 0 6px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.crumbs span.cur { color: #fff; font-weight: 600; padding: 0 6px; }
.crumbs .sep { color: var(--dim); }
.banner { padding: 10px 16px; border-radius: var(--r2); border: 1px solid rgba(79,134,247,.45); background: rgba(79,134,247,.12); font-size: 13px; }

/* layout */
.layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
nav.side { flex: 1 1 230px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
nav.side .nv { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 50px; padding: 8px 12px; border-radius: var(--r2); text-align: left; background: transparent; border: 1px solid transparent; width: 100%; }
nav.side .nv[aria-current="page"] { border-color: rgba(79,134,247,.6); background: rgba(79,134,247,.18); }
nav.side .nv b { font-size: 14px; color: #fff; font-weight: 600; }
nav.side .grp { padding: 10px 12px 4px; }
main { flex: 999 1 760px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* tiles and the telemetry wall */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 0; border-radius: 14px; background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); overflow: hidden; min-height: 112px; color: inherit; }
.tile[aria-pressed="true"] { border-color: var(--accent); background: rgba(79,134,247,.14); box-shadow: 0 0 0 1px var(--accent); }
.tile .lbl { font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val { font-family: var(--display); font-size: 24px; line-height: 30px; font-weight: 700; color: #fff; white-space: nowrap; }
.tile .sub { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile svg.sp { display: block; margin: 2px -14px 0; width: calc(100% + 28px); height: 24px; }
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.wall .panel { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-radius: 16px; }
.wall .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wall .tile { min-height: 96px; padding: 9px 10px 0; }
.wall .tile .val { font-size: 20px; line-height: 26px; }
.wall .tile svg.sp { margin: 2px -10px 0; width: calc(100% + 20px); }
.gauge { display: block; width: 100%; height: 50px; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px; border-radius: var(--r3); border: 1px solid transparent; background: none; text-align: left; width: 100%; color: inherit; min-height: 40px; }
.bar[aria-pressed="true"] { border-color: var(--accent); background: rgba(79,134,247,.16); }
.bar .tx { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bar .tr { display: block; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); }
.bar .fl { display: block; height: 8px; border-radius: 999px; background: var(--accent); }

/* tables */
.tablebox { overflow-x: auto; border-radius: var(--r2); border: 1px solid rgba(255,255,255,0.09); }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 12px; }
td { padding: 7px 12px; border-top: 1px solid rgba(255,255,255,0.07); color: var(--ink2); vertical-align: top; }
td.n1 { color: #fff; font-weight: 600; }
tr.sel td { background: rgba(79,134,247,.14); }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(255,255,255,0.05); }

/* chart */
.chart svg { display: block; width: 100%; height: 240px; }
.chart .xl { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.legend i.cmp { border-top: 2px dashed #93a1ba; } .legend i.avg { border-top: 1px dashed rgba(255,255,255,.5); }

/* health ring, AEP, heat */
.ring text { font-family: var(--display); }
.heat { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 4px; }
.heat span { display: flex; flex-direction: column; gap: 3px; align-items: center; font-size: 9px; color: var(--muted); }
.heat i { display: block; width: 100%; height: 26px; border-radius: 5px; }
.heat i.now { box-shadow: 0 0 0 2px var(--ink); }
.prog { position: relative; display: block; height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); }
.prog .f { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent); }
.prog .p { position: absolute; top: -3px; bottom: -3px; width: 2px; }
.minibars { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.minibars span { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--accent); }
.minibars span.z { background: rgba(255,255,255,.12); }
.minibars .tgt { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(230,235,244,.6); }

/* lists */
.item { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: var(--r2); background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); text-align: left; width: 100%; color: inherit; min-height: 52px; }
.feedrow { display: flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 7px 8px; border-radius: 8px; border: 0; border-bottom: 1px solid var(--line2); background: transparent; width: 100%; text-align: left; color: inherit; }
.feedrow.new { background: rgba(79,134,247,.14); }
.feedrow .tm { flex: 0 0 64px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.feedrow .tx { flex: 1 1 auto; min-width: 0; font-size: 12px; line-height: 17px; }
.timeline .ev { display: flex; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line2); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit; }
.timeline .ev .tm { flex: 0 0 150px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 16px; font-size: 12px; color: var(--muted); }
.kv span b { display: block; font-size: 14px; font-weight: 400; color: var(--ink); word-break: break-word; }
mark { background: rgba(79,134,247,.35); color: #fff; border-radius: 3px; padding: 0 2px; }

/* THE LEADERBOARD — names slide up and down as totals change */
.board { position: relative; }
.board .slot { position: absolute; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-radius: 14px; background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); transition: transform .9s cubic-bezier(.2,.8,.2,1), background .6s, border-color .6s; will-change: transform; }
.board .slot.lead { background: linear-gradient(90deg, rgba(79,134,247,.28), rgba(79,134,247,.08)); border-color: rgba(79,134,247,.6); }
.board .rk { flex: 0 0 44px; font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--accent); text-align: center; }
.board .nm { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.board .nm b { font-family: var(--display); font-size: 18px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .ct { font-family: var(--mono); font-size: 30px; color: #fff; font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; }
.board .mv { flex: 0 0 64px; font-size: 12px; font-weight: 600; text-align: right; }

/* login */
.login { max-width: 420px; margin: 12vh auto 0; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; padding: 12px 18px; border-radius: var(--r2); background: #0b1324; border: 1px solid rgba(79,134,247,.6); color: var(--ink); font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* TV mode: bigger, no side menu */
body.tv nav.side, body.tv .filters, body.tv .askwrap { display: none; }
body.tv main { flex-basis: 100%; }
body.tv .tile .val { font-size: 30px; line-height: 36px; }

@media (max-width: 640px) {
  .wrap { padding: 12px 12px 40px; }
  .wall { grid-template-columns: 1fr; }
  .board .ct { font-size: 22px; min-width: 70px; }
  .board .mv { display: none; }
  .clock { align-items: flex-start; }
  .timeline .ev .tm { flex-basis: 110px; }
}

/* phones and small tablets: menu and sources become swipe rows so the numbers come first */
@media (max-width: 900px) {
  nav.side { flex: 1 1 100%; flex-direction: row; overflow-x: auto; flex-wrap: nowrap; padding: 6px; scroll-snap-type: x proximity; }
  nav.side .nv { min-width: 168px; width: auto; flex: 0 0 auto; scroll-snap-align: start; }
  nav.side .grp { display: none; }
  .sources { display: flex; overflow-x: auto; scroll-snap-type: x proximity; }
  .sources .src { flex: 0 0 200px; scroll-snap-align: start; }
  .askbar { flex-basis: 100%; }
  .top { padding: 12px 14px; }
}
