/* Investra-M dashboard. No external fonts or images; system fonts only.
   Theme: dark by default when the device prefers it; [data-theme] on <html> overrides. */

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #141a22;
  --surface-2: #1a222c;
  --surface-3: #212b37;
  --border: #283240;
  --border-strong: #364252;
  --text: #e7ebf0;
  --text-soft: #c3cad4;
  --muted: #98a3b1;
  --accent: #79a8ff;
  --accent-strong: #4f86f0;
  --accent-ink: #0b1220;
  --ok: #45c08f;
  --ok-soft: rgba(69, 192, 143, 0.14);
  --warn: #e7b04f;
  --warn-soft: rgba(231, 176, 79, 0.14);
  --danger: #f06a6a;
  --danger-strong: #d93f3f;
  --danger-soft: rgba(240, 106, 106, 0.14);
  --info-soft: rgba(121, 168, 255, 0.12);
  --scan: #9fb4d6;
  --shadow: #e7b04f;
  --live: #ff5c5c;
  --live-bg: #b3261e;
  --bybit: #7cc4f5;
  --bybit-soft: rgba(124, 196, 245, 0.14);
  --est: #c9b6f2;
  --est-soft: rgba(201, 182, 242, 0.14);
  --sim: #e7b04f;
  --sim-soft: rgba(231, 176, 79, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --elev: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gap: 14px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --surface-3: #e8ebf0;
    --border: #dfe3e9;
    --border-strong: #c9d0da;
    --text: #141a21;
    --text-soft: #2d3642;
    --muted: #5a6574;
    --accent: #2b64d6;
    --accent-strong: #1f53bb;
    --accent-ink: #ffffff;
    --ok: #18794e;
    --ok-soft: rgba(24, 121, 78, 0.1);
    --warn: #9a5b00;
    --warn-soft: rgba(196, 122, 0, 0.12);
    --danger: #c42b2b;
    --danger-strong: #b01f1f;
    --danger-soft: rgba(196, 43, 43, 0.09);
    --info-soft: rgba(43, 100, 214, 0.08);
    --scan: #3d5a86;
    --shadow: #9a5b00;
    --live: #c42b2b;
    --live-bg: #c42b2b;
    --bybit: #0b6aa8;
    --bybit-soft: rgba(11, 106, 168, 0.1);
    --est: #6b45b8;
    --est-soft: rgba(107, 69, 184, 0.1);
    --sim: #9a5b00;
    --sim-soft: rgba(196, 122, 0, 0.12);
    --elev: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.05);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e8ebf0;
  --border: #dfe3e9;
  --border-strong: #c9d0da;
  --text: #141a21;
  --text-soft: #2d3642;
  --muted: #5a6574;
  --accent: #2b64d6;
  --accent-strong: #1f53bb;
  --accent-ink: #ffffff;
  --ok: #18794e;
  --ok-soft: rgba(24, 121, 78, 0.1);
  --warn: #9a5b00;
  --warn-soft: rgba(196, 122, 0, 0.12);
  --danger: #c42b2b;
  --danger-strong: #b01f1f;
  --danger-soft: rgba(196, 43, 43, 0.09);
  --info-soft: rgba(43, 100, 214, 0.08);
  --scan: #3d5a86;
  --shadow: #9a5b00;
  --live: #c42b2b;
  --live-bg: #c42b2b;
  --bybit: #0b6aa8;
  --bybit-soft: rgba(11, 106, 168, 0.1);
  --est: #6b45b8;
  --est-soft: rgba(107, 69, 184, 0.1);
  --sim: #9a5b00;
  --sim-soft: rgba(196, 122, 0, 0.12);
  --elev: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.05);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-danger { color: var(--danger); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid transparent;
  padding-top: env(safe-area-inset-top);
}
body[data-mode="LIVE"] .topbar { border-top-color: var(--live); }
body[data-mode="SHADOW_LIVE"] .topbar { border-top-color: var(--shadow); }
body[data-mode="SCAN_ONLY"] .topbar { border-top-color: var(--scan); }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 14px;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "mode mode";
  gap: 10px; align-items: center;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong)); color: #fff;
  font-weight: 800; font-size: 15px;
}
.brand-name { font-weight: 650; font-size: 16px; }
.topbar-actions { grid-area: actions; display: flex; align-items: center; gap: 8px; }

.mode-badge {
  grid-area: mode;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
}
.mode-badge-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.mode-badge-value { font-size: 22px; font-weight: 800; letter-spacing: 0.04em; }
body[data-mode="SCAN_ONLY"] .mode-badge-value { color: var(--scan); }
body[data-mode="SHADOW_LIVE"] .mode-badge { border-color: var(--shadow); background: var(--sim-soft); }
body[data-mode="SHADOW_LIVE"] .mode-badge-value { color: var(--shadow); }
body[data-mode="LIVE"] .mode-badge { background: var(--live-bg); border-color: var(--live-bg); }
body[data-mode="LIVE"] .mode-badge-value,
body[data-mode="LIVE"] .mode-badge-label { color: #fff; }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn[data-state="ok"] .conn-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn[data-state="slow"] .conn-dot { background: var(--warn); }
.conn[data-state="down"] .conn-dot { background: var(--danger); }
.conn[data-state="down"] { color: var(--danger); }

.section-nav {
  max-width: 1200px; margin: 0 auto; padding: 0 10px 8px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: none; color: var(--text-soft); text-decoration: none; font-size: 13px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
}
.section-nav a:hover { border-color: var(--border-strong); color: var(--text); }

@media (min-width: 760px) {
  .topbar-inner { grid-template-columns: auto 1fr auto; grid-template-areas: "brand mode actions"; }
  .mode-badge { justify-self: center; min-width: 300px; }
}

/* ---------- buttons ---------- */
.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: 14px;
  min-height: 44px; padding: 9px 15px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-danger { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger); }
.btn-outline { background: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); }
.btn-block { width: 100%; }
.icon-btn svg { width: 18px; height: 18px; display: block; margin: auto; fill: currentColor; }
.icon-btn {
  appearance: none; font: inherit; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 17px;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row-actions .btn { flex: 1 1 140px; }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 14px 12px 40px; }
.section { margin-top: 26px; }
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  font-weight: 650; margin: 0 4px 10px;
}
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .card-mode { grid-row: span 2; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--elev); min-width: 0;
}
.card + .card { margin-top: var(--gap); }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; }
.card-danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.count { color: var(--muted); font-weight: 500; }

/* ---------- chips and tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-soft);
}
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px;
  background: var(--surface-3); color: var(--muted);
}
.tag:empty { display: none; }
.tag-bybit { background: var(--bybit-soft); color: var(--bybit); }
.tag-est { background: var(--est-soft); color: var(--est); }
.tag-sim { background: var(--sim-soft); color: var(--sim); }
.tag-real { background: var(--ok-soft); color: var(--ok); }

/* ---------- banners ---------- */
.banners { display: grid; gap: 10px; }
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--border);
  border-left-width: 5px; background: var(--surface);
}
.banner-body { flex: 1 1 260px; min-width: 0; }
.banner-title { font-size: 15px; margin-bottom: 4px; }
.banner-text { color: var(--text-soft); overflow-wrap: anywhere; }
.banner-meta { color: var(--muted); font-size: 13px; }
.banner-strong { color: var(--danger); font-weight: 600; }
.banner-danger { border-color: var(--danger); background: var(--danger-soft); }
.banner-danger .banner-title { color: var(--danger); }
.banner-warn { border-color: var(--warn); background: var(--warn-soft); }
.banner-warn .banner-title { color: var(--warn); }
.banner-info { border-color: var(--accent); background: var(--info-soft); }
.banner .btn { flex: none; }

/* ---------- mode card ---------- */
.mode-now { font-size: 26px; font-weight: 800; letter-spacing: 0.03em; margin-bottom: 2px; }
body[data-mode="SCAN_ONLY"] .mode-now { color: var(--scan); }
body[data-mode="SHADOW_LIVE"] .mode-now { color: var(--shadow); }
body[data-mode="LIVE"] .mode-now { color: var(--live); }
.mode-now-text { margin-bottom: 14px; }
.mode-switch { display: grid; gap: 8px; }
.mode-btn {
  appearance: none; font: inherit; text-align: left; cursor: pointer; color: var(--text);
  display: grid; gap: 2px; padding: 12px 14px; min-height: 56px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
}
.mode-btn:hover:not(:disabled) { border-color: var(--accent); }
.mode-btn:disabled { opacity: 0.6; cursor: progress; }
.mode-btn-name { font-weight: 750; letter-spacing: 0.04em; }
.mode-btn-desc { font-size: 13px; color: var(--muted); }
.mode-btn[aria-pressed="true"] { border-width: 2px; padding: 11px 13px; }
.mode-btn[data-mode="SCAN_ONLY"][aria-pressed="true"] { border-color: var(--scan); }
.mode-btn[data-mode="SHADOW_LIVE"][aria-pressed="true"] { border-color: var(--shadow); background: var(--sim-soft); }
.mode-btn-live .mode-btn-name { color: var(--live); }
.mode-btn-live[aria-pressed="true"] { border-color: var(--live); background: var(--danger-soft); }
.mode-btn[aria-pressed="true"] .mode-btn-name::after { content: "  · current"; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ---------- figures ---------- */
.figures { margin: 0; display: grid; gap: 0; }
.figures > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.figures > div:last-child { border-bottom: 0; }
.figures dt { color: var(--muted); font-size: 14px; }
.figures dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.figures-tight > div { padding: 5px 0; }
.big-num { font-size: 26px; font-weight: 750; letter-spacing: -0.01em; margin: 2px 0; }
.big-num-quiet { color: var(--text-soft); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.card { container-type: inline-size; }
.split { display: grid; gap: 16px; grid-template-columns: 1fr; }
@container (min-width: 440px) { .split { grid-template-columns: 1fr 1fr; } }
.figures-tight dd { white-space: nowrap; }
.split-col { min-width: 0; }
.split-head { margin-bottom: 4px; }
.shadow-block {
  border: 1px dashed var(--sim); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
  background: var(--sim-soft);
}
.shadow-line { font-weight: 600; }
.key-line { font-size: 18px; font-weight: 700; }
.key-line[data-state="ok"] { color: var(--ok); }
.key-line[data-state="bad"] { color: var(--danger); }
.key-line[data-state="unknown"] { color: var(--warn); }

meter { width: 100%; height: 12px; margin: 8px 0 6px; }

/* ---------- positions ---------- */
.positions { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 900px) { .positions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.empty {
  padding: 22px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.pos-card .card-head { margin-bottom: 8px; }
.pos-symbol { font-size: 17px; font-weight: 700; }
.pos-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.legs { display: grid; gap: 6px; margin: 6px 0 10px; }
.leg {
  display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.leg-side { font-weight: 700; }
.leg-side-BUY { color: var(--ok); }
.leg-side-SELL { color: var(--danger); }
.leg-detail { color: var(--text-soft); text-align: right; overflow-wrap: anywhere; }
.details { padding: 0; }
.details > summary {
  cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary::before { content: "▸"; display: inline-block; width: 1.2em; color: var(--muted); transition: transform 0.15s; }
.details[open] > summary::before { transform: rotate(90deg); }
.details > :not(summary) { margin: 0 16px 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 10px; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.th-note { text-transform: none; font-weight: 500; }
.table-radar td:first-child { font-weight: 700; }
.table-radar .why { color: var(--text-soft); min-width: 220px; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--muted); }
.fallback { color: var(--warn); }

/* Phone: the radar becomes stacked cards, no sideways scrolling needed */
@media (max-width: 640px) {
  .table-radar thead { display: none; }
  .table-radar, .table-radar tbody, .table-radar tr, .table-radar td { display: block; width: 100%; }
  .table-radar tr {
    padding: 10px 2px; border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px;
  }
  .table-radar td { border: 0; padding: 2px 0; text-align: left; }
  .table-radar td.num { text-align: left; }
  .table-radar td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .table-radar td:first-child { grid-column: 1 / -1; font-size: 16px; }
  .table-radar td:first-child::before { display: none; }
  .table-radar td.why { grid-column: 1 / -1; min-width: 0; }
}

/* ---------- events ---------- */
.events-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 10px; }
.events {
  list-style: none; margin: 0 0 8px; padding: 0; max-height: 460px; overflow-y: auto;
  font: 13px/1.5 var(--mono); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.events li { padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.events li:last-child { border-bottom: 0; }
.events li.problem { color: var(--danger); background: var(--danger-soft); }
.events li.note { color: var(--warn); }
.events li.empty-line { color: var(--muted); }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; margin: 0 0 12px; }
.field-inline { margin: 0; flex: 1 1 200px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select {
  font: inherit; font-size: 16px; color: var(--text); width: 100%; min-height: 44px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2);
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { color: var(--danger); font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 70vh; display: grid; place-items: center; padding: 24px 14px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-health { font-size: 14px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); margin: 12px 0 16px; }

/* ---------- dialogs ---------- */
.dialog {
  border: 1px solid var(--border-strong); border-radius: 16px; padding: 0; color: var(--text);
  background: var(--surface); width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.dialog::backdrop { background: rgba(5, 8, 12, 0.62); }
.dialog-form { padding: 20px; display: grid; gap: 12px; }
.dialog-title { font-size: 19px; }
.dialog-body { color: var(--text-soft); display: grid; gap: 8px; }
.dialog-body ul, .checklist { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dialog-actions .spacer { flex: 1 1 0; }
.dialog-live { border-color: var(--live); border-width: 2px; }
.dialog-live .dialog-title { color: var(--live); }
.live-warning {
  border-radius: var(--radius-sm); padding: 12px 14px; background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); display: grid; gap: 6px;
}
.checklist li[data-state="ok"] { color: var(--ok); }
.checklist li[data-state="bad"] { color: var(--danger); font-weight: 600; }
.checklist li[data-state="warn"] { color: var(--warn); }
.answer {
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; border: 1px solid var(--border);
  background: var(--surface-2); overflow-wrap: anywhere; display: grid; gap: 4px;
}
.answer[data-state="ok"] { border-color: var(--ok); background: var(--ok-soft); }
.answer[data-state="bad"] { border-color: var(--danger); background: var(--danger-soft); }
.answer[data-state="wait"] { border-color: var(--accent); background: var(--info-soft); }
.answer-title { font-weight: 700; }
@media (max-width: 520px) {
  .dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .dialog-actions .btn { flex: 1 1 auto; }
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 560px; width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); font-size: 14px; overflow-wrap: anywhere;
}
.toast-ok { border-color: var(--ok); }
.toast-bad { border-color: var(--danger); }
@media (min-width: 760px) { .toasts { left: auto; right: 20px; bottom: 20px; width: 420px; } }

.footer { max-width: 1200px; margin: 30px auto 0; padding: 0 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
