/* 3Sixty Trading — control centre.
 *
 * The desktop composition is measured from reference-dashboard.png
 * (1672x941): sidebar 220px, topbar 78px, a 14px gutter everywhere, a
 * six-across KPI strip 115px tall, a 842:572 middle grid 405px tall, and a
 * three-across bottom row 287px tall. Those numbers appear here as the
 * layout constants below rather than as guesses.
 *
 * Mobile first in source order: every breakpoint widens, none narrows, so a
 * phone gets the same visual system with the grids collapsed and the sidebar
 * moved to bottom tabs. The validation countdown keeps full prominence at
 * every width.
 *
 * Colour carries meaning and never carries it alone: every state also has a
 * word, and several have a shape.
 */

:root {
  /* Sampled from the reference. */
  --bg:          #020e1e;
  --bg-side:     #09172f;
  --bg-top:      #0b1a31;
  --panel:       #071429;
  --panel-2:     #0c1c33;
  --inner:       #12233c;
  --track:       #11223a;
  --line:        rgba(56, 104, 158, 0.30);
  --line-2:      rgba(76, 132, 196, 0.46);

  --ink:         #e8f0ff;
  --ink-2:       #9db4d8;
  --ink-3:       #5f769e;

  --blue:        #2571f8;
  --blue-2:      #2685fa;
  --cyan:        #22d3ee;
  --violet:      #8b5cf6;
  --indigo:      #6366f1;
  --teal:        #2dd4bf;
  --emerald:     #10b981;
  --emerald-2:   #34d399;
  --amber:       #f59e0b;
  --red:         #ef4444;
  --red-2:       #f87171;

  --r:           14px;
  --r-sm:        10px;
  --r-xs:        8px;
  --gap:         14px;
  --tap:         44px;
  --sidebar:     220px;
  --topbar:      78px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI",
        Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 620px at 6% -8%,  rgba(37,113,248,.14), transparent 60%),
    radial-gradient(900px 560px at 96% -6%,  rgba(139,92,246,.12), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
button { font: inherit; }

/* ----------------------------------------------------------------- icons */

.ico { width: 18px; height: 18px; flex: none; display: block; }
.sprite { position: absolute; }

/* ------------------------------------------------------- background field */

.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* Lower left, part of the page, mostly beyond the corner — as the reference
   places it. It carries no data and can never take a click. */
.globe {
  position: absolute; left: -108px; bottom: -150px;
  width: 430px; height: 430px; opacity: .55;
}
.globe-wire { animation: turn 110s linear infinite; transform-origin: 210px 210px; }
@keyframes turn { to { transform: rotate(360deg); } }
.globe-nodes circle { animation: twinkle 6s ease-in-out infinite; }
.globe-nodes circle:nth-child(2n) { animation-delay: -2s; }
.globe-nodes circle:nth-child(3n) { animation-delay: -3.7s; }
@keyframes twinkle { 0%,100% { opacity: .28; } 50% { opacity: .95; } }

.topbar, .sidebar, main, .tabs, .offline { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; gap: 10px 14px; align-items: center;
  grid-template-areas: "brand clock" "title title" "chips chips";
  grid-template-columns: 1fr auto;
  padding: 10px 14px;
  background: rgba(11,26,49,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand { grid-area: brand; display: flex; align-items: center; gap: 11px; min-width: 0; }
.mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 0 13px rgba(37,113,248,.6)); }
.brand-text .name {
  font-size: 19px; font-weight: 780; letter-spacing: -.02em; color: #fff;
  line-height: 1.1; white-space: nowrap;
}
.brand-text .name span { font-weight: 380; color: var(--ink-2); }
.brand-text .tag {
  font-size: 9px; letter-spacing: .30em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 640; margin-top: 3px;
}

.tb-title { grid-area: title; min-width: 0; display: none; }
.tb-title h1 { margin: 0; font-size: 22px; font-weight: 760; letter-spacing: -.02em; }
.tb-title p { margin: 3px 0 0; color: var(--ink-3); font-size: 12.5px; }

.tb-search { grid-area: search; display: none; }

.tb-chips { grid-area: chips; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tb-chips::-webkit-scrollbar { display: none; }

.tb-bell { grid-area: bell; display: none; }
.tb-user { grid-area: avatar; display: none; }

.tb-clock {
  grid-area: clock; text-align: right; line-height: 1.25;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tb-clock .d { color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.tb-clock .t { color: #fff; font-size: 13px; font-weight: 700; }

.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 760; font-size: 13px; letter-spacing: .04em; color: #fff;
  background: linear-gradient(140deg, #2563eb, #4f46e5);
  border: 1px solid rgba(120,160,255,.45);
  box-shadow: 0 0 18px rgba(37,99,235,.45);
}

/* Safety chips — the reference's two pills, with the platform's three
   readings. Never abbreviated, never colour alone. */
.chip-badge {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 38px; padding: 0 15px; border-radius: 10px;
  font-size: 12.5px; font-weight: 640; letter-spacing: .01em;
  border: 1px solid var(--line-2); background: rgba(9,20,40,.9);
  color: var(--ink-2); white-space: nowrap;
}
.chip-badge b { font-weight: 780; letter-spacing: .04em; }
.chip-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-badge.sim {
  color: #c4b5fd; border-color: rgba(139,92,246,.62);
  background: linear-gradient(120deg, rgba(139,92,246,.20), rgba(59,130,246,.10));
  box-shadow: 0 0 22px rgba(139,92,246,.26), inset 0 0 24px rgba(139,92,246,.10);
}
.chip-badge.sim b { color: #6ee7b7; }
.chip-badge.sim .dot { background: #6ee7b7; animation: breathe 2.8s ease-in-out infinite; }
.chip-badge.broker { color: var(--ink-2); }
.chip-badge.broker b { color: var(--emerald-2); }
.chip-badge.live { color: var(--ink-2); }
.chip-badge.live b { color: var(--red-2); }
.chip-badge.bad { color: var(--red-2); border-color: rgba(239,68,68,.6); }
@keyframes breathe { 0%,100% { opacity:.4; transform: scale(.8); } 50% { opacity:1; transform: scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
  .chip-badge .dot, .globe-wire, .globe-nodes circle, .pulse { animation: none; }
  * { transition: none !important; }
}

/* --------------------------------------------------------------- sidebar */

.sidebar { display: none; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.sb-nav button {
  display: flex; align-items: center; gap: 13px;
  min-height: 46px; padding: 0 14px; border: 0; cursor: pointer;
  border-radius: var(--r-sm); background: none; color: var(--ink-2);
  font-size: 14.5px; font-weight: 560; text-align: left; width: 100%;
  transition: background .16s ease, color .16s ease;
}
.sb-nav button .ico { width: 20px; height: 20px; }
.sb-nav button:hover { background: rgba(37,113,248,.12); color: var(--ink); }
.sb-nav button[aria-current="page"] {
  color: #fff; font-weight: 640;
  background: linear-gradient(100deg, #1d4ed8, #2685fa);
  box-shadow: 0 6px 20px rgba(37,113,248,.38), inset 0 1px 0 rgba(255,255,255,.18);
}
.sb-foot { margin-top: auto; padding: 16px 14px 6px; }
.creed { display: grid; gap: 5px; }
.creed span {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 640;
}
.sb-epoch {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- shell */

main { padding: var(--gap) var(--gap) 96px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px;
  margin-bottom: var(--gap);
  display: flex; flex-direction: column; min-width: 0;
}
.panel-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-h .tile { flex: none; }
.panel-h h2 { margin: 0; font-size: 17px; font-weight: 720; letter-spacing: -.01em; }
.panel-h .sub { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }
.panel-h .link {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; cursor: pointer; padding: 4px 2px;
  color: var(--cyan); font-size: 12px; font-weight: 620; white-space: nowrap;
}
.panel-h .link .ico { width: 14px; height: 14px; }
.panel-h .link:hover { color: #a5f3fc; }
.panel-b { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Icon tiles — the reference's neon rounded squares. */
.tile {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  border: 1px solid currentColor; background: rgba(255,255,255,.03);
}
.tile .ico { width: 20px; height: 20px; }
.tile.blue    { color: #60a5fa; background: rgba(37,113,248,.14);  box-shadow: 0 0 18px rgba(37,113,248,.22)  inset; }
.tile.cyan    { color: #22d3ee; background: rgba(34,211,238,.13);  box-shadow: 0 0 18px rgba(34,211,238,.22)  inset; }
.tile.violet  { color: #a78bfa; background: rgba(139,92,246,.14);  box-shadow: 0 0 18px rgba(139,92,246,.22)  inset; }
.tile.indigo  { color: #818cf8; background: rgba(99,102,241,.14);  box-shadow: 0 0 18px rgba(99,102,241,.22)  inset; }
.tile.teal    { color: #2dd4bf; background: rgba(45,212,191,.13);  box-shadow: 0 0 18px rgba(45,212,191,.22)  inset; }
.tile.emerald { color: #34d399; background: rgba(16,185,129,.14);  box-shadow: 0 0 18px rgba(16,185,129,.22)  inset; }
.tile.amber   { color: #fbbf24; background: rgba(245,158,11,.14);  box-shadow: 0 0 18px rgba(245,158,11,.22)  inset; }
.tile.red     { color: #f87171; background: rgba(239,68,68,.14);   box-shadow: 0 0 18px rgba(239,68,68,.22)   inset; }

/* ------------------------------------------------------------- KPI strip */

.kpis { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.kpi {
  min-height: 115px; padding: 14px 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column;
}
.kpi.blue    { background: linear-gradient(145deg, rgba(37,113,248,.09), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.cyan    { background: linear-gradient(145deg, rgba(34,211,238,.09), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.violet  { background: linear-gradient(145deg, rgba(139,92,246,.10), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.indigo  { background: linear-gradient(145deg, rgba(99,102,241,.10), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.teal    { background: linear-gradient(145deg, rgba(45,212,191,.09), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.emerald { background: linear-gradient(145deg, rgba(16,185,129,.10), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi.red     { background: linear-gradient(145deg, rgba(239,68,68,.10), rgba(7,20,41,.5) 62%), var(--panel); }
.kpi-head { display: flex; align-items: flex-start; gap: 13px; }
.kpi-body { min-width: 0; }
.kpi .k { font-size: 12.5px; color: var(--ink-2); font-weight: 560; white-space: nowrap; }
.kpi .v {
  font-size: 25px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.kpi .v.pos { color: var(--emerald-2); }
.kpi .v.neg { color: var(--red-2); }
.kpi .v.alert { color: var(--red-2); }
.kpi .flag {
  margin-left: auto; text-align: right; font-size: 10.5px; font-weight: 660;
  color: var(--emerald-2); line-height: 1.25; white-space: nowrap;
}
.kpi-foot {
  margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--ink-3); min-height: 20px;
}
.kpi-foot .s { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-foot .s.warn { color: var(--amber); }
.kpi-foot .s.bad { color: var(--red-2); }
.kpi-foot .spark { margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: currentColor; }
.dot.good { background: var(--emerald-2); box-shadow: 0 0 10px rgba(52,211,153,.75); }
.dot.warn { background: var(--amber); box-shadow: 0 0 10px rgba(245,158,11,.7); }
.dot.bad  { background: var(--red-2); box-shadow: 0 0 10px rgba(248,113,113,.7); }
.dot.mute { background: var(--ink-3); }
.pulse { animation: breathe 2.6s ease-in-out infinite; }
.meter { flex: 1; height: 5px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px;
             background: linear-gradient(90deg, var(--cyan), #38bdf8); }

/* --------------------------------------------------------- market table */

.mkt-head, .mkt-row { display: none; }
.mkt-cards { display: grid; gap: 8px; }
.m-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center;
  padding: 11px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel-2);
}
.m-sym { min-width: 44px; }
.m-sym .root { font-weight: 760; font-size: 14px; color: var(--cyan); }
.m-sym .root.down { color: var(--amber); }
.m-sym .con { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.m-mid { min-width: 0; }
.m-mid .px { font-size: 15px; font-weight: 720; font-variant-numeric: tabular-nums; }
.m-mid .nm { font-size: 11px; color: var(--ink-3); overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.m-right { text-align: right; display: grid; gap: 4px; justify-items: end; }
.spark { display: block; width: 92px; height: 26px; }
.chg { font-size: 11.5px; font-weight: 680; font-variant-numeric: tabular-nums; }
.pos { color: var(--emerald-2); } .neg { color: var(--red-2); } .muted { color: var(--ink-3); }
.mom { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.mom i { width: 3px; border-radius: 1px; background: var(--emerald-2); display: block; }
.mom.down i { background: var(--red-2); }
.fresh-cell { display: inline-flex; align-items: center; gap: 6px;
              font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------ strategy cards */

.cards { display: grid; gap: 11px; }
.card {
  position: relative; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px 13px 17px;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--emerald), var(--teal));
}
.card:nth-child(3n+2)::before { background: linear-gradient(180deg, var(--cyan), #38bdf8); }
.card:nth-child(3n)::before   { background: linear-gradient(180deg, var(--violet), var(--indigo)); }
.card.inactive::before, .card.stood_down::before { background: linear-gradient(180deg, #475569, #334155); }
.card .head { display: flex; align-items: flex-start; gap: 10px; }
.card .title { font-size: 14.5px; font-weight: 720; display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; }
.state {
  flex: none; padding: 3px 8px; border-radius: 6px;
  font-size: 9px; font-weight: 740; letter-spacing: .07em;
  border: 1px solid currentColor; color: #67e8f9;
}
.state.simulation_qualified { color: var(--emerald-2); }
.state.inactive, .state.stood_down { color: var(--ink-3); }
.state.review, .state.quarantined { color: var(--amber); }
.state.retirement { color: var(--red-2); }
.card-flag { margin-left: auto; display: grid; gap: 5px; justify-items: end; text-align: right; }
.card-flag .signal { font-size: 10px; color: var(--ink-3); }
.card-flag .signal b { display: block; font-size: 17px; color: var(--ink); font-weight: 760; }

.card .row {
  display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
  align-items: center;
}
.card .row .k { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.card .row .v { font-size: 13.5px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
/* The slot the reference fills with Run / More. A reading, never a control:
   same position, same weight, nothing to press. */
.exec-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid rgba(139,92,246,.5); background: rgba(139,92,246,.14);
  color: #c4b5fd; font-size: 10px; font-weight: 720; letter-spacing: .06em;
  white-space: nowrap;
}
.exec-pill.none { border-color: var(--line-2); background: rgba(148,163,184,.08); color: var(--ink-3); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 12px; margin-top: 11px; }
.stats .k { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.stats .v { font-size: 13.5px; font-weight: 690; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ validation */

.validation {
  border: 1px solid rgba(139,92,246,.34); border-radius: var(--r-sm);
  background: linear-gradient(150deg, rgba(139,92,246,.13), rgba(37,113,248,.07) 60%, transparent);
  padding: 13px; margin-top: 12px;
  box-shadow: inset 0 0 34px rgba(139,92,246,.07);
}
.validation h3 {
  margin: 0 0 11px; font-size: 10px; font-weight: 760; letter-spacing: .11em;
  text-transform: uppercase; color: #c4b5fd;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.track { margin-bottom: 11px; }
.track .row { display: flex; justify-content: space-between; align-items: baseline;
              gap: 10px; margin-bottom: 5px; padding: 0; border: 0; }
.track .label { font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
                color: var(--ink-2); font-weight: 640; }
.track .count { font-size: 14.5px; font-weight: 760; font-variant-numeric: tabular-nums; }
.bar { height: 9px; border-radius: 999px; overflow: hidden; background: var(--track);
       border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 999px;
           transition: width .6s cubic-bezier(.22,.8,.3,1); }
.bar.trades > i   { background: linear-gradient(90deg, var(--blue), var(--cyan));
                    box-shadow: 0 0 14px rgba(34,211,238,.55); }
.bar.time > i     { background: linear-gradient(90deg, var(--violet), #c084fc);
                    box-shadow: 0 0 14px rgba(139,92,246,.55); }
.bar.maturity > i { background: linear-gradient(90deg, var(--emerald), var(--teal));
                    box-shadow: 0 0 12px rgba(16,185,129,.45); }
.bar.met > i      { background: linear-gradient(90deg, var(--emerald), #6ee7b7); }
.validation .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px;
                    margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.meta .k { font-size: 9px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.meta .v { font-size: 12.5px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.vstatus { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
           border-radius: 999px; font-size: 9.5px; font-weight: 740; letter-spacing: .05em;
           border: 1px solid currentColor; background: rgba(2,14,30,.6); }
.vstatus.validating { color: #93c5fd; }
.vstatus.partial { color: var(--amber); }
.vstatus.evidence { color: var(--cyan); }
.vstatus.qualified { color: var(--emerald-2); }

/* ---------------------------------------------------------------- funnel */

.funnel-wrap { display: grid; gap: 12px; }
.funnel { display: grid; gap: 7px; align-content: start; }
.f-row { display: grid; grid-template-columns: 3px minmax(88px, 1fr) 1.1fr auto;
         gap: 10px; align-items: center; }
.f-tick { width: 3px; height: 22px; border-radius: 2px; background: var(--blue); }
.f-label { font-size: 12px; color: var(--ink-2); white-space: nowrap;
           overflow: hidden; text-overflow: ellipsis; }
.f-bar { height: 22px; border-radius: 5px; background: var(--track); overflow: hidden; }
.f-bar > i { display: block; height: 100%; border-radius: 5px;
             transition: width .6s cubic-bezier(.22,.8,.3,1); }
.f-val { font-size: 13px; font-weight: 740; font-variant-numeric: tabular-nums;
         min-width: 46px; text-align: right; }
.f-side { display: grid; gap: 10px; align-content: start; }
.f-card {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px;
  background: linear-gradient(150deg, rgba(37,113,248,.10), rgba(7,20,41,.4)), var(--panel-2);
  display: flex; align-items: center; gap: 11px;
}
.f-card.good { background: linear-gradient(150deg, rgba(16,185,129,.12), rgba(7,20,41,.4)), var(--panel-2); }
.f-card .n { font-size: 24px; font-weight: 770; line-height: 1; font-variant-numeric: tabular-nums; }
.f-card .t { font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.f-card .u { font-size: 10.5px; color: var(--emerald-2); font-weight: 660; margin-top: 2px; }
.f-note { font-size: 10.5px; color: var(--ink-3); margin-top: 10px; line-height: 1.6; }

/* ------------------------------------------------------------- insights */

.ai-block {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px;
  background: var(--panel-2); display: flex; gap: 12px; align-items: flex-start;
}
.ai-block .body { min-width: 0; }
.ai-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ai-line .k { font-size: 12.5px; font-weight: 700; }
.ai-block p { margin: 7px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.pill {
  padding: 3px 9px; border-radius: 6px; font-size: 9.5px; font-weight: 760;
  letter-spacing: .07em; border: 1px solid currentColor;
}
.pill.good { color: var(--emerald-2); background: rgba(16,185,129,.12); }
.pill.warn { color: var(--amber); background: rgba(245,158,11,.13); }
.pill.bad  { color: var(--red-2); background: rgba(239,68,68,.13); }
.pill.info { color: #93c5fd; background: rgba(37,113,248,.13); }
.pill.mute { color: var(--ink-3); background: rgba(148,163,184,.08); }

.ai-head { display: flex; align-items: center; gap: 10px; margin: 14px 0 9px; }
.ai-head .t { font-size: 12.5px; font-weight: 700; }
.opps { display: grid; gap: 8px; }
.opp { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.opp .n {
  width: 21px; height: 21px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(37,113,248,.16); border: 1px solid var(--line-2);
  font-size: 10.5px; font-weight: 720; color: #93c5fd;
}
.opp .t { font-size: 12px; color: var(--ink-2); overflow: hidden;
          text-overflow: ellipsis; white-space: nowrap; }

.insights { display: grid; gap: 8px; }
.ins { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
       padding: 10px 12px; border-radius: var(--r-sm);
       background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; }
.ins .pip { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.ins.good .pip { background: var(--emerald-2); box-shadow: 0 0 10px rgba(52,211,153,.6); }
.ins.info .pip { background: #60a5fa; box-shadow: 0 0 10px rgba(37,113,248,.6); }
.ins.warn .pip { background: var(--amber); }
.ins.bad  .pip { background: var(--red-2); }

/* -------------------------------------------------------------- activity */

.feed { display: grid; gap: 2px; }
.ev { display: grid; grid-template-columns: 52px auto 1fr; gap: 10px;
      padding: 9px 2px; align-items: start; border-bottom: 1px solid rgba(56,104,158,.14); }
.ev:last-child { border-bottom: 0; }
.ev .when { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
            padding-top: 1px; }
.ev .pip { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.ev.research .pip    { background: #a78bfa; box-shadow: 0 0 9px rgba(167,139,250,.7); }
.ev.simulation .pip  { background: var(--cyan); box-shadow: 0 0 9px rgba(34,211,238,.7); }
.ev.market .pip      { background: #60a5fa; box-shadow: 0 0 9px rgba(96,165,250,.7); }
.ev.health .pip      { background: var(--emerald-2); box-shadow: 0 0 9px rgba(52,211,153,.7); }
.ev.lifecycle .pip   { background: var(--amber); box-shadow: 0 0 9px rgba(245,158,11,.7); }
.ev .what { font-size: 12px; font-weight: 620; line-height: 1.35; }
.ev .more { font-size: 11px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 32px; padding: 5px 13px; border-radius: 8px;
        font-size: 12px; font-weight: 620; background: var(--panel-2);
        color: var(--ink-2); border: 1px solid var(--line); cursor: pointer; }
.chip[aria-pressed="true"] { color: #fff; border-color: transparent;
        background: linear-gradient(100deg, #1d4ed8, #2685fa); }

/* ----------------------------------------------------------------- misc */

.checks { display: grid; gap: 8px; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 11px;
         padding: 10px 12px; border-radius: var(--r-sm);
         background: var(--panel-2); border: 1px solid var(--line); }
.check .sev { font-size: 9px; font-weight: 760; letter-spacing: .05em;
              padding: 3px 7px; border-radius: 6px; height: fit-content;
              border: 1px solid currentColor; }
.sev.HEALTHY { color: var(--emerald-2); } .sev.WARNING { color: var(--amber); }
.sev.CRITICAL { color: var(--red-2); } .sev.READ { color: var(--red-2); }
.check .id { font-size: 12px; font-weight: 660; }
.check .why { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.check .val { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

.empty { color: var(--ink-3); font-size: 12px; padding: 6px 2px; line-height: 1.7; }
.foot { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line);
        color: var(--ink-3); font-size: 10.5px; text-align: center; line-height: 1.8; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th { text-align: left; font-size: 9.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 700;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid rgba(56,104,158,.16);
  font-variant-numeric: tabular-nums; white-space: nowrap; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(2,14,30,.96); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { min-height: var(--tap); border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font-size: 9.5px; font-weight: 640;
  display: grid; gap: 4px; place-items: center; padding: 7px 2px; }
.tabs button .ico { width: 20px; height: 20px; }
.tabs button[aria-current="page"] { color: var(--cyan); }

.offline { position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 60;
  padding: 11px 14px; border-radius: var(--r-sm);
  background: rgba(245,158,11,.14); border: 1px solid rgba(245,158,11,.5);
  color: var(--amber); font-size: 12.5px; font-weight: 640; text-align: center; }

/* ------------------------------------------------------------ 430px+ */

@media (min-width: 430px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------ 768px+ */

@media (min-width: 768px) {
  main { padding: var(--gap) 18px 96px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .validation .meta { grid-template-columns: repeat(4, 1fr); }
  .grid-main { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
  .grid-bottom { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
  .grid-bottom > .panel:last-child { grid-column: 1 / -1; }
  .funnel-wrap { grid-template-columns: 1fr 168px; }

  /* The market snapshot becomes the reference's table once there is room. */
  .mkt-cards { display: none; }
  .mkt-table { display: block; }
  .mkt-head, .mkt-row {
    display: grid; align-items: center; gap: 10px; padding: 7px 8px;
    grid-template-columns: 54px minmax(110px, 1.35fr) 86px 76px 76px 44px 96px 68px;
  }
  .mkt-head { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase;
              color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--line); }
  .mkt-row { border-bottom: 1px solid rgba(56,104,158,.16); font-size: 12.5px; }
  .mkt-row:last-child { border-bottom: 0; }
  .mkt-row:hover { background: rgba(37,113,248,.07); }
  .mkt-row .sym { font-weight: 740; color: var(--cyan); }
  .mkt-row .sym.down { color: var(--amber); }
  .mkt-row .nm { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis;
                 white-space: nowrap; }
  .mkt-row .num { font-variant-numeric: tabular-nums; font-weight: 660; text-align: right; }
  .mkt-head .num { text-align: right; }
  .mkt-row .spark { width: 96px; height: 24px; }
}

/* ----------------------------------------------------------- 1024px+ */

@media (min-width: 1024px) {
  .tabs { display: none; }

  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: var(--topbar); bottom: 0; width: var(--sidebar);
    z-index: 45; padding: 14px 12px 12px;
    background: var(--bg-side); border-right: 1px solid var(--line);
  }
  body { padding-left: var(--sidebar); }

  .topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar);
    padding: 0 16px 0 0; gap: 14px;
    grid-template-areas: "brand title search chips bell avatar clock";
    grid-template-columns:
      var(--sidebar) minmax(150px, auto) minmax(220px, 400px) auto auto auto auto;
  }
  body { padding-top: var(--topbar); }
  .brand { padding: 0 16px; height: 100%; border-right: 1px solid var(--line); }
  .tb-title { display: block; }
  .tb-title h1 { font-size: 21px; }

  .tb-search {
    display: flex; align-items: center; gap: 10px;
    height: 42px; padding: 0 13px; border-radius: var(--r-sm);
    background: rgba(4,16,33,.9); border: 1px solid var(--line-2);
  }
  .tb-search .ico { color: var(--ink-3); width: 17px; height: 17px; }
  .tb-search input { flex: 1; min-width: 0; border: 0; background: none;
                     color: var(--ink); font-size: 13px; outline: none; }
  .tb-search input::placeholder { color: var(--ink-3); }
  .tb-search kbd {
    flex: none; padding: 3px 7px; border-radius: 5px; font-size: 10px;
    font-family: inherit; font-weight: 640; color: var(--ink-3);
    background: rgba(148,163,184,.10); border: 1px solid var(--line);
  }

  .tb-bell {
    display: grid; place-items: center; position: relative;
    width: 42px; height: 42px; border-radius: var(--r-sm); cursor: pointer;
    background: rgba(4,16,33,.9); border: 1px solid var(--line-2); color: var(--ink-2);
  }
  .tb-bell .ico { width: 19px; height: 19px; }
  .tb-bell .badge {
    position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px;
    padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
    background: var(--blue-2); color: #fff; font-size: 10.5px; font-weight: 740;
    border: 2px solid var(--bg-top); box-shadow: 0 0 12px rgba(38,133,250,.7);
  }
  .tb-bell .badge.bad { background: var(--red); box-shadow: 0 0 12px rgba(239,68,68,.7); }
  .tb-user { display: block; }
  .tb-clock { padding-left: 4px; border-left: 1px solid var(--line); }

  main { padding: var(--gap) 16px var(--gap) var(--gap); }
  /* Six across, exactly as measured. */
  .kpis { grid-template-columns: repeat(6, 1fr); }
  /* 842:572 — the reference's own middle-grid proportion. */
  .grid-main { grid-template-columns: 842fr 572fr; align-items: stretch; }
  .grid-bottom { grid-template-columns: repeat(3, 1fr); }
  .grid-bottom > .panel:last-child { grid-column: auto; }
  .grid-main > .panel, .grid-bottom > .panel { margin-bottom: 0; }
  .offline { left: calc(var(--sidebar) + 16px); right: 16px; bottom: 16px; }

  /* Measured panel heights: 405px middle, 287px bottom. */
  .grid-main { min-height: 405px; }
  .grid-bottom { min-height: 287px; }
  .grid-main > .panel .panel-b, .grid-bottom > .panel .panel-b { overflow: auto; }
  .grid-main > .panel .panel-b::-webkit-scrollbar,
  .grid-bottom > .panel .panel-b::-webkit-scrollbar { width: 6px; }
  .grid-main > .panel .panel-b::-webkit-scrollbar-thumb,
  .grid-bottom > .panel .panel-b::-webkit-scrollbar-thumb {
    background: rgba(76,132,196,.3); border-radius: 999px; }
}

/* ----------------------------------------------------------- 1440px+ */

@media (min-width: 1440px) {
  main { max-width: 1700px; }
  .mkt-head, .mkt-row {
    grid-template-columns: 62px minmax(140px, 1.4fr) 96px 88px 88px 52px 112px 78px;
    padding: 8px 10px;
  }
  .mkt-row .spark { width: 110px; }
  .funnel-wrap { grid-template-columns: 1fr 176px; }
}

/* Freshness reads as a word first, a colour second. */
.fresh-cell .fw { font-size: 9px; font-weight: 740; letter-spacing: .06em; }
.fresh-cell .fw.good { color: var(--emerald-2); }
.fresh-cell .fw.warn { color: var(--amber); }
.fresh-cell .fw.bad  { color: var(--red-2); }
.fresh-cell .fw.mute { color: var(--ink-3); }
.fresh-cell .fa { color: var(--ink-3); }
