/* AlphaPride app. Dark trading look from the "AlphaPride App Screens" design: night background, gold for the brand and
   primary actions, green and coral for profit and loss, IBM Plex for reading, Plex Mono for numbers, Sora for headings.
   Phone first: one column with a bottom tab bar. From 960px wide: a side menu and wider grids. */
:root {
  color-scheme: dark;
  --bg: #0B0E13; --bg-2: #0F131A; --card: #141922; --card-2: #1B222D; --line: #273040; --line-2: #1F2632;
  --fg: #EEF1F5; --fg-2: #CDD3DB; --muted: #A3ADBB; --dim: #5C6675;
  --gold: #F2B84B; --gold-2: #FFD27A; --gold-bg: #2A2414; --gold-deep: #1A1204;
  --green: #3DD68C; --green-2: #7BE7AE; --green-bg: #123024;
  --red: #FF7A6B; --red-2: #FF9C90; --red-bg: #2A1412;
  --blue: #6CA8FF; --blue-bg: #1A2233;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --head: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  --r: 14px; --r-sm: 10px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--green); } .down { color: var(--red); } .muted { color: var(--muted); } .dim { color: var(--dim); } .gold { color: var(--gold); }
.small { font-size: 13px; } .tiny { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* boot and layout */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { display: grid; justify-items: center; gap: 10px; color: var(--muted); font-family: var(--head); }
.boot-mark img { animation: pulse 1.6s ease-in-out infinite; border-radius: 50%; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }
.shell { min-height: 100vh; }
.main { padding: calc(14px + var(--safe-t)) 16px calc(var(--tabbar) + 24px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.side { display: none; }
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px; border-right: 1px solid var(--line-2); background: var(--bg-2); }
  .main { max-width: 1120px; padding: 26px 32px 48px; margin: 0; width: 100%; }
  .tabbar { display: none !important; }
  .wide-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .wide-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .wide-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--head); letter-spacing: -.3px; color: var(--fg); }
.brand img { width: 30px; height: 30px; border-radius: 50%; }
.side .brand { margin: 0 8px 18px; }
.side-group { margin: 14px 8px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.side a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--fg-2); font-size: 14px; }
.side a:hover { background: var(--card); color: var(--fg); }
.side a.on { background: var(--gold-bg); color: var(--gold); }
.side a svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding: 14px 8px 0; color: var(--dim); font-size: 12px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + var(--safe-b)); background: rgba(11, 14, 19, .96); border-top: 1px solid var(--line-2); backdrop-filter: blur(10px); }
.tabbar a { display: grid; justify-items: center; gap: 4px; padding: 4px 0; color: var(--muted); font-size: 11px; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { color: var(--gold); }
.tabbar .badge { position: absolute; margin-left: 18px; margin-top: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font: 600 10px/16px var(--sans); }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* page header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 40px; }
.top h1 { font: 700 26px/1.15 var(--head); letter-spacing: -.4px; }
.top .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-size: 14px; margin-bottom: 12px; background: none; border: 0; padding: 4px 0; }
.lede { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.sec-h h2 { font: 600 18px var(--head); }

/* cards and pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.flat { background: var(--bg-2); }
.card.hl { border-color: var(--gold); }
.card, .item, .wide-2 > *, .wide-3 > *, .wide-main > * { min-width: 0; }
.card.warn { border-color: #5a2a24; }
.card h3 { font: 600 16px var(--sans); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.kv.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv dt { color: var(--muted); font-size: 12px; } .kv dd { margin: 2px 0 0; font: 500 14px var(--mono); overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stat span { display: block; color: var(--muted); font-size: 12px; } .stat b { display: block; font: 600 16px var(--mono); margin-top: 4px; }
@media (max-width: 380px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--card-2); color: var(--fg-2); white-space: nowrap; }
.pill.gold { background: var(--gold-bg); color: var(--gold); } .pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red-2); } .pill.blue { background: var(--blue-bg); color: var(--blue); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--dim); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(61, 214, 140, .6); } .dot.warn { background: var(--gold); } .dot.bad { background: var(--red); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }
.banner.blue { background: var(--blue-bg); color: #cfe0ff; } .banner.gold { background: var(--gold-bg); color: var(--gold-2); }
.banner.red { background: var(--red-bg); color: var(--red-2); } .banner.green { background: var(--green-bg); color: var(--green-2); }
.banner b { margin-left: auto; color: var(--gold); white-space: nowrap; }
.list { display: grid; gap: 10px; }
.item { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--fg); }
a.item:hover, button.item:hover { border-color: #3A4556; color: var(--fg); }
button.item { width: 100%; text-align: left; }
.item .t { font-weight: 600; } .item .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.chev { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chev::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); flex: none; margin-right: 4px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--r); font-size: 14px; }
.err-box { color: var(--red-2); background: var(--red-bg); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.skel { background: linear-gradient(90deg, var(--card) 0, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r); min-height: 80px; }
@keyframes sk { to { background-position: -200% 0; } }
.bar { height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; } .bar i.g { background: var(--gold); } .bar i.b { background: var(--blue); } .bar i.gr { background: var(--green); } .bar i.r { background: var(--red); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--fg); font-weight: 600; font-size: 15px; white-space: nowrap; }
.btn:hover { border-color: #3A4556; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-deep); }
.btn.primary:hover { background: var(--gold-2); }
.btn.green { background: var(--green); border-color: var(--green); color: #06210F; }
.btn.red { background: var(--red); border-color: var(--red); color: #2A0C08; }
.btn.ghost-red { background: var(--red-bg); border-color: #6b2f28; color: var(--red-2); }
.btn.ghost { background: transparent; }
.btn svg { width: 18px; height: 18px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.dashed { border-style: dashed; background: transparent; color: var(--gold); }
.linkbtn { background: none; border: 0; color: var(--gold); padding: 0; font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 10px 6px; white-space: nowrap; border-radius: 9px; font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--gold); color: var(--gold-deep); font-weight: 600; }
.seg.sm button { padding: 6px 8px; font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--fg-2); border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.chips button.on { background: var(--gold); border-color: var(--gold); color: var(--gold-deep); font-weight: 600; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 0; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--gold); font-weight: 600; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--fg-2); font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font: 500 16px var(--mono); }
textarea.input { font: 400 14px var(--sans); min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 184, 75, .18); }
.input.text { font-family: var(--sans); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { appearance: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--muted); background: transparent; display: grid; place-items: center; margin: 0; flex: none; }
.check input:checked { background: var(--gold); border-color: var(--gold); }
.check input:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--gold-deep); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked { background: var(--gold); border-color: var(--gold); }
.switch input:checked::after { transform: translateX(18px); background: var(--gold-deep); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-2); font-size: 18px; }
.stepper b { min-width: 38px; text-align: center; font: 600 15px var(--mono); }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.setting:last-child { border-bottom: 0; }
.setting .l { font-size: 14px; } .setting .h { grid-column: 1; color: var(--muted); font-size: 12px; }
.setting .input { width: 120px; min-height: 38px; padding: 6px 10px; text-align: right; font-size: 15px; }
.setting .unit { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* positions, signals */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.pos .sym { font: 600 16px var(--sans); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pos .sub { color: var(--muted); font-size: 13px; }
.pos .res { text-align: right; font-family: var(--mono); } .pos .res b { display: block; font-size: 17px; } .pos .res small { font-size: 13px; }
.sig-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-head .sym { font: 700 18px var(--sans); }
.countdown { margin-left: auto; font: 500 13px var(--mono); color: var(--red-2); }
.reason { font-size: 14px; color: var(--fg-2); }
.reason.gold { color: var(--gold); font-weight: 600; }

/* charts */
.chart { position: relative; width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; touch-action: pan-y; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart .ch-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 2px; background: var(--gold); vertical-align: middle; margin-right: 6px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }

/* trade ticket */
.ticker-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.ticker-head .sym { font: 700 22px var(--head); display: flex; align-items: center; gap: 8px; }
.ticker-head .last { font: 600 24px var(--mono); text-align: right; }
.mini-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 12px; }
.mini-kv span { display: block; color: var(--muted); font-size: 11px; } .mini-kv b { font: 500 13px var(--mono); }
.tpsl { display: grid; grid-template-columns: 52px minmax(0, 1fr) 56px; gap: 8px; align-items: center; margin-top: 8px; }
.tpsl label { font-size: 14px; } .tpsl .input { min-height: 40px; font-size: 14px; }
.tpsl .pct { text-align: right; color: var(--muted); font: 500 13px var(--mono); }
.buysell { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.buysell .btn { min-height: 52px; font-size: 16px; }

/* sheets, dialogs, toasts */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: grid; align-items: end; justify-items: center; animation: fade .15s; }
@media (min-width: 700px) { .scrim { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
@media (min-width: 700px) { .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h2 { font: 600 20px var(--head); margin-bottom: 8px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 18px; } .sheet .acts .btn { flex: 1; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 16px + var(--safe-b)); z-index: 80; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 24px; } }
.toast { background: #222b38; border: 1px solid var(--line); color: var(--fg); padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); animation: up .2s; }
.toast.ok { border-color: #1F4A33; } .toast.bad { border-color: #6b2f28; color: var(--red-2); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); }
.login-card .brand { justify-content: center; font-size: 26px; margin-bottom: 6px; }
.login-card .brand img { width: 44px; height: 44px; }
.login-card .tag { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.qr { width: 220px; height: 220px; margin: 12px auto; display: block; border-radius: 12px; background: #fff; }
.secret { font: 600 15px var(--mono); letter-spacing: .06em; text-align: center; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px; word-break: break-all; user-select: all; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 24px !important; }
.install { display: none; }
.install.show { display: flex; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line-2); font-family: var(--mono); }
.tbl td.t { font-family: var(--sans); }
.tbl-wrap { overflow-x: auto; }
pre.json { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12px/1.5 var(--mono); overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-word; }
