:root {
  --bg: #0b0f14; --card: #131a22; --line: #1f2a36; --text: #eef3f8; --muted: #93a0ad;
  --green: #35d07f; --red: #ff6b6b; --amber: #f5b942; --blue: #5aa9ff; --btn: #1a2430;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
header { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 800; font-size: 19px; }
.badge { padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(53, 208, 127, .14); color: var(--green); }
.banner { margin: 4px 16px 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 107, 107, .14); color: var(--red); font-size: 15px; }
main { padding: 8px 16px 16px; max-width: 640px; margin: 0 auto; }
h1 { font-size: 26px; margin: 8px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.card.warn { border-color: #5b4a1f; }
.label { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.big { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mid { font-size: 20px; font-weight: 700; }
.pos { color: var(--green); } .neg { color: var(--red); }
code { background: #0e141b; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--btn); color: var(--text); font: inherit; font-weight: 700; padding: 14px; border-radius: 14px; min-height: 54px; }
.btn:active { transform: scale(.98); }
.btn.wide { display: block; width: 100%; margin-top: 10px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #06101c; }
.btn.go { background: var(--green); border-color: var(--green); color: #06180e; }
.btn.stop { background: var(--red); border-color: var(--red); color: #1c0606; }
.btn.ghost { background: none; color: var(--muted); }
.btn[disabled] { opacity: .5; }

/* home hero */
.hero { text-align: center; padding: 22px 6px 8px; }
.hero .emoji { font-size: 54px; }
.hero p { color: var(--muted); }
.hero-card { border-radius: 22px; padding: 22px 18px; margin-bottom: 14px; background: #122033; border: 1px solid #1d3550; }
.hero-card.good { background: #0f2a1d; border-color: #1b5a3a; }
.hero-card.wait { background: #2a2210; border-color: #5b4a1f; }
.hero-card.bad { background: #2c1414; border-color: #6b2b2b; }
.hero-card.idle { background: var(--card); border-color: var(--line); }
.hero-title { font-size: 25px; font-weight: 800; line-height: 1.2; }
.hero-text { color: #c4cfdb; margin-top: 8px; font-size: 16px; }

.money { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.meter { height: 8px; background: #0e141b; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; background: var(--green); border-radius: 99px; transition: width .4s; }
.meter i.low { background: var(--amber); } .meter i.out { background: var(--red); }

/* checklist */
.steps > div { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps > div:last-child { border-bottom: 0; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #38495b; flex: none; display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.dot.done { background: var(--green); border-color: var(--green); color: #06180e; }
.dot.now { border-color: var(--blue); color: var(--blue); }
.steps .t { font-weight: 600; } .steps .s { color: var(--muted); font-size: 13px; }

.list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > div:last-child { border-bottom: 0; }
.sub { color: var(--muted); font-size: 14px; }
.timeline > .ev { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 7px 0; font-size: 15px; }
.timeline > div { padding: 4px 0; }
.timeline .tm { color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #1a2430; border-radius: 999px; padding: 7px 14px; font-size: 15px; font-weight: 600; }

/* results */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart svg { width: 100%; height: 130px; display: block; }
.tradelist > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.tradelist > div:last-child { border-bottom: 0; }
.tradelist .amt { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }

/* presets */
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preset { background: var(--btn); border: 2px solid var(--line); color: var(--text); font: inherit; border-radius: 14px; padding: 12px 6px; min-height: 76px; }
.preset b { display: block; font-size: 16px; }
.preset span { color: var(--muted); font-size: 12px; }
.preset.on { border-color: var(--blue); background: #142338; }

details.fold { padding: 0; }
details.fold > summary { padding: 16px; font-weight: 700; cursor: pointer; list-style: none; min-height: 54px; }
details.fold > summary::after { content: "+"; float: right; color: var(--muted); font-size: 22px; line-height: 1; }
details.fold[open] > summary::after { content: "-"; }
details.fold > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.fold > :last-child { margin-bottom: 16px; }

.step { font-weight: 700; display: flex; gap: 10px; align-items: center; font-size: 18px; }
.step .n { background: var(--blue); color: #06101c; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
select, input { width: 100%; background: #0e141b; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 13px; font: inherit; margin: 6px 0 10px; min-height: 50px; }
label { display: block; font-size: 14px; color: var(--muted); margin-top: 8px; }
.field { display: grid; grid-template-columns: 1fr 120px; gap: 8px; align-items: center; margin-bottom: 4px; }
.field span { font-size: 15px; }
.field input { margin: 0; text-align: right; }
.field input[type=checkbox] { width: 26px; height: 26px; min-height: 0; justify-self: end; }

.md h1 { font-size: 19px; margin: 0 0 8px; }
.md h2 { font-size: 16px; margin: 16px 0 6px; color: var(--blue); }
.md p, .md li { font-size: 15px; }
.md ul { padding-left: 20px; margin: 6px 0; }
.md .tbl { overflow-x: auto; margin: 8px 0; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.md th, .md td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.pre { background: #0e141b; border-radius: 12px; padding: 10px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; margin-top: 10px; max-height: 320px; overflow-y: auto; }

nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #0e141b; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav button { flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 4px 10px; min-height: 62px; }
nav button .ic { display: block; font-size: 20px; line-height: 1.3; }
nav button.on { color: var(--blue); }

.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; display: flex; align-items: flex-end; }
.sheet { width: 100%; max-width: 640px; margin: 0 auto; background: #172230; border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-title { font-size: 20px; font-weight: 800; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); background: #223244; padding: 13px 14px; border-radius: 14px; z-index: 30; text-align: center; font-size: 15px; }
.toast.bad { background: #4a2020; }
[hidden] { display: none !important; }
details.fold > .btn.wide, details.fold > select, details.fold > label { width: calc(100% - 32px); }
details.fold > label input { width: 100%; }

.gap { margin-top: 16px; }
.lessons > div { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.lessons > div:last-child { border-bottom: 0; }
.sug { background: #142338; border: 1px solid #1d3550; border-radius: 14px; padding: 12px; margin-top: 10px; }
.sug b { display: block; font-size: 16px; }
.chg { margin-top: 10px; font-size: 14px; color: var(--muted); }
.chg b { color: var(--text); }
.tag { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #1a2430; margin-right: 6px; }
.tag.kept { color: var(--green); } .tag.rolled_back { color: var(--red); } .tag.watching { color: var(--amber); }
.seg { display: flex; background: #0e141b; border-radius: 12px; padding: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; padding: 10px; border-radius: 9px; min-height: 46px; font-weight: 600; }
.seg button.on { background: #1f2c3a; color: var(--text); }

nav button { position: relative; }
.dotbadge { position: absolute; top: 6px; right: 22%; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; min-width: 18px; padding: 1px 5px; }
.board > div { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.board b { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.call { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #1a2430; margin-left: 6px; }
.call.normal, .call.buy_ideas { color: var(--green); } .call.reduced, .call.stagger, .call.wait { color: var(--amber); } .call.stand_aside { color: var(--red); }
.prop { background: #142338; border: 1px solid #1d3550; border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.prop.urgent { border-color: #6b2b2b; background: #2c1414; }
.prop .row { display: flex; gap: 8px; margin-top: 10px; }
.prop .row .btn { flex: 1; min-height: 48px; padding: 10px; }

.sheet.tall { max-height: 92vh; overflow-y: auto; }
.symlink { color: var(--blue); text-decoration: underline; cursor: pointer; background: none; border: 0; font: inherit; font-weight: 800; padding: 0; }
.call.strong, .call.hold, .call.add_on_dip { color: var(--green); } .call.weak, .call.sell, .call.avoid { color: var(--red); } .call.review, .call.none { color: var(--amber); }
.lvl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.key i { display: inline-block; width: 14px; height: 3px; margin: 0 4px 3px 10px; border-radius: 2px; }
.key .k-price { background: #35d07f; } .key .k-50 { background: #f5b942; } .key .k-200 { background: #93a0ad; } .key .k-entry { background: #5aa9ff; } .key .k-stop { background: #ff6b6b; }
.btn.small { min-height: 32px; padding: 2px 8px; }
#stChart svg { height: 180px; }
