/* Neutral analytics UI. Light + dark via prefers-color-scheme. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --ink: #1a1d23;
  --ink-2: #565c66;
  --ink-3: #8a919c;
  --accent: #4f5bd5;      /* indigo — magnitude bars */
  --accent-soft: #e6e8fb;
  --pos: #1a7f5a;         /* status: positive */
  --neu: #9aa1ac;         /* status: neutral */
  --neg: #c0392b;         /* status: negative */
  --up: #1a7f5a;
  --down: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1f232b; --border: #2a2f38;
    --ink: #e8eaed; --ink-2: #a6adba; --ink-3: #6b7280;
    --accent: #8a93f0; --accent-soft: #23273a;
    --pos: #3fbd8b; --neu: #8a919c; --neg: #e06a5c; --up: #3fbd8b; --down: #e06a5c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  flex-wrap: wrap; padding: 20px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.meta { margin: 4px 0 0; color: var(--ink-3); font-size: 12px; }
.controls { display: flex; gap: 10px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.seg button.active { background: var(--accent); color: #fff; }

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; flex-wrap: wrap; }
.tabs button {
  border: 0; background: transparent; color: var(--ink-2); padding: 8px 14px; font-size: 14px;
  cursor: pointer; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 20px 24px 60px; max-width: 1100px; }
.empty { color: var(--ink-3); padding: 40px 0; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; overflow-x: auto; }
.card h2 { margin: 0 0 12px; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }

.rowlist { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: 12px; }
.row .label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .label small { color: var(--ink-3); font-weight: 400; margin-left: 6px; text-transform: capitalize; }
.bar { height: 10px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.bartrack { background: var(--surface-2); border-radius: 4px; }
.val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.delta { font-variant-numeric: tabular-nums; font-weight: 600; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--ink-3); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--ink-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.avea td { background: var(--accent-soft); }

.senti { display: inline-flex; height: 10px; width: 120px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.senti span { display: block; height: 100%; }
.s-pos { background: var(--pos); } .s-neu { background: var(--neu); } .s-neg { background: var(--neg); }
.legend { display: flex; gap: 14px; margin: 4px 0 12px; color: var(--ink-2); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.pill.value { background: var(--pos); color: #fff; }
.pill.disclosed { background: #b8860b; color: #fff; }
.pill.status { background: var(--surface-2); color: var(--ink-2); }

.oppo { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--surface); }
.oppo .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.oppo a { color: var(--accent); text-decoration: none; font-weight: 600; }
.oppo a:hover { text-decoration: underline; }
.oppo .rationale { color: var(--ink-2); font-size: 13px; margin: 8px 0; }
.oppo pre { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 8px 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.oppo .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
button.act { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
button.act:hover { background: var(--surface-2); }
.subhint { color: var(--ink-3); font-size: 12px; margin: 2px 0 14px; }

.alertbar { margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px; background: #fdecea; color: #7a1c12; border: 1px solid #f3c1ba; font-size: 13px; cursor: pointer; }
@media (prefers-color-scheme: dark) { .alertbar { background: #2a1512; color: #f0b3aa; border-color: #542720; } }
.alertbar strong { margin-right: 4px; }

.filters .filterrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flabel { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.chart { width: 100%; overflow-x: auto; }
.chart svg { min-width: 320px; }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; justify-content: flex-end; z-index: 20; }
.drawer-inner { width: min(560px, 92vw); background: var(--surface); height: 100%; overflow-y: auto; padding: 20px; box-shadow: var(--shadow); }
.drawer-close { float: right; border: 0; background: transparent; font-size: 24px; color: var(--ink-2); cursor: pointer; }
.post { border-bottom: 1px solid var(--border); padding: 10px 0; }
.post a { color: var(--accent); text-decoration: none; font-weight: 500; }
.post .pmeta { color: var(--ink-3); font-size: 12px; margin-top: 3px; }

@media (max-width: 640px) { .row { grid-template-columns: 120px 1fr auto; } main { padding: 16px; } }
