:root {
  --bg: #f8fafc; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --green: #15803d; --green-bg: #dcfce7; --red: #b91c1c; --red-bg: #fee2e2; --amber: #b45309; --amber-bg: #fef3c7;
  --blue: #1d4ed8; --blue-bg: #dbeafe; --accent: #0f172a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --card: #111a2e; --text: #e5e7eb; --muted: #94a3b8; --line: #1e293b;
    --green: #4ade80; --green-bg: #052e16; --red: #f87171; --red-bg: #3b0a0a; --amber: #fbbf24; --amber-bg: #3a2a05;
    --blue: #93c5fd; --blue-bg: #0b2447; --accent: #e5e7eb;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --card: #111a2e; --text: #e5e7eb; --muted: #94a3b8; --line: #1e293b;
  --green: #4ade80; --green-bg: #052e16; --red: #f87171; --red-bg: #3b0a0a; --amber: #fbbf24; --amber-bg: #3a2a05;
  --blue: #93c5fd; --blue-bg: #0b2447; --accent: #e5e7eb;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #0f172a; color: #fff; }
.brand { font-weight: 700; font-size: 17px; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f59e0b; color: #111; margin-left: 6px; vertical-align: 2px; }
.pill.live { background: #22c55e; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 22px; padding: 4px 8px; }
main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
.banner { border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-weight: 500; }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner.amber { background: var(--amber-bg); color: var(--amber); }
.banner.blue { background: var(--blue-bg); color: var(--blue); }
.banner.green { background: var(--green-bg); color: var(--green); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge.buy, .badge.HOLD { background: var(--green-bg); color: var(--green); }
.badge.sell, .badge.EXIT { background: var(--red-bg); color: var(--red); }
.badge.BOOK, .badge.CHECK { background: var(--amber-bg); color: var(--amber); }
.badge.grey { background: var(--line); color: var(--muted); }
.sym { font-size: 18px; font-weight: 700; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 10px 0; }
.grid > div { border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.grid .k { font-size: 12px; color: var(--muted); }
.grid .v { font-size: 16px; font-weight: 600; }
.pos { color: var(--green); } .neg { color: var(--red); }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--blue); }
ul.reasons { margin: 6px 0; padding-left: 18px; }
ul.reasons li { margin: 3px 0; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
details { margin: 8px 0; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
ol.steps li { margin: 6px 0; }
.cues { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.cue { display: flex; justify-content: space-between; font-size: 14px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 12px; }
.tabs a span { display: block; font-size: 20px; }
.tabs a.active { color: var(--blue); font-weight: 700; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog form { padding: 16px; max-height: 85vh; overflow-y: auto; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview { background: var(--bg); border-radius: 10px; padding: 10px; margin-top: 12px; font-size: 14px; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.lockscreen { position: fixed; inset: 0; background: var(--bg); z-index: 30; display: grid; place-items: center; }
.lockscreen[hidden] { display: none; }
.lockbox { text-align: center; padding: 24px; }
.lockbox img { border-radius: 16px; }
dl.glossary dt { font-weight: 700; margin-top: 12px; }
dl.glossary dd { margin: 2px 0 0; color: var(--muted); }
svg.spark { width: 100%; height: 120px; }
a { color: var(--blue); }
