:root {
  --bg: #0b0f17;
  --bg-2: #121826;
  --card: #161d2e;
  --card-2: #1c2437;
  --line: #26304a;
  --text: #e6ebf5;
  --muted: #8b98b5;
  --accent: #4f9dff;
  --green: #35c88b;
  --red: #ff6b6b;
  --amber: #f5b445;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 17px; margin: 0; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--red); }

#app { max-width: 1100px; margin: 0 auto; padding: 0 14px calc(28px + env(safe-area-inset-bottom)); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 0 10px; position: sticky; top: 0; background: linear-gradient(var(--bg) 70%, transparent);
  z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { color: var(--accent); font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; width: 34px; height: 34px; font-size: 15px; cursor: pointer; }
.icon-btn:active { transform: scale(0.94); }
select { background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 9px; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: none; color: var(--muted); padding: 10px 12px; font-size: 13px;
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding-top: 14px; }
.panel-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.pill { background: var(--card-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; color: var(--muted); }

.banner { background: #2a1c1c; border: 1px solid #5a2d2d; color: #ffd9d9; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 12px; font-size: 13px; }

.cards { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; }
.card .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ticker { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.company { color: var(--muted); font-size: 12px; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; padding: 2px 6px;
  border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.badge.tsx { color: var(--accent); border-color: #274a73; }
.badge.tsxv { color: var(--amber); border-color: #5a4a1f; }
.badge.buy { color: #06231a; background: var(--green); border-color: var(--green); }
.badge.watch { color: #241f06; background: var(--amber); border-color: var(--amber); }
.badge.avoid { color: #2a0f0f; background: var(--red); border-color: var(--red); }
.sent-positive { color: var(--green); } .sent-negative { color: var(--red); } .sent-neutral { color: var(--muted); }

.metrics { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; }
.metric { min-width: 74px; }
.metric .k { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
.metric .v { font-size: 15px; font-weight: 650; }
.v.big { font-size: 20px; }
.pos { color: var(--green); } .neg { color: var(--red); }

.scorebar { height: 4px; background: var(--card-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.scorebar > i { display: block; height: 100%; background: var(--accent); }

.headline { margin-top: 8px; font-size: 12px; color: var(--muted); }
.headline a { color: var(--text); }

.plan-levels { display: flex; gap: 14px; margin-top: 8px; }
.plan-levels .metric .v { font-variant-numeric: tabular-nums; }

.subcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; }
.grid-form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .grid-form { grid-template-columns: 1fr; } }
.grid-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form input, .grid-form textarea, .grid-form select { background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 7px 8px; font-size: 13px; font-family: inherit; }
.grid-form .chk { flex-direction: row; align-items: center; gap: 6px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn { background: var(--accent); color: #04121f; border: none; border-radius: 9px; padding: 8px 14px;
  font-size: 13px; font-weight: 650; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:active { transform: scale(0.97); }
.runout { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  font-size: 12px; white-space: pre-wrap; margin-top: 10px; max-height: 220px; overflow: auto; }

.int-list { display: grid; gap: 8px; }
.int { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.int .meta { font-size: 12px; color: var(--muted); }
.add-int { margin-top: 10px; }
.add-int summary { cursor: pointer; color: var(--accent); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
.tbl-wrap { overflow-x: auto; }

svg.equity { width: 100%; height: 120px; display: block; }

.foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; max-width: 340px; width: 92%; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog input { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px; margin: 8px 0; font-size: 14px; }
[hidden] { display: none !important; }
