:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8eef7;
  background: #0c1016;
  --sheet: #141a23;
  --raised: #19212c;
  --stroke: #293444;
  --muted: #a1aec0;
  --blue: #67afff;
  --green: #3ed4a4;
  --red: #ff858f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .47; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-size: 1.15rem; letter-spacing: -.02em; }
h3 { font-size: .95rem; }
.shell { max-width: 1560px; margin: auto; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: max(.85rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .85rem max(1rem, env(safe-area-inset-left)); border-bottom: 1px solid var(--stroke); background: #11151c; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 720; letter-spacing: -.035em; font-size: 1.17rem; }
.brand-mark { width: 1.45rem; height: 1.45rem; display: inline-flex; gap: 3px; align-items: end; justify-content: center; padding: 4px 3px; border-radius: 6px; background: #203a57; }
.brand-mark i { width: 3px; height: 45%; border-radius: 2px; background: var(--blue); }
.brand-mark i:nth-child(2) { height: 74%; }
.brand-mark i:nth-child(3) { height: 97%; }
.connections { display: flex; gap: .4rem; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: .42rem; padding: .35rem .55rem; border: 1px solid var(--stroke); border-radius: .45rem; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.status::before { content: ""; display: block; width: .46rem; height: .46rem; border-radius: 50%; background: #75849b; }
.status[data-state="live"]::before { background: var(--green); }
.status[data-state="loading"]::before, .status[data-state="reconnecting"]::before, .status[data-state="preview"]::before { background: #ffcb76; }
.status[data-state="offline"]::before { background: var(--red); }
.view-nav, .fast-tabs { display: flex; align-items: center; gap: .35rem; }
.view-nav button, .fast-tabs button { background: #151c25; border: 1px solid var(--stroke); border-radius: .48rem; padding: .44rem .75rem; color: var(--muted); white-space: nowrap; }
.view-nav button[aria-pressed="true"], .fast-tabs button[aria-pressed="true"] { background: #203b59; border-color: #335478; color: #dbecff; }
.preview-bar { padding: .5rem 1rem; background: #2a2319; color: #ffcf86; font-size: .85rem; text-align: center; }
.fast-workspace { padding: .9rem .85rem calc(4.8rem + env(safe-area-inset-bottom)); }
.fast-header { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .55rem; margin-bottom: .75rem; }
.fast-header h1 { font-size: 1.25rem; }
.fast-subtitle { margin-top: .2rem; font-size: .86rem; color: var(--muted); }
.fast-tabs { gap: .25rem; overflow-x: auto; padding: .1rem 0; }
.fast-tabs button { font-size: .86rem; flex: 0 0 auto; }
.fast-filters, .fast-status-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .65rem; }
.fast-filters { padding: .62rem 0; }
.fast-filters form { min-width: min(250px, 100%); flex: 1 1 17rem; }
.fast-filter { min-height: 37px; display: inline-flex; align-items: center; gap: .24rem; white-space: nowrap; }
.fast-filter input { width: .98rem; min-height: .98rem; margin: 0; accent-color: #3980d0; }
.fast-table-wrap { border: 1px solid var(--stroke); border-radius: .62rem; overflow: auto; background: #11161e; }
.fast-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.fast-table tr + tr { border-top: 1px solid #222b38; }
.fast-table th, .fast-table td { padding: .35rem .55rem; white-space: nowrap; text-align: right; }
.fast-table th { height: 2.35rem; font-size: .8rem; font-weight: 650; color: var(--muted); background: var(--sheet); }
.fast-table th:first-child, .fast-table td:first-child { text-align: left; }
.fast-table tbody tr:nth-child(2n) { background: #151b24; }
.fast-table tbody tr:hover { background: #1b2838; }
.fast-pair { display: inline-flex; align-items: center; gap: .24rem; padding: .1rem 0; border: 0; background: transparent; color: #e5edf7; font-weight: 650; }
.fast-star { color: #ffce7a; font-size: .87rem; }
.fast-speed { display: flex; justify-content: flex-end; align-items: center; gap: .38rem; }
.fast-tag { display: inline-block; padding: .12rem .26rem; border-radius: .25rem; font-size: .67rem; line-height: 1.15; }
.fast-tag[data-kind="HYPER"] { color: #ffe0a0; background: #594223; }
.fast-tag[data-kind="FAST"], .fast-tag[data-kind="HOT"], .fast-tag[data-kind="GOOD"] { color: #9ef0d3; background: #1b4339; }
.fast-tag[data-kind="OK"], .fast-tag[data-kind="WAKING"] { color: #b7d9ff; background: #213d59; }
.fast-tag[data-kind="RISKY"], .fast-tag[data-kind="THIN"] { color: #ffc1c7; background: #52323d; }
.fast-empty { padding: .95rem; color: var(--muted); font-size: .9rem; }
.fast-more { margin: .55rem; }
@media (max-width: 1049px) { .fast-full { display: none; } }
@media (max-width: 719px) {
  .fast-wide { display: none; }
  .fast-table th, .fast-table td { padding-inline: .33rem; }
  .fast-table { font-size: .82rem; }
  .fast-speed { flex-direction: column; align-items: flex-end; gap: .12rem; }
  .fast-pair { font-size: .84rem; }
  .view-nav { flex: 1 1 auto; }
  .view-nav button { min-height: 39px; }
}
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; padding: .85rem .85rem calc(4.8rem + env(safe-area-inset-bottom)); }
.market-panel, .trade-panel { min-width: 0; }
.quote { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .2rem .6rem; padding: 0 .1rem .6rem; }
.instrument, .price { display: flex; align-items: center; gap: .4rem; }
.instrument { flex-wrap: wrap; }
.pair, .favorite, .timeframes button, .tabs button, .mobile-nav button, .quiet-button, .icon-button { border: 1px solid transparent; background: none; border-radius: .5rem; }
.pair { display: flex; align-items: center; gap: .55rem; padding: 0 .7rem; border-color: var(--stroke); background: var(--sheet); font-weight: 720; font-size: 1.05rem; letter-spacing: .01em; }
.chevron { width: .45rem; height: .45rem; margin: -.22rem .05rem 0; border-right: 2px solid #a1aec0; border-bottom: 2px solid #a1aec0; transform: rotate(45deg); }
.favorite { padding: 0; min-width: 38px; font-size: 1.5rem; color: var(--muted); }
.favorite[aria-pressed="true"] { color: #ffce7a; }
.market-kind { display: none; font-size: .8rem; color: var(--muted); }
.price { min-height: 44px; justify-content: flex-end; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.price strong { font-size: clamp(1.25rem, 5vw, 1.9rem); letter-spacing: -.05em; }
.price span { color: var(--muted); font-size: .86rem; }
.price span.positive, .positive { color: var(--green); }
.price span.negative, .negative, .danger-text { color: var(--red); }
.timeframes, .tabs { display: flex; gap: .15rem; border: 1px solid var(--stroke); border-radius: .6rem; padding: .2rem; background: #11161e; }
.timeframes button, .tabs button { flex: 1; padding: .2rem .35rem; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.timeframes button.selected, .tabs button.selected { background: #203b59; color: #dbecff; border-color: #335478; }
.chart-frame { position: relative; margin-top: .6rem; padding-top: 1.75rem; border: 1px solid var(--stroke); border-radius: .65rem; background: #0e141c; overflow: hidden; }
.chart-caption { position: absolute; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; height: 1.75rem; padding: 0 .65rem; color: var(--muted); font-size: .78rem; }
.chart-caption button { min-height: 26px; border: 0; background: none; color: var(--blue); }
#chart { display: block; width: 100%; height: clamp(260px, 39svh, 465px); touch-action: pan-y; }
.chart-message { position: absolute; inset: 44% auto auto 50%; transform: translate(-50%, -50%); width: min(86%, 24rem); padding: .7rem; text-align: center; background: #151d28e8; border: 1px solid var(--stroke); border-radius: .45rem; color: var(--muted); font-size: .9rem; pointer-events: none; }
.trade-panel { padding: .7rem; border: 1px solid var(--stroke); border-radius: .7rem; background: #11161e; }
.panel-top { display: flex; align-items: center; gap: .5rem; justify-content: space-between; margin-bottom: .65rem; }
.quiet-button { padding: .48rem .65rem; background: var(--raised); border-color: var(--stroke); font-size: .9rem; }
.primary, .buy, .sell { border: 1px solid transparent; border-radius: .55rem; padding: .55rem .78rem; font-weight: 680; }
.primary { background: #2563a9; border-color: #3980d0; color: #fff; }
.buy { background: #155240; border-color: #2b8e72; color: #a4f1d5; }
.sell { background: #632c39; border-color: #9b5160; color: #ffd1d5; }
.session-card { display: grid; gap: .55rem; padding: .8rem; background: var(--sheet); border: 1px solid var(--stroke); border-radius: .6rem; }
.session-card p, .action-message { color: var(--muted); font-size: .88rem; }
.action-message { margin-top: .55rem; line-height: 1.4; }
.action-message[data-error="true"] { color: var(--red); }
.tabs { margin-bottom: .5rem; }
.tabs span { font-variant-numeric: tabular-nums; }
.account-list { display: grid; gap: .45rem; max-height: 20rem; overflow: auto; }
.position, .order-row, .empty { background: var(--sheet); border: 1px solid var(--stroke); border-radius: .55rem; padding: .65rem; }
.empty { color: var(--muted); font-size: .88rem; }
.row-main { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .92rem; font-variant-numeric: tabular-nums; }
.row-main strong { font-size: 1rem; }
.side { display: inline-block; margin-left: .4rem; font-weight: 600; font-size: .76rem; }
.row-meta, .order-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin: .45rem 0 0; }
.row-meta div, .order-summary div { min-width: 0; padding: .38rem .44rem; border-radius: .35rem; background: #10151d; }
.row-meta dt, .order-summary dt { color: var(--muted); font-size: .77rem; }
.row-meta dd, .order-summary dd { margin: .16rem 0 0; font-size: .89rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.row-actions { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.row-actions button { flex: 1 1 auto; }
.pair-cancel { width: 100%; margin-top: .5rem; }
.dock { display: flex; gap: .45rem; margin-top: .65rem; }
.dock .primary { flex: 2; }
.dock .quiet-button { flex: 1; }
.mobile-nav { position: fixed; bottom: 0; z-index: 1; inset-inline: 0; display: flex; gap: .15rem; padding: .22rem .8rem max(.22rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--stroke); background: #131922; }
.mobile-nav button { display: grid; flex: 1; justify-items: center; gap: .12rem; padding: .3rem .2rem; font-size: .78rem; color: var(--muted); }
.mobile-nav button.selected { color: var(--blue); }
.mobile-nav svg { width: 1.22rem; height: 1.22rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
dialog { width: min(100%, 32rem); max-height: 90dvh; margin: auto auto 0; border: 1px solid var(--stroke); border-radius: .85rem .85rem 0 0; padding: .9rem .9rem max(.9rem, env(safe-area-inset-bottom)); background: #161d27; color: inherit; }
dialog::backdrop { background: #04070bb8; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .55rem; margin-bottom: .55rem; }
.sheet-head p, #confirm-note { color: var(--muted); font-size: .88rem; line-height: 1.45; margin-top: .2rem; }
.icon-button { width: 44px; font-size: 1.5rem; color: var(--muted); }
.form-stack { display: grid; gap: .7rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
label { display: grid; gap: .26rem; color: var(--muted); font-size: .85rem; }
label.checkbox { min-height: 44px; grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; }
label.checkbox input { width: 1.2rem; min-height: 1.2rem; accent-color: #3980d0; }
input, select { min-height: 44px; width: 100%; min-width: 0; padding: .45rem .53rem; border: 1px solid var(--stroke); border-radius: .45rem; background: #10151c; color: #e8eef7; font-size: 1rem; }
.dialog-actions, .market-search { display: flex; gap: .45rem; }
.dialog-actions button { flex: 1; }
.pair-list { display: grid; gap: .32rem; margin-top: .55rem; }
.pair-list button { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.session-exit { margin-top: .6rem; }
@media (max-width: 719px) {
  .workspace:has(#account-body:not([hidden])) { padding-bottom: calc(8rem + env(safe-area-inset-bottom)); }
  .dock { position: fixed; inset: auto 0 calc(2.95rem + max(.22rem, env(safe-area-inset-bottom))); z-index: 1; margin: 0; padding: .38rem .85rem; border-top: 1px solid var(--stroke); background: #131922; }
}
@media (min-width: 720px) {
  .workspace { padding: 1.05rem 1.2rem; }
  dialog { margin: auto; border-radius: .85rem; }
  .mobile-nav { display: none; }
  .market-kind { display: inline; }
  .fast-workspace { padding: 1.05rem 1.2rem; }
}
@media (min-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(325px, 385px); align-items: start; gap: 1rem; }
  #chart { height: clamp(395px, 63vh, 760px); }
  .topbar { padding-inline: 1.2rem; }
}
