:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e1e4e8;
  --text: #1b1f24;
  --muted: #5d6671;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --up: #1a7f37;
  --down: #cf222e;
  --ok-bg: #e7f5ec;
  --err-bg: #fdecec;
  --c-you: #1f6feb;
  --c-model: #bf5b04;
  --c-3: #8250df;
  --c-muted: #8c959f;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1c2230;
    --border: #2a313c;
    --text: #e6edf3;
    --muted: #8d96a0;
    --accent: #4493f8;
    --up: #3fb950;
    --down: #f85149;
    --ok-bg: #12261a;
    --err-bg: #2d1416;
    --c-you: #4493f8;
    --c-model: #f0883e;
    --c-3: #a371f7;
    --c-muted: #6e7681;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 17px; margin: 4px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.topbar nav a.on, .topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.spacer { flex: 1; }
.who { margin-right: 8px; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.card-actions { display: flex; align-items: center; gap: 14px; }
.card.verdict { border-left: 4px solid var(--c-model); }
.card.verdict p { margin: 8px 0 0; }

.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border); }
.banner.ok { background: var(--ok-bg); }
.banner.err { background: var(--err-bg); }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
form.inline { display: inline; }

.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill.live { color: var(--up); }
.pill.live::before { content: "● "; }
.tag { display: inline-block; margin-left: 6px; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.pending { color: var(--c-model); }
.tag.approved { color: var(--up); }
.tag.rejected, .tag.suspended { color: var(--down); }

.hero { max-width: 640px; margin: 48px auto; }
.hero h1 { font-size: 34px; line-height: 1.2; }
.lead { font-size: 17px; color: var(--muted); }
.actions { display: flex; gap: 10px; margin: 20px 0 10px; }

.auth { max-width: 420px; margin: 32px auto; display: flex; flex-direction: column; gap: 14px; }
.auth h1 { margin-bottom: 4px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
input { font: inherit; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 22px; font-weight: 650; margin: 2px 0; }
.stat-sub { font-size: 12px; color: var(--muted); }

.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.signal { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--bg); }
.signal header { display: flex; justify-content: space-between; align-items: center; }
.signal.flat h3 { color: var(--muted); }
.ticker { font-weight: 700; font-size: 13px; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 0 0 10px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.jev-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.jev-line b { color: var(--text); }
details summary { cursor: pointer; font-size: 13px; color: var(--accent); margin: 6px 0; }
.features { list-style: none; padding: 0; margin: 6px 0 10px; font-size: 13px; }
.features li { padding: 2px 0; }
.features span { color: var(--muted); display: inline-block; min-width: 190px; }
.probs { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.prob { display: grid; grid-template-columns: 130px 1fr 40px; gap: 8px; align-items: center; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.num { text-align: right; }
.trade-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.trade-form input { width: 90px; }
.trade-form .hint { flex-basis: 100%; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.hl td { background: var(--surface-2); font-weight: 600; }
.r { text-align: right; }
.prompt-table td:first-child { min-width: 220px; }
.prompt-table td.r { min-width: 150px; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell form + form { margin-left: 6px; }
@keyframes flash { from { background: var(--surface-2); } to { background: transparent; } }
.flash { animation: flash 1.2s ease-out; }

.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-empty { color: var(--muted); padding: 28px 0; text-align: center; }

@media (max-width: 720px) {
  .page { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .who { display: none; }
  .hero h1 { font-size: 26px; }
  .signals { grid-template-columns: 1fr; }
  .features span { min-width: 0; display: block; }
}

.add-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.add-form input { width: 160px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip.on { color: var(--up); cursor: default; }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }
.watch-table td:nth-child(1) { min-width: 140px; }
.watch-table td:nth-child(3), .watch-table td:nth-child(4) { min-width: 220px; }
