:root {
  color-scheme: dark;
  --bg: #101014;
  --sidebar: #141319;
  --surface: #1a1920;
  --surface-hover: #212029;
  --border: #2b2934;
  --text: #f1eff6;
  --muted: #a6a1b2;
  --violet: #bea8ff;
  --violet-bg: #302445;
  --green: #78d9af;
  --red: #f29aa5;
  --amber: #ebc183;
  --app-height: 100dvh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --viewport-bottom: 0px;
  --keyboard-top: 0px;
  --keyboard-bottom: 0px;
  --dialog-height: 100dvh;
  font: 15px/1.5 Inter, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.telegram-webview {
  --app-height: var(--tg-viewport-stable-height, 100dvh);
  --safe-top: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-right: max(env(safe-area-inset-right, 0px), calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --safe-left: max(env(safe-area-inset-left, 0px), calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px)));
  --viewport-bottom: max(0px, calc(100dvh - var(--app-height)), var(--keyboard-bottom));
  --dialog-height: calc(100dvh - var(--viewport-bottom) - var(--keyboard-top));
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; }
a { text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { flex: none; vertical-align: middle; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(29px, 4vw, 39px); font-weight: 680; line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 18px; letter-spacing: -.025em; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.profit { color: var(--green); }
.loss { color: var(--red); }
.body-copy { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.loading, .empty { padding: 24px 4px; color: var(--muted); }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: var(--app-height); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: var(--app-height); padding: calc(25px + var(--safe-top)) 15px calc(16px + var(--safe-bottom)) calc(15px + var(--safe-left)); border-right: 1px solid var(--border); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; padding-left: 5px; white-space: nowrap; }
.brand strong, .brand small, .sidebar-footer strong, .sidebar-footer small { display: block; }
.brand strong { font-size: 15px; font-weight: 670; letter-spacing: -.025em; }
.brand small, .sidebar-footer small { color: var(--muted); margin-top: 1px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; color: #d6c7ff; background: #352650; border: 1px solid #4b386a; border-radius: 12px; }
.brand-mark svg { fill: currentColor; stroke-width: .5; }
.sidebar nav { display: grid; gap: 5px; margin: 38px 0 auto; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-weight: 525; transition: background .16s ease, color .16s ease; }
.sidebar nav a:hover { color: var(--text); background: var(--surface); }
.sidebar nav a[aria-current] { color: #d9caff; background: #292036; border-color: #3b2c50; }
.sidebar-footer { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--border); padding: 16px 7px 2px; }
.sidebar-footer strong { font-size: 13px; }
.local-dot { display: inline-block; background: #b498ef; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 4px #302240; }
.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: calc(65px + var(--safe-top)); padding: calc(10px + var(--safe-top)) calc(clamp(16px, 3vw, 44px) + var(--safe-right)) 10px clamp(16px, 3vw, 44px); border-bottom: 1px solid var(--border); }
.topbar .brand { display: none; }
.topbar-right { display: flex; gap: 9px; align-items: center; }
.mode-tag i { display: block; width: 6px; height: 6px; border-radius: 50%; background: #aba4b8; }
.mode-tag .paper-dot { background: var(--violet); }
#view { width: 100%; max-width: 1330px; margin: auto; padding: 30px calc(clamp(16px, 3vw, 44px) + var(--safe-right)) calc(36px + var(--safe-bottom)) clamp(16px, 3vw, 44px); outline: none; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-subtitle { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin-top: 9px; color: var(--muted); font-size: 14px; }
.page-subtitle span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.page-subtitle strong { font-size: 12px; color: #cfcae0; }
.page-subtitle svg { color: var(--violet); }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; white-space: nowrap; font-weight: 640; font-size: 13px; line-height: 1.25; transition: background .16s ease, border-color .16s ease; }
.button.primary { background: #bca5f6; color: #1c122b; border-color: #bca5f6; }
.button.primary:hover { background: #d0bfff; border-color: #d0bfff; }
.button.secondary, .icon-button { background: #211f29; color: var(--text); border-color: #373343; }
.button.secondary:hover, .icon-button:hover { background: #2b2637; border-color: #59476f; }
.icon-button { min-height: 36px; width: 36px; padding: 0; color: var(--muted); }
.text-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: transparent; color: var(--violet); font-weight: 620; font-size: 13px; text-align: left; }
.text-link:hover { color: #e1d6ff; }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 8px; border: 1px solid #383541; border-radius: 7px; background: #25232c; color: #c9c5d2; font-size: 11px; font-weight: 670; letter-spacing: .025em; white-space: nowrap; }
.tag.violet, .event-icon.violet { background: var(--violet-bg); color: var(--violet); border-color: #493663; }
.tag.success { color: var(--green); background: #18312a; border-color: #2d4a40; }
.tag.error, .event-icon.error { color: var(--red); background: #38242c; border-color: #53323c; }
.tag.amber, .event-icon.amber { color: var(--amber); background: #362c21; border-color: #4e3b28; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { display: flex; min-width: 0; flex-direction: column; padding: 16px 16px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.metric.balance { background: #221a2e; border-color: #403051; }
.metric-icon { display: grid; width: 34px; height: 34px; margin-bottom: 13px; place-items: center; background: #302640; border-radius: 9px; color: var(--violet); }
.metric p { color: var(--muted); font-size: 13px; font-weight: 560; }
.metric > strong { display: block; margin: 3px 0 4px; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.18; letter-spacing: -.05em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric strong small { color: var(--muted); font-weight: 580; letter-spacing: 0; white-space: nowrap; }
.metric footer { margin-top: auto; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 18px; }
#view > .panel + .panel, .settings-aside > .panel + .panel { margin-top: 16px; }
.padded { padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.parameter-grid > div { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: #17161c; }
.parameter-grid span, .panel-foot small { display: block; color: var(--muted); font-size: 12px; }
.parameter-grid strong { font-size: 19px; letter-spacing: -.035em; }
.parameter-grid small { color: var(--muted); letter-spacing: 0; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding-top: 12px; color: var(--muted); font-size: 12px; }
.panel-foot svg { margin-right: 3px; color: var(--violet); }
.panel-foot small { margin: 2px 0 0 24px; }
.segments { display: flex; gap: 4px; min-width: 0; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: #141319; }
.segments label { position: relative; flex: 1; }
.segments input { position: absolute; opacity: 0; }
.segments label span { display: block; padding: 8px; border: 1px solid transparent; border-radius: 7px; text-align: center; font-size: 12px; font-weight: 670; color: var(--muted); cursor: pointer; }
.segments input:focus-visible + span { outline: 2px solid var(--violet); }
.segments input:checked + span { background: #36274e; color: #dccaff; border-color: #4a3662; }
.segments label.locked span { color: #797381; cursor: default; }
.mode-save { width: 100%; margin-top: 10px; }
.safety-note { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--amber); font-size: 12px; }

.strategy-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 13px; }
.source-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 9px; width: min(100%, 365px); padding: 0 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.search input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: none; }
.search:focus-within { outline: 2px solid var(--violet); outline-offset: 2px; }
#coin-count { white-space: nowrap; }
.coin-grid, .position-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.coin-card header, .coin-card footer, .position-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.coin-card footer { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 9px; color: var(--muted); }
.coin-values { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.coin-values > div { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.coin-values span, .coin-values small { display: block; color: var(--muted); }
.coin-values span { font-size: 12px; }
.coin-values strong { display: block; font-size: 19px; }
.coin-values > div:first-child strong { color: var(--green); }
.coin-values > div:last-child strong { color: var(--red); }
.coin-mark { display: grid; place-items: center; flex: 0 0 34px; height: 34px; background: #2b2438; color: var(--violet); border: 1px solid #423254; border-radius: 10px; font-size: 15px; font-weight: 650; }
.pair { display: flex; align-items: center; gap: 9px; min-width: 0; text-align: left; }
.pair > div { min-width: 0; }
.pair strong { display: block; word-break: break-word; }
.pair small { display: block; font-size: 11px; font-weight: 670; letter-spacing: .04em; }
.policy { margin-top: 16px; }
.policy summary { cursor: pointer; font-weight: 620; }
.policy summary svg { margin-right: 6px; color: var(--violet); }
.policy p { margin-top: 10px; max-width: 80ch; font-size: 14px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 15px; }
.settings-aside .body-copy { margin: 10px 0 0; }
.fields { display: grid; gap: 10px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.padded h2 + .fields, .padded .muted + .fields { margin-top: 10px; }
.padded h2 + .muted { margin-top: 5px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: #c9c4d1; font-size: 13px; }
.field input, .field select, .search input { min-height: 42px; width: 100%; color: var(--text); font-size: 14px; }
.field input, .field select { padding: 8px 9px; background: #141319; border: 1px solid #3a3645; border-radius: 8px; }
input::placeholder { color: #9a93a7; opacity: 1; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 14px; }
.toggle-row small { color: var(--muted); margin-top: 2px; }
.switch { appearance: none; position: relative; flex: 0 0 36px; width: 36px; height: 21px; margin: 0; border: 1px solid #62576f; border-radius: 15px; background: #332c41; cursor: pointer; }
.switch::after { content: ''; display: block; position: absolute; top: 3px; left: 3px; height: 13px; width: 13px; border-radius: 50%; background: #bdb6c8; transition: transform .15s ease; }
.switch:checked { background: #ad91ee; border-color: #ad91ee; }
.switch:checked::after { background: #271846; transform: translateX(15px); }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.form-status { padding: 8px 10px; margin-top: 10px; border: 1px solid #53323c; border-radius: 8px; color: var(--red); background: #2e1d24; font-size: 13px; }
.form-status .text-link { display: flex; }

.position-card { padding: 13px; background: #15141a; border: 1px solid var(--border); border-radius: 11px; }
.position-card header { justify-content: flex-start; margin-bottom: 8px; }
.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.list-hint { margin-bottom: 4px; }
.data-row { display: grid; width: 100%; min-width: 0; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); padding: 9px 3px; transition: background .16s ease; }
.data-row:hover { background: var(--surface-hover); }
.data-row:last-child { border-bottom: 0; }
.data-row > svg { justify-self: end; color: var(--muted); }
.trade-row { grid-template-columns: minmax(110px, 1.4fr) minmax(42px, .6fr) minmax(0, .8fr) minmax(82px, 1fr) 15px; }
.trade-date, .row-result small { color: var(--muted); font-size: 12px; }
.trade-date { white-space: nowrap; }
.row-result { text-align: right; font-variant-numeric: tabular-nums; }
.row-result strong { font-size: 14px; white-space: nowrap; }
.row-result small { display: block; white-space: nowrap; }
.list-foot:not(:empty) { display: flex; justify-content: center; padding-top: 13px; border-top: 1px solid var(--border); margin-top: 4px; }
.event-row { grid-template-columns: 32px minmax(0, 1fr) auto 16px; }
.event-icon { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid; border-radius: 8px; }
.event-title { display: grid; min-width: 0; }
.event-title small { color: var(--muted); }
.event-title .decision-detail { overflow-wrap: anywhere; }
.event-title strong { font-size: 14px; font-weight: 580; overflow-wrap: anywhere; }
.back-link { margin-bottom: 14px; }
.history-view .shell { display: block; }
.history-view .sidebar, .history-view .topbar { display: none; }
.history-view #view { max-width: 1230px; padding-top: calc(30px + var(--safe-top)); padding-left: calc(clamp(16px, 3vw, 44px) + var(--safe-left)); }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.filters .field { flex: 1 1 122px; }
.filters .form-status { flex-basis: 100%; margin: 0; }
.filters .button { min-height: 42px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); min-height: 42px; }
.check input { width: 16px; height: 16px; accent-color: #bca5f6; }
.list-panel { margin-top: 14px; }

.detail { inset: calc(var(--safe-top) + var(--keyboard-top)) var(--safe-right) calc(var(--safe-bottom) + var(--viewport-bottom)) var(--safe-left); width: min(600px, calc(100% - 36px - var(--safe-left) - var(--safe-right))); max-height: min(calc(var(--dialog-height) - var(--safe-top) - var(--safe-bottom) - 30px), 88dvh, 830px); padding: 0; margin: auto; background: var(--surface); border: 1px solid #454050; border-radius: 16px; color: var(--text); box-shadow: 0 14px 64px #0b090fb3; overflow: hidden; }
.detail[open] { display: flex; flex-direction: column; animation: reveal .15s ease-out; }
.detail::backdrop { background: #070609bc; }
body:has(.detail[open]) { overflow: hidden; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; flex: none; gap: 10px; padding: 13px 19px; border-bottom: 1px solid var(--border); }
.dialog-top h2 { overflow-wrap: anywhere; }
.dialog-body { padding: 16px 19px 20px; overflow: auto; overscroll-behavior: contain; }
.dialog-body .fields, .dialog-body .field + .field { margin-top: 9px; }
.dialog-body .fields .field + .field { margin-top: 0; }
.detail-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 15px; }
.detail-section h3 { margin-bottom: 6px; }
.detail-section .section-heading h3 { margin: 0; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.trade-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border: 1px solid #433552; border-radius: 10px; background: #231c2e; }
.trade-hero small, .trade-hero strong { display: block; }
.trade-hero small { color: var(--muted); }
.trade-hero strong { margin-top: 2px; font-size: clamp(15px, 3.2vw, 22px); }
.toast { position: fixed; z-index: 2; right: calc(18px + var(--safe-right)); bottom: calc(18px + var(--safe-bottom) + var(--viewport-bottom)); width: max-content; max-width: calc(100% - 36px - var(--safe-left) - var(--safe-right)); padding: 10px 14px; border: 1px solid #584572; border-radius: 10px; color: var(--text); background: #2c233b; box-shadow: 0 6px 32px #08071085; animation: reveal .15s ease-out; }
.toast-error { border-color: #704453; background: #39252c; }
.error-screen { display: grid; gap: 12px; justify-items: start; }
.error-screen svg { color: var(--amber); }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1150px) {
  .shell { grid-template-columns: 198px minmax(0, 1fr); }
  .brand { gap: 7px; }
  .metrics { gap: 9px; }
  .metric { padding: 13px; }
}
@media (max-width: 860px) {
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .position-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 2; top: auto; bottom: var(--viewport-bottom); left: 0; right: 0; height: auto; display: block; padding: 4px calc(4px + var(--safe-right)) max(4px, var(--safe-bottom)) calc(4px + var(--safe-left)); border: 0; border-top: 1px solid #383442; background: #17161d; }
  .sidebar > .brand, .sidebar-footer { display: none; }
  .sidebar nav { grid-template-columns: repeat(5, 1fr); gap: 1px; margin: 0; }
  .sidebar nav a { min-height: 52px; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 0; font-size: 10px; text-align: center; }
  .topbar { min-height: calc(61px + var(--safe-top)); justify-content: space-between; padding-left: calc(16px + var(--safe-left)); }
  .topbar .brand { display: flex; padding: 0; }
  .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 10px; }
  .topbar-right { gap: 5px; }
  .topbar-right .icon-button { width: 32px; min-height: 32px; }
  #view { padding: 22px calc(14px + var(--safe-right)) calc(74px + var(--safe-bottom) + var(--viewport-bottom)) calc(14px + var(--safe-left)); }
  .history-view #view { padding: calc(22px + var(--safe-top)) calc(14px + var(--safe-right)) calc(24px + var(--safe-bottom) + var(--viewport-bottom)) calc(14px + var(--safe-left)); }
  .page-heading { align-items: flex-start; margin-bottom: 16px; gap: 10px; }
  .page-subtitle { margin-top: 6px; font-size: 12px; }
  .page-subtitle strong { font-size: 11px; }
  .metrics { margin-bottom: 13px; }
  .metric-icon { margin-bottom: 7px; width: 29px; height: 29px; }
  .metric p, .metric footer { font-size: 11px; }
  .panel { padding: 13px; }
  .dashboard-grid { gap: 12px; margin-bottom: 12px; }
  .page-heading .button { min-height: 36px; padding-inline: 8px; font-size: 12px; }
  .coin-grid { gap: 8px; }
  .coin-card { padding: 9px; }
  .coin-card .coin-mark { flex-basis: 28px; height: 28px; }
  .coin-card .pair strong { font-size: 12px; }
  .coin-values { gap: 4px; }
  .coin-values > div { padding: 5px; }
  .coin-values small { font-size: 9px; }
  .coin-card footer small { font-size: 11px; }
  .coin-card footer .text-link { min-height: 33px; }
  .trade-row { grid-template-columns: minmax(0, 1fr) minmax(37px, auto) minmax(82px, auto) 12px; gap: 7px; }
  .trade-date { display: none; }
  .row-result strong { font-size: 12px; }
  .trade-row .pair strong { font-size: 12px; }
  .trade-row .coin-mark { flex-basis: 26px; height: 26px; font-size: 13px; }
  .filters { gap: 8px; }
  .filters .field { flex-basis: 42%; }
  .detail { width: calc(100% - 20px - var(--safe-left) - var(--safe-right)); max-height: calc(var(--dialog-height) - 30px - var(--safe-top) - var(--safe-bottom)); }
  .telegram-webview .field input, .telegram-webview .field select, .telegram-webview .search input { font-size: 16px; }
  .dialog-top, .dialog-body { padding-inline: 12px; }
  .toast { bottom: calc(68px + var(--safe-bottom) + var(--viewport-bottom)); }
  .history-view .toast { bottom: calc(15px + var(--safe-bottom) + var(--viewport-bottom)); }
}
@media (max-width: 370px) {
  .coin-grid { grid-template-columns: 1fr; }
  .strategy-toolbar { gap: 7px; }
  .section-heading { gap: 6px; }
  .topbar { padding-inline: calc(10px + var(--safe-left)) calc(10px + var(--safe-right)); }
  .topbar .brand strong { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
