/* TradeTerminal — clean fintech look. No inline styles (strict CSP). */
:root {
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f7f8fb; --ink: #0e1726; --muted: #667085; --faint: #98a2b3;
  --line: #e6e9f0; --brand: #2f5bff; --brand-2: #6a3dff; --brand-ink: #ffffff;
  --good: #0a8a55; --good-bg: #e3f6ec; --bad: #d92d20; --bad-bg: #fdeceb; --warn: #b54708; --warn-bg: #fff3e0;
  --neutral-bg: #eef1f6; --s1: #2f5bff; --s2: #98a2b3;
  --radius: 18px; --radius-sm: 12px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d14; --panel: #121722; --panel-2: #171d2a; --ink: #eef2f8; --muted: #9aa4b5; --faint: #6b7588;
    --line: #232b3a; --brand: #6d8bff; --brand-2: #9a7bff; --brand-ink: #0a0d14;
    --good: #3ccf8e; --good-bg: #0f2a1f; --bad: #ff6b61; --bad-bg: #331614; --warn: #f5b041; --warn-bg: #2e2210;
    --neutral-bg: #1b2231; --s1: #6d8bff; --s2: #6b7588; --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num, .r { font-variant-numeric: tabular-nums; }
.up { color: var(--good); } .down { color: var(--bad); }
.section { margin-top: 18px; }
.mt { margin-top: 20px; }
.w100 { width: 100%; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* ---------- top bar ---------- */
.top { background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .in { max-width: 1080px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; color: var(--ink); letter-spacing: -.02em; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; }
.brand .mark svg { width: 15px; height: 15px; stroke: #fff; }
.brand span { color: var(--brand); }
.brand.lg { font-size: 22px; }
.topnav { display: flex; gap: 2px; }
.topnav a { color: var(--muted); padding: 7px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.topnav a svg { width: 17px; height: 17px; }
.topnav a.on, .topnav a:hover { color: var(--ink); background: var(--neutral-bg); text-decoration: none; }
.top .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--neutral-bg); color: var(--ink); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; text-transform: uppercase; }
.avatar:hover { text-decoration: none; background: var(--line); }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav, .top .right .hide-m { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--faint); font-size: 11px; font-weight: 600; padding: 4px 0; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.on { color: var(--brand); }
  .tabbar a:hover { text-decoration: none; }
  main { padding-bottom: 96px !important; }
  footer { padding-bottom: 90px !important; }
}
.ico { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 1080px; margin: 0 auto; padding: 22px 16px 56px; }
footer { color: var(--faint); font-size: 12px; text-align: center; padding: 18px 16px 28px; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1.4fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.home { display: grid; gap: 16px; grid-template-columns: 1.35fr 1fr; align-items: start; }
.home .col { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 860px) { .g2, .g3, .home { grid-template-columns: 1fr; } }

/* hero */
.hero-card { border-radius: var(--radius); padding: 22px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #6a3dff 0%, transparent 55%), linear-gradient(135deg, #1d3fd9 0%, #2f5bff 60%, #4b6bff 100%);
  box-shadow: 0 10px 30px rgba(47,91,255,.25); }
.hero-card .lbl { font-size: 13px; opacity: .85; font-weight: 600; }
.hero-card .val { font-size: 40px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0 4px; }
.hero-card .chg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.hero-card .chip { background: rgba(255,255,255,.16); padding: 3px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.hero-card .chip.pos { background: rgba(60,207,142,.25); }
.hero-card .chip.neg { background: rgba(255,107,97,.28); }
.hero-card .foot { margin-top: 16px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; opacity: .9; }
.hero-card .status { background: rgba(255,255,255,.95); color: #1d3fd9; font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.hero-card .status.bad { color: var(--bad); }
.hero-card .status.warn { color: #b54708; }
.hero-card .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* action rows */
.todo { display: grid; gap: 10px; }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.todo-item .badge { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: .03em; }
.badge.buy { background: var(--good-bg); color: var(--good); }
.badge.sell { background: var(--bad-bg); color: var(--bad); }
.badge.ok { background: var(--neutral-bg); color: var(--brand); }
.badge.ok svg { width: 24px; height: 24px; }
.todo-item .t1 { font-weight: 700; font-size: 16px; }
.todo-item .t2 { color: var(--muted); font-size: 13px; }
.todo-item .amt { margin-left: auto; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.todo-item .amt .t2 { font-weight: 500; }
.next { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.next svg { width: 16px; height: 16px; flex: none; }

/* stock list */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.li:last-child { border-bottom: 0; }
a.li:hover { text-decoration: none; background: var(--panel-2); border-radius: 10px; }
.li .logo { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--neutral-bg); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.li .nm { min-width: 0; }
.li .sym { font-weight: 700; }
.li .co { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.li .rt { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.li .rt b { display: block; }
.flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: middle; }

/* market chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.mchip { flex: none; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; }
.mchip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.mchip.good b { color: var(--good); } .mchip.bad b { color: var(--bad); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } .stats.s3 { grid-template-columns: repeat(3, 1fr); gap: 8px; } .stats.s3 .v { font-size: 17px; } }

/* legacy kpis (rules/evidence pages) */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { color: var(--muted); font-size: 12px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.neutral { background: var(--neutral-bg); color: var(--muted); }
.callout { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--line); background: var(--panel-2); }
.callout.warn { background: var(--warn-bg); border-color: transparent; }
.callout.good { background: var(--good-bg); border-color: transparent; }
.callout.bad { background: var(--bad-bg); border-color: transparent; }
.flash { margin-bottom: 16px; }

/* tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.hl td { background: var(--neutral-bg); }

/* journal */
.action { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.action:last-child { border-bottom: 0; }
.tag { font-weight: 700; font-size: 11px; padding: 3px 8px; border-radius: 6px; min-width: 50px; text-align: center; letter-spacing: .02em; }
.tag.buy { background: var(--good-bg); color: var(--good); }
.tag.sell { background: var(--bad-bg); color: var(--bad); }
.tag.note, .tag.skip, .tag.order, .tag.alert { background: var(--neutral-bg); color: var(--muted); }
.sys { display: inline-block; min-width: 22px; text-align: center; font-weight: 700; font-size: 12px; padding: 2px 7px;
  border-radius: 6px; background: var(--brand); color: var(--brand-ink); margin-right: 6px; }

/* forms & buttons */
form.inline { display: inline; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px;
  border-radius: 10px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--neutral-bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
input[type=text], input[type=password] { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--ink); font: inherit; font-size: 16px; }
input:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* details */
details.more { margin-top: 10px; }
details.more summary, details.fold > summary { cursor: pointer; color: var(--brand); font-weight: 650; font-size: 13px; list-style: none; }
details.more summary::-webkit-details-marker, details.fold > summary::-webkit-details-marker { display: none; }
details.more summary::after, details.fold > summary::after { content: " ›"; }
details[open].more summary::after, details[open].fold > summary::after { content: " ‹"; }
details.more ul { padding-left: 18px; margin: 6px 0 0; }
details.fold { margin-top: 14px; }
details.fold > div { margin-top: 12px; }

/* more page */
.menu { display: grid; }
.menu a { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.menu a:last-child { border-bottom: 0; }
.menu a:hover { text-decoration: none; background: var(--panel-2); border-radius: 10px; }
.menu .mi { width: 38px; height: 38px; border-radius: 12px; background: var(--neutral-bg); color: var(--brand); display: grid; place-items: center; flex: none; }
.menu .mi svg { width: 20px; height: 20px; }
.menu .d { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.menu .chev { margin-left: auto; color: var(--faint); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(80% 60% at 100% 0%, rgba(106,61,255,.18), transparent 60%), radial-gradient(70% 60% at 0% 100%, rgba(47,91,255,.15), transparent 60%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 30px; }
.auth .lock { font-size: 12px; color: var(--muted); margin-top: 18px; text-align: center; }
.sub { margin: 6px 0 20px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.chart .line.s1 { stroke: var(--s1); }
.chart .line.s2 { stroke: var(--s2); stroke-dasharray: 5 4; }
.chart .line.neg { stroke: var(--bad); stroke-width: 1.5; }
.chart .area.neg { fill: var(--bad-bg); stroke: none; }
.legends { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.legend.s1::before { background: var(--s1); }
.legend.s2::before { background: var(--s2); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: 8px 0 8px 36px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--neutral-bg); color: var(--muted); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
pre.log { background: var(--neutral-bg); padding: 10px 12px; border-radius: 10px; font-size: 12px; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.meter-svg { display: block; width: 100%; height: 6px; margin-top: 4px; }
.meter-svg .bg { fill: var(--neutral-bg); }
.meter-svg .fg { fill: var(--warn); }
.seg { display: inline-flex; background: var(--neutral-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { padding: 5px 12px; border-radius: 8px; color: var(--muted); font-weight: 650; font-size: 13px; }
.seg a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 0; }

/* ---------- simple Lab ---------- */
.search { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; }
.search > svg { width: 20px; height: 20px; color: var(--faint); flex: none; }
.search input[type=text] { border: 0; background: transparent; padding: 8px 0; flex: 1; min-width: 0; font-size: 16px; }
.search input[type=text]:focus-visible { outline: none; }
.search:focus-within { border-color: var(--brand); }
.stock-head { display: flex; align-items: center; gap: 14px; }
.stock-head h2 { margin: 0; font-size: 22px; }
.stock-head .rt { margin-left: auto; text-align: right; }
.stock-head .price { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.logo.lg, .stock-head .logo { width: 48px; height: 48px; border-radius: 14px; background: var(--neutral-bg); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; flex: none; }
.verdict { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px; border-radius: var(--radius-sm); }
.verdict.good { background: var(--good-bg); } .verdict.warn { background: var(--warn-bg); } .verdict.bad { background: var(--bad-bg); }
.verdict .score { flex: none; width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid; place-items: center;
  font-weight: 700; color: var(--muted); font-size: 13px; }
.verdict .score b { font-size: 22px; color: var(--ink); line-height: 1; }
.verdict .score { display: flex; align-items: baseline; justify-content: center; padding-top: 18px; }
.verdict.good .vt { color: var(--good); } .verdict.warn .vt { color: var(--warn); } .verdict.bad .vt { color: var(--bad); }
.verdict .vt { font-weight: 700; font-size: 16px; }
.tick { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.tick.ok { background: var(--good-bg); color: var(--good); } .tick.no { background: var(--bad-bg); color: var(--bad); }
.col-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.li .nm { flex: 1; }
.li .rt .tiny { display: block; }
