/* MT5 Gateway web app. Warm neutral surfaces with an optional dark theme. No external fonts, images or scripts. */

:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --surface-3: #efeeea;
  --line: #e6e5e1;
  --line-strong: #d5d3cc;
  --text: #0b0b0b;
  --muted: #52514e;
  --faint: #76746e;
  --accent: #803600;
  --accent-strong: #652b00;
  --accent-soft: #f6ece1;
  --up: #087a4d;
  --up-strong: #06663f;
  --up-soft: #e2f5ec;
  --down: #c62d24;
  --down-strong: #a8231b;
  --down-soft: #fdeceb;
  --warn: #a35a00;
  --warn-soft: #fff3df;
  --info-soft: #e8f0ff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: none;
  --shadow-lg: 0 10px 40px rgba(15, 27, 45, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar: 186px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.boot { padding: 48px; text-align: center; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.gap-top { margin-top: 16px; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand small { color: var(--faint); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--muted); font-weight: 550; text-decoration: none;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav svg { flex: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.chip {
  display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface-2); font-size: 12px;
}
.chip b { font-size: 13px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 10px 24px; background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; }
.topbar .right-side { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.content { padding: 24px; width: 100%; max-width: 1480px; margin: 0 auto; }
.scrim { display: none; }
.foot { padding: 20px 24px 32px; color: var(--faint); font-size: 12px; text-align: center; }

@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-102%); transition: transform 0.18s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 27, 45, 0.35); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 8px 14px; }
  .content { padding: 16px 14px; }
}

/* ---------------------------------------------------------------- basic parts */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 14px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.stats.tight { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid.wide-left { grid-template-columns: minmax(0, 1fr); } }

.stat { padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 550; }
.stat .value { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; width: 0; transition: width 0.3s ease; }
.bar.warn > i { background: #d98a00; }
.bar.danger > i { background: var(--down); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge.blue { background: var(--accent-soft); color: var(--accent-strong); }
.badge.green { background: var(--up-soft); color: var(--up-strong); }
.badge.red { background: var(--down-soft); color: var(--down-strong); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.solid-red { background: var(--down); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: #16a26b; box-shadow: 0 0 0 3px rgba(22, 162, 107, 0.18); }
.dot.bad { background: var(--down); box-shadow: 0 0 0 3px rgba(198, 45, 36, 0.16); }
.dot.wait { background: #d98a00; box-shadow: 0 0 0 3px rgba(217, 138, 0, 0.18); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn.danger:hover { background: var(--down-strong); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.small { width: 28px; }
.btn.block { width: 100%; }
.btn.buy { background: var(--up); border-color: var(--up); color: #fff; }
.btn.buy:hover { background: var(--up-strong); }
.btn.sell { background: var(--down); border-color: var(--down); color: #fff; }
.btn.sell:hover { background: var(--down-strong); }
.btn.big { height: 44px; font-size: 14px; }
.btn.warnbtn { background: var(--warn-soft); border-color: #f0c27a; color: var(--warn); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .lab { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); font-size: 13.5px; min-width: 0;
}
.textarea { height: auto; padding: 8px 10px; min-height: 80px; resize: vertical; }
.input.mono, .num-input { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 214, 0.15); outline: none; }
.input[disabled], .select[disabled] { background: var(--surface-3); color: var(--faint); }
.input.invalid { border-color: var(--down); box-shadow: 0 0 0 3px rgba(198, 45, 36, 0.12); }
.hint { font-size: 12px; color: var(--muted); }
.hint.error { color: var(--down); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-weight: 600; font-size: 12.5px;
  color: var(--muted); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 27, 45, 0.12); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 11px 10px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tabs .count { margin-left: 6px; background: var(--surface-3); border-radius: 999px; padding: 0 7px; font-size: 11px; color: var(--muted); }

.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; border: 1px solid;
  font-size: 13px; margin-bottom: 16px;
}
.banner svg { flex: none; margin-top: 1px; }
.banner.info { background: var(--info-soft); border-color: #c5d6fb; color: #1d3f8f; }
.banner.warn { background: var(--warn-soft); border-color: #f0d09b; color: #6e3d00; }
.banner.danger { background: var(--down-soft); border-color: #f3b7b3; color: #7f1a14; }
.banner.ok { background: var(--up-soft); border-color: #a9dfc6; color: #064d31; }
.banner b { font-weight: 700; }
.banner .end { margin-left: auto; }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
.tbl-scroll { max-height: 460px; overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--faint); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; font-family: var(--font); }
.tbl td.wrap { white-space: normal; min-width: 200px; }
.tbl .actions { text-align: right; }
.tbl .actions .btn + .btn { margin-left: 6px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.side-tag { font-weight: 700; font-size: 11px; letter-spacing: 0.04em; }
.side-tag.buy { color: var(--up); }
.side-tag.sell { color: var(--down); }
.sym { font-weight: 650; }
.flash-up { animation: flashUp 0.7s ease-out; }
.flash-down { animation: flashDown 0.7s ease-out; }
@keyframes flashUp { from { background: #c6efdc; } to { background: transparent; } }
@keyframes flashDown { from { background: #fbd0cc; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation: none; } .bar > i { transition: none; } }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #eef3ff 0%, #f6f8fb 45%, #eef7f3 100%); }
.login-card { width: 100%; max-width: 460px; padding: 28px; }
.login-card .brand { padding: 0 0 18px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); margin-bottom: 18px; }
.login-links { display: flex; gap: 14px; justify-content: center; margin-top: 18px; font-size: 13px; flex-wrap: wrap; }
.details { border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 10px 12px; margin-top: 16px; font-size: 13px; }
.details summary { cursor: pointer; font-weight: 600; }
.details p { margin: 8px 0 0; color: var(--muted); }

/* ---------------------------------------------------------------- trade page */
.trade-grid { display: grid; grid-template-columns: minmax(0, 1fr) 348px; gap: 16px; align-items: start; }
@media (max-width: 1150px) { .trade-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-card { overflow: hidden; }
.chart-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chart-box { position: relative; height: 460px; background: var(--surface); }
.chart-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
@media (max-width: 700px) { .chart-box { height: 340px; } }
.chart-msg { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(255, 255, 255, 0.8); text-align: center; padding: 20px; }
.quote { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.quote .big { font-family: var(--mono); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.quote .lbl { font-size: 11px; color: var(--faint); font-weight: 700; letter-spacing: 0.05em; margin-right: 4px; }
.sym-picker { position: relative; }
.sym-picker .input { width: 150px; font-weight: 650; }
.sym-list {
  position: absolute; top: 40px; left: 0; z-index: 40; min-width: 260px; max-height: 300px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px;
}
.sym-list button {
  display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: baseline; text-align: left;
  border: 0; background: none; padding: 7px 9px; border-radius: 7px; cursor: pointer;
}
.sym-list button:hover, .sym-list button.on { background: var(--accent-soft); }
.sym-list small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }

.ticket { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sidebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sidebtn {
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface); padding: 9px 10px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
}
.sidebtn .t { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; }
.sidebtn .p { font-family: var(--mono); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sidebtn.sell .t, .sidebtn.sell .p { color: var(--down); }
.sidebtn.buy .t, .sidebtn.buy .p { color: var(--up); }
.sidebtn.sell[aria-pressed="true"] { border-color: var(--down); background: var(--down-soft); }
.sidebtn.buy[aria-pressed="true"] { border-color: var(--up); background: var(--up-soft); }
.stepper { display: flex; }
.stepper .input { border-radius: 0; text-align: center; }
.stepper button { width: 36px; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: 16px; }
.stepper button:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.stepper button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.stepper button:hover { background: var(--surface-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result { border: 1px solid; border-radius: 10px; padding: 11px 13px; font-size: 13px; }
.result.ok { background: var(--up-soft); border-color: #a9dfc6; }
.result.fail { background: var(--down-soft); border-color: #f3b7b3; }
.result.unknown { background: var(--warn-soft); border-color: #f0d09b; }
.result h3 { font-size: 13.5px; margin-bottom: 4px; }
.result p { margin: 0 0 4px; }

/* ---------------------------------------------------------------- dialogs and toasts */
dialog.modal { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 28px)); color: var(--text); background: var(--surface); }
dialog.modal::backdrop { background: rgba(15, 27, 45, 0.45); }
.modal-head { padding: 16px 18px 6px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 8px 18px 14px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 9px; box-shadow: var(--shadow-lg); padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px;
}
.toast.ok { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
.toast.warn { border-left-color: #d98a00; }
.toast .msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .msg b { display: block; }
.toast button { border: 0; background: none; cursor: pointer; color: var(--faint); padding: 0 2px; font-size: 16px; line-height: 1; }

/* ---------------------------------------------------------------- feed, code, misc */
.feed { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.feed li { display: flex; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--faint); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
pre.code, .prose pre {
  margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  overflow: auto; font-size: 12.5px; line-height: 1.55; tab-size: 4;
}
.codebox { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface-2); margin: 0 0 1em; }
.codebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 6px 4px 12px; background: var(--surface-3); border-bottom: 1px solid var(--line); min-height: 34px; }
.codebar .lang { font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; }
.codebox pre, .prose .codebox pre { border: 0; border-radius: 0; margin: 0; background: var(--surface-2); }
.kbd, kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); font-size: 12px; }
.spark { display: block; width: 100%; height: 44px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), #f7f9fc, var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; min-height: 16px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.progress-line { height: 3px; background: var(--accent); position: fixed; top: 0; left: 0; z-index: 200; width: 0; transition: width 0.25s; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .two-col, .form-grid { grid-template-columns: minmax(0, 1fr); } }
.json { white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.log-line { font-family: var(--mono); font-size: 12px; padding: 3px 12px; border-bottom: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line.out { color: var(--accent-strong); background: var(--accent-soft); }
.log-line.err { color: var(--down); }
.log { max-height: 300px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }

/* ---------------------------------------------------------------- documentation pages */
.help-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 20px; align-items: start; }
@media (max-width: 1250px) { .help-grid { grid-template-columns: 230px minmax(0, 1fr); } .help-toc { display: none; } }
.help-nav { position: sticky; top: 76px; padding: 10px; }
.help-nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-weight: 550; text-decoration: none; }
.help-nav a:hover { background: var(--surface-3); color: var(--text); }
.help-nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
@media (max-width: 860px) {
  .help-grid { grid-template-columns: minmax(0, 1fr); }
  .help-nav { position: static; }
  .help-links { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .help-nav .help-links a { flex: none; white-space: nowrap; border: 1px solid var(--line); }
  .help-nav .help-links a.active { border-color: var(--accent); }
}
.help-toc { position: sticky; top: 76px; font-size: 12.5px; }
.help-toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--muted); }
.help-toc a:hover { color: var(--accent-strong); text-decoration: none; border-left-color: var(--accent); }
.help-toc a.l3 { padding-left: 22px; }
.help-toc .t { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.search-hit { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-hit:hover { background: var(--surface-3); text-decoration: none; }
.search-hit small { display: block; color: var(--muted); }
mark { background: #fff0a8; color: inherit; border-radius: 3px; padding: 0 1px; }

.prose { padding: 26px 30px 34px; max-width: 860px; }
@media (max-width: 700px) { .prose { padding: 18px 16px 26px; } }
.prose h1 { font-size: 26px; margin-bottom: 14px; }
.prose h2 { font-size: 20px; margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 16px; margin: 24px 0 8px; }
.prose h4 { font-size: 14px; margin: 18px 0 6px; }
.prose h1 + h2, .prose h2:first-child { border-top: 0; padding-top: 0; }
.prose p, .prose li { line-height: 1.65; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 0.9em; }
.prose li { margin: 3px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0; }
.prose code { background: var(--surface-3); border-radius: 5px; padding: 1px 5px; }
.prose pre code { background: none; padding: 0; border-radius: 0; }
.prose table { border-collapse: collapse; margin: 0 0 1em; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.prose blockquote { margin: 0 0 1em; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--info-soft); border-radius: 0 8px 8px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote.warning { border-left-color: #d98a00; background: var(--warn-soft); }
.prose blockquote.danger { border-left-color: var(--down); background: var(--down-soft); }
.prose blockquote.tip { border-left-color: var(--up); background: var(--up-soft); }
.prose .heading-link { color: var(--faint); margin-left: 6px; font-weight: 400; opacity: 0; text-decoration: none; }
.prose h2:hover .heading-link, .prose h3:hover .heading-link, .prose h4:hover .heading-link { opacity: 1; }
.prose details { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; background: var(--surface); }
.prose details > summary { padding: 12px 14px; cursor: pointer; font-weight: 650; font-size: 14.5px; list-style: none; display: flex; gap: 10px; align-items: center; }
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before { content: "+"; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-3); font-weight: 700; flex: none; }
.prose details[open] > summary::before { content: "-"; background: var(--accent-soft); color: var(--accent-strong); }
.prose details > .faq-body { padding: 0 16px 6px 44px; }
.prose details:target, .prose details.flash { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 214, 0.12); }

.chart-card .banner { margin: 0; border-radius: 0; border-width: 1px 0; }
.more-row { padding: 12px; text-align: center; border-top: 1px solid var(--line); }
.prose [id] { scroll-margin-top: 76px; }
