:root {
  --bg: #f4f3ef;
  --card: #ffffff;
  --ink: #141413;
  --ink-2: #4c4b47;
  --muted: #86847d;
  --line: rgba(20, 20, 19, 0.09);
  --track: #ecebe6;
  --accent: #2259c9;
  --good: #1d7a3e;
  --good-bg: #e6f3ea;
  --warn: #9a6400;
  --warn-bg: #fbf1dc;
  --bad: #b8322f;
  --bad-bg: #fbe7e6;
  --info: #2259c9;
  --info-bg: #e7eefb;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --card: #17181b;
    --ink: #eeede9;
    --ink-2: #c2c0b9;
    --muted: #8b8983;
    --line: rgba(255, 255, 255, 0.08);
    --track: #26272b;
    --accent: #6b9bf5;
    --good: #4cc06e;
    --good-bg: #16301f;
    --warn: #e0a73a;
    --warn-bg: #352812;
    --bad: #f0706b;
    --bad-bg: #3a1a19;
    --info: #6b9bf5;
    --info-bg: #182540;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h2 { font-size: 13px; font-weight: 600; margin: 0; letter-spacing: 0.01em; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 10px; height: 10px; border-radius: 3px; background: var(--ink); }
.title { font-weight: 650; font-size: 15px; }
select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; margin-left: 6px;
}
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--ink-2); }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.ok .dot { background: var(--good); }
.live.err .dot { background: var(--bad); }

.grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px;
  padding: 20px 24px 32px; max-width: 1480px; margin: 0 auto; align-items: stretch;
}
.span3 { grid-column: span 3; }
.span4 { grid-column: span 4; }
.span5 { grid-column: span 5; }
.span7 { grid-column: span 7; }
.span8 { grid-column: span 8; }
.span12 { grid-column: span 12; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-width: 0; display: flex; flex-direction: column;
}
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.muted { background: var(--track); color: var(--ink-2); }

.big { font-size: 40px; line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; }
.big small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.delta { font-size: 13px; margin-top: 4px; color: var(--muted); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.spark { width: 100%; height: 44px; margin-top: auto; padding-top: 12px; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sources { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.sources b { font-weight: 600; color: var(--ink); }
.fine { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.empty { color: var(--muted); font-size: 13px; line-height: 1.5; margin: auto 0; }
.empty strong { display: block; color: var(--ink-2); font-size: 14px; font-weight: 600; margin-bottom: 2px; }

.meter { position: relative; height: 10px; background: var(--track); border-radius: 999px; margin: 14px 0 22px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.meter .tick { position: absolute; top: -3px; width: 1px; height: 16px; background: var(--muted); opacity: 0.5; }
.meter .tick span { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }

.gauge { width: 100%; max-width: 180px; margin: 6px auto 0; display: block; }
.gauge path { fill: none; stroke: var(--track); stroke-width: 12; stroke-linecap: round; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; }
.step { position: relative; padding-top: 22px; }
.step::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--track); }
.step:first-child::before { left: 7px; }
.step:last-child::before { right: calc(100% - 7px); }
.step .node { position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--track); }
.step.done::before, .step.now::before { background: var(--accent); }
.step.done .node { background: var(--accent); border-color: var(--accent); }
.step.now .node { border-color: var(--accent); box-shadow: 0 0 0 4px var(--info-bg); }
.step .name { font-weight: 600; font-size: 13.5px; }
.step .when { color: var(--ink-2); font-size: 13px; }
.step .tag { margin-top: 4px; }

.cats { display: flex; flex-direction: column; gap: 10px; }
.cat { display: grid; grid-template-columns: 150px minmax(0, 1fr) 64px; align-items: center; gap: 12px; }
.cat .label { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat.child .label { padding-left: 14px; color: var(--muted); font-size: 12.5px; }
.cat .bar { position: relative; height: 12px; background: var(--track); border-radius: 4px; }
.cat .bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.cat.child .bar { height: 8px; }
.cat.child .bar .fill { opacity: 0.55; }
.cat .bar .one { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink); opacity: 0.35; }
.cat .val { text-align: right; font-weight: 600; font-size: 13.5px; }
.legend-one { font-size: 11.5px; color: var(--muted); margin-top: 12px; }

.alerts-card { max-height: 460px; }
.alerts { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; }
.alerts li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.alerts li:first-child { border-top: 0; padding-top: 0; }
.alerts .lv { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--info); }
.alerts .lv.good { background: var(--good); }
.alerts .lv.warn { background: var(--warn); }
.alerts .lv.bad { background: var(--bad); }
.alerts .t { font-size: 13px; }
.alerts .ts { font-size: 11.5px; color: var(--muted); }

.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
#rules li:last-child { color: var(--muted); font-size: 12.5px; }

.feeds { width: 100%; border-collapse: collapse; font-size: 13px; }
.feeds td { padding: 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.feeds tr:first-child td { border-top: 0; }
.feeds td:last-child { text-align: right; color: var(--muted); }
.ok-t { color: var(--good); font-weight: 600; }
.bad-t { color: var(--bad); font-weight: 600; }
.err-msg { display: block; font-size: 11.5px; color: var(--muted); }

.foot { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 4px 2px 0; }

.gate { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.gate-card { max-width: 420px; }
.gate-card p { color: var(--ink-2); margin: 8px 0 0; }

@media (max-width: 1100px) {
  .span3 { grid-column: span 6; }
  .span4, .span5, .span7, .span8 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top { padding: 12px 16px; }
  .grid { padding: 16px; gap: 12px; }
  .span3 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .add { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .step::before { display: none; }
  .cat { grid-template-columns: 112px minmax(0, 1fr) 56px; gap: 8px; }
  .big { font-size: 34px; }
}

/* tabs */
.tabs { display: flex; gap: 2px; }
.tabs button, button.link, button.primary, button.ghost {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink-2);
}
.tabs button { padding: 6px 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { background: var(--track); }
.tabs button.on { background: var(--ink); color: var(--card); }
.badge { font-size: 11px; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; line-height: 17px; }
button.link { color: var(--accent); padding: 2px 4px; font-size: 12.5px; }
button.primary { background: var(--ink); color: var(--card); padding: 9px 16px; font-weight: 600; }
button.primary:disabled { opacity: 0.5; cursor: progress; }
button.ghost { border-color: var(--line); padding: 4px 9px; font-size: 12px; }
button.ghost:hover { background: var(--track); }
.view { padding-top: 20px; }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.bad .v { color: var(--bad); }

/* charts */
.chart svg { width: 100%; height: 220px; display: block; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--accent); opacity: 0.08; }
.chart .dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }

/* platform bars */
.pbars { display: flex; flex-direction: column; gap: 10px; }
.pbar { display: grid; grid-template-columns: 96px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.pbar .label { color: var(--ink-2); }
.pbar .bar { position: relative; height: 10px; background: var(--track); border-radius: 4px; overflow: hidden; }
.pbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.pbar .fill.rep { opacity: 0.35; }
.pbar .val { text-align: right; font-weight: 600; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0 10px 8px 0; white-space: nowrap; }
table.t td { padding: 9px 10px 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
table.t .num { text-align: right; white-space: nowrap; }
table.t th.num { text-align: right; }
table.t .who { display: flex; flex-direction: column; min-width: 160px; max-width: 320px; }
table.t .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.t .who span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.t a { color: var(--ink); text-decoration: none; }
table.t a:hover { text-decoration: underline; }
.plat { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--track); color: var(--ink-2); white-space: nowrap; }
.st { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st.live { color: var(--good); }
.st.pending { color: var(--muted); }
.st.manual { color: var(--warn); }
.st.deleted, .st.private, .st.error { color: var(--bad); }
.flag { font-size: 11px; padding: 1px 6px; border-radius: 6px; margin-right: 4px; white-space: nowrap; display: inline-block; margin-bottom: 2px; }
.flag.high { background: var(--bad-bg); color: var(--bad); }
.flag.medium { background: var(--warn-bg); color: var(--warn); }
.flag.low { background: var(--track); color: var(--muted); }
.rep-tag { font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
tr.editing td { background: var(--info-bg); }
.numbers { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.numbers input { width: 92px; }

/* add links */
.add { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.add-side { display: flex; flex-direction: column; gap: 8px; }
.add-side label { font-size: 12px; color: var(--muted); }
input, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.add-side select { margin-left: 0; padding: 8px; }
.error { color: var(--bad); font-size: 12.5px; margin: 0; }
.add-result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; }
.add-result .sum { font-weight: 600; margin-bottom: 6px; }
.add-result ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.add-result .dup-other { color: var(--bad); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 260px; }
.filters select { margin-left: 0; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.check input { width: auto; }
.more { margin-top: 10px; }

/* market pulse mini */
.pulse { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pulse .k { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.pulse .k .l { font-size: 12px; color: var(--muted); }
.pulse .k .v { font-size: 20px; font-weight: 650; }
.pulse p { grid-column: span 2; margin: 0; font-size: 12px; color: var(--muted); }

/* listening */
.one-line { font-size: 17px; font-weight: 600; margin: 0 0 6px; line-height: 1.45; }
.brief { margin: 0; color: var(--ink-2); line-height: 1.6; }
.chart .bar-v { fill: var(--accent); opacity: 0.8; }
.trend { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.trend.rising, .trend.new { background: var(--warn-bg); color: var(--warn); }
.trend.steady { background: var(--track); color: var(--ink-2); }
.trend.falling { background: var(--info-bg); color: var(--info); }
.senti { font-weight: 600; white-space: nowrap; }
.senti.pos { color: var(--good); }
.senti.neg { color: var(--bad); }
.voice { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.voice:first-child { border-top: 0; }
.voice a { color: var(--ink); text-decoration: none; font-weight: 600; }
.voice span { color: var(--muted); white-space: nowrap; }
td.why { color: var(--ink-2); font-size: 12.5px; min-width: 240px; }
