/* VSA Pro - giao diện chung (mặc định tối, đổi sáng / tối bằng data-theme) */
:root {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f3f5f9; --line: #e0e3eb; --text: #131722; --muted: #5d606b; --faint: #9598a1;
  --hover: #eef1f7; --active: #e3effd; --accent: #2962ff; --accent-text: #ffffff; --grid: #f0f3fa;
  --th-bg: #d9d9d9; --th-text: #131722; --good: #00b050; --bad: #ff0000; --up: #089981; --down: #f23645;
  --tip-bg: #ffffff; --shadow: 0 8px 28px rgba(19, 23, 34, .18); --r: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 0px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131722; --panel: #131722; --panel-2: #1e222d; --line: #2a2e39; --text: #d1d4dc; --muted: #9598a1; --faint: #5d606b;
    --hover: #2a2e39; --active: #142e61; --grid: #1c202b; --th-bg: #363a45; --th-text: #e8eaf0; --tip-bg: #1e222d; --shadow: 0 8px 28px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --bg: #131722; --panel: #131722; --panel-2: #1e222d; --line: #2a2e39; --text: #d1d4dc; --muted: #9598a1; --faint: #5d606b;
  --hover: #2a2e39; --active: #142e61; --grid: #1c202b; --th-bg: #363a45; --th-text: #e8eaf0; --tip-bg: #1e222d; --shadow: 0 8px 28px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.good { color: var(--good) !important; font-weight: 700; }
.bad { color: var(--bad) !important; font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ đầu trang */
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; }
.logo { width: 24px; height: 24px; border-radius: 6px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 22l6-7 5 4 7-9' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%; flex: none; }
.tabs { display: flex; gap: 2px; margin-left: 6px; }
.tabs a { color: var(--muted); padding: 6px 10px; border-radius: var(--r); font-weight: 600; white-space: nowrap; }
.tabs a:hover { background: var(--hover); color: var(--text); }
.tabs a.active { color: var(--accent); background: var(--active); }
.gsearch { position: relative; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r); background: var(--panel-2); border: 1px solid transparent; width: 220px; min-width: 0; }
.gsearch:focus-within { border-color: var(--accent); }
.gsearch > svg { color: var(--muted); width: 16px; height: 16px; }
.gsearch input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; font-weight: 600; }
.gsearch input::placeholder { font-weight: 400; color: var(--faint); }
.spacer { flex: 1; }
.data-info { color: var(--muted); font-size: 12px; white-space: nowrap; }
.data-info b { color: var(--text); }
.data-info .short { display: none; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.on i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.status.on { color: #22c55e; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: var(--r); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent); }
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }

/* gợi ý tìm mã */
.sugg { position: absolute; top: calc(100% + 4px); left: 0; min-width: 300px; max-width: 92vw; max-height: 60vh; overflow: auto; background: var(--tip-bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); z-index: 50; padding: 4px; }
.sg { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 4px; cursor: pointer; }
.sg:hover, .sg.on { background: var(--hover); }
.sg .nm { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg .ex { font-size: 11px; color: var(--faint); }

/* ------------------------------------------------------------------ khung màn hình */
#views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow: auto; padding: 14px 16px 24px; }
.view-chart { padding: 0; overflow: hidden; }
.boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.boot-err { max-width: 460px; text-align: center; padding: 16px; }
.boot-err p { color: var(--muted); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.page-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.page-h h2 { margin: 0; font-size: 18px; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* thẻ, lưới */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; font-weight: 400; font-size: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .lbl { color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv > span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

/* nút, ô nhập */
.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); height: 30px; padding: 0 12px; border-radius: var(--r); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.on { color: var(--accent); border-color: var(--accent); background: var(--active); }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; padding: 0 10px; height: 28px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--active); color: var(--accent); }
.seg button:disabled { opacity: .35; cursor: default; }
.inp, select.inp { height: 30px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r); padding: 0 8px; min-width: 0; }
.inp:focus { outline: 0; border-color: var(--accent); }
.inp.sm { height: 26px; width: 80px; }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; cursor: default; }
.pill.click { cursor: pointer; }
.pill.click:hover, .pill.on { border-color: var(--accent); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.sig-chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.zbar { display: inline-block; position: relative; width: 52px; height: 6px; border-radius: 3px; vertical-align: middle; margin-left: 6px; background: linear-gradient(90deg, #00b050, #f6c344 50%, #ff0000); opacity: .85; }
.zbar i { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1.5px; background: var(--text); border-radius: 1px; }

/* ------------------------------------------------------------------ bảng */
.tbl-wrap { overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 6px; max-width: 100%; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.tbl th { background: var(--th-bg); color: var(--th-text); font-weight: 700; text-align: left; padding: 7px 8px; white-space: nowrap; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); }
.tbl th.num { text-align: right; }
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort:hover { text-decoration: underline; }
.tbl th .arr { font-size: 10px; margin-left: 3px; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--hover); }
.tbl td.sym { font-weight: 700; }
.tbl td .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.tbl .stick { position: sticky; left: 0; background: var(--bg); z-index: 1; }
.tbl th.stick { z-index: 3; background: var(--th-bg); }
.card .tbl .stick { background: var(--panel-2); }
.card .tbl th.stick { background: var(--th-bg); }
.tbl.compact td, .tbl.compact th { padding: 5px 7px; }
.more-row { text-align: center; padding: 10px; }

/* ------------------------------------------------------------------ Thị trường */
.mk-top { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; margin-bottom: 12px; }
.idx-card .px { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.idx-card .chg { font-weight: 700; margin-left: 6px; }
.idx-card .kv { margin-top: 8px; }
.mini-chart { height: 210px; cursor: pointer; }
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.adv-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 8px 0 12px; background: var(--line); }
.adv-bar .u { background: var(--good); } .adv-bar .d { background: var(--bad); }
.meter { display: grid; grid-template-columns: 74px 1fr 52px; gap: 8px; align-items: center; margin: 6px 0; font-size: 12.5px; }
.meter .bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--accent); }
.breadth-chart { height: 230px; }
.sum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sum-grid .kpi { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.sum-grid .kpi.click { cursor: pointer; }
.sum-grid .kpi.click:hover { border-color: var(--accent); }
.legend-row { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend-row i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.heat { color: #fff !important; font-weight: 700; text-align: right; }
.movers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ------------------------------------------------------------------ Biểu đồ */
.chart-wrap { display: flex; flex-direction: column; height: 100%; }
.ctool { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: none; }
.ctool::-webkit-scrollbar { display: none; }
.ctool .sym-btn { font-weight: 700; font-size: 14px; border: 0; background: transparent; cursor: pointer; padding: 0 6px; height: 30px; border-radius: var(--r); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ctool .sym-btn:hover { background: var(--hover); }
.ctool .sym-btn .nm { font-weight: 400; color: var(--muted); font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ctool .sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.dd { position: relative; flex: none; }
.dd-menu { position: fixed; min-width: 230px; background: var(--tip-bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.dd-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.dd-menu label:hover { background: var(--hover); }
.dd-menu .grp { font-size: 11px; color: var(--faint); padding: 6px 8px 2px; font-weight: 700; }
.dd-menu .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.cbody { flex: 1; min-height: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) 340px; }
.cbody.no-detail { grid-template-columns: 42px minmax(0, 1fr) 0; }
.cbody.no-detail .detail { display: none; }
.drawbar { border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.drawbar .icon-btn.on { background: var(--active); }
.drawbar .icon-btn:disabled { opacity: .3; cursor: default; }
.panes { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.pane { position: relative; min-height: 0; }
.pane.main { flex: 1; }
.pane.sub { height: 17%; min-height: 70px; border-top: 1px solid var(--line); }
.pane .lc { position: absolute; inset: 0; }
.legend { position: absolute; left: 8px; top: 6px; z-index: 5; pointer-events: none; font-size: 12px; line-height: 1.55; max-width: calc(100% - 90px); }
.legend .l1 { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.legend .ttl { font-weight: 700; font-size: 14px; }
.legend .k { color: var(--muted); margin-right: 2px; }
.legend .note { color: var(--faint); font-size: 11.5px; }
.sub-legend { position: absolute; left: 8px; top: 3px; z-index: 5; pointer-events: none; font-size: 11.5px; color: var(--muted); }
.sub-legend b { color: var(--text); font-weight: 600; }
.dash { position: absolute; right: 78px; top: 8px; z-index: 6; background: color-mix(in srgb, var(--tip-bg) 92%, transparent); border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; min-width: 210px; max-width: 290px; box-shadow: var(--shadow); }
.dash .dh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; font-weight: 700; cursor: pointer; background: var(--th-bg); color: var(--th-text); border-radius: 6px 6px 0 0; }
.dash.min .dh { border-radius: 6px; }
.dash table { border-collapse: collapse; width: 100%; }
.dash td { padding: 3px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.dash td:first-child { color: var(--muted); white-space: nowrap; }
.dash td:last-child { text-align: right; }
.hover-tip { position: absolute; z-index: 8; pointer-events: none; background: var(--tip-bg); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 6px 9px; font-size: 12px; max-width: 280px; }
.ch-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); z-index: 7; background: var(--bg); }
.draw-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 8; background: var(--accent); color: #fff; padding: 4px 12px; border-radius: 99px; font-size: 12px; pointer-events: none; }
.detail { border-left: 1px solid var(--line); overflow: auto; padding: 12px; background: var(--panel); min-width: 0; }
.detail .dt-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail .dt-h h3 { margin: 0; flex: 1; }
.sig-card { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; overflow: hidden; }
.sig-card .sh { padding: 8px 10px; border-left: 4px solid; background: var(--panel-2); }
.sig-card .sh .t { font-weight: 700; }
.sig-card .sh .c { color: var(--muted); font-size: 12px; }
.sig-card .sec { padding: 6px 10px; }
.sig-card .sec h4 { margin: 4px 0; font-size: 12.5px; color: var(--accent); }
.sig-card .sec p { margin: 0 0 4px; }
.sig-card .sec ul { margin: 0; padding-left: 16px; }
.sig-card .sec li { margin: 2px 0; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: grid; grid-template-columns: 76px 44px 1fr; gap: 6px; padding: 5px 6px; border-radius: 4px; cursor: pointer; align-items: center; font-size: 12px; }
.recent li:hover { background: var(--hover); }
.recent li.cur { background: var(--active); }
.recent .ab { font-weight: 700; }
.recent .nm { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-close { display: none; }

/* ------------------------------------------------------------------ Bộ lọc */
.scr { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; align-items: start; }
.flt { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; position: sticky; top: 0; max-height: calc(100vh - 110px); overflow: auto; }
.flt .row { display: grid; grid-template-columns: 1fr; gap: 4px; margin-bottom: 9px; }
.flt .row > label { color: var(--muted); font-size: 12px; font-weight: 600; }
.flt .rng { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.flt .rng .inp, .flt .row .inp { width: 100%; }
.flt .exs { display: flex; gap: 10px; flex-wrap: wrap; }
.flt h4 { margin: 12px 0 6px; font-size: 12px; text-transform: none; color: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.scr-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.scr .tbl-wrap { max-height: calc(100vh - 190px); }
.colpick { columns: 2; column-gap: 12px; }
.colpick label { break-inside: avoid; }

/* ------------------------------------------------------------------ Doanh nghiệp */
.fa-head { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; margin-bottom: 12px; }
.fa-head .ttl h2 { margin: 0; font-size: 20px; }
.fa-head .ttl .muted { font-size: 12.5px; }
.fa-head .kpi .val { font-size: 16px; }
.svgc { width: 100%; height: 240px; position: relative; }
.svgc svg { width: 100%; height: 100%; stroke: none; display: block; }
.svgc .tip { position: absolute; pointer-events: none; background: var(--tip-bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 3; }
.val-chart { height: 230px; }
.fa-tbl td:first-child, .fa-tbl th:first-child { min-width: 190px; }

/* ------------------------------------------------------------------ Tín hiệu */
.sig-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sig-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ------------------------------------------------------------------ Danh mục */
.wl-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.wl-add { position: relative; }
.wl-add .inp { width: 200px; }
tr.al-up td { background: rgba(0, 176, 80, .14) !important; }
tr.al-dn td { background: rgba(255, 0, 0, .13) !important; }
.wl-act { display: inline-flex; gap: 2px; }
.wl-act .icon-btn { width: 26px; height: 26px; }
.wl-act svg { width: 15px; height: 15px; }
.live { color: #22c55e; font-size: 11px; margin-left: 4px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; max-width: 90vw; font-size: 13px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.bottomnav { display: none; }

/* ------------------------------------------------------------------ màn hình hẹp */
@media (max-width: 1280px) {
  .tabs a { padding: 6px 7px; }
  .data-info .full { display: none; }
  .data-info .short { display: inline; }
}
@media (max-width: 1100px) {
  .mk-top { grid-template-columns: 1fr 1fr; }
  .mk-top .mini { grid-column: 1 / -1; }
  .movers { grid-template-columns: 1fr 1fr; }
  /* phần tử ẩn (display: none) không chiếm ô lưới nên chỉ khai báo số cột thật sự hiện */
  .cbody, .cbody.no-detail { grid-template-columns: 42px minmax(0, 1fr); }
  .cbody .detail { display: none; }
  .cbody.show-detail .detail { display: block; position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); z-index: 30; box-shadow: var(--shadow); }
  .cbody { position: relative; }
  .sheet-close { display: inline-flex; }
}
@media (max-width: 900px) {
  .scr { grid-template-columns: 1fr; }
  .flt { position: static; max-height: none; }
  .flt.collapsed .flt-body { display: none; }
  .mk-grid { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
}
@media (min-width: 901px) { .flt-toggle { display: none !important; } .flt.collapsed .flt-body { display: block; } }
@media (max-width: 768px) {
  :root { --nav-h: 58px; }
  body { font-size: 13.5px; }
  .tabs, .brand-name { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .gsearch { width: auto; flex: 1; }
  .gsearch .sugg { left: -40px; }
  .spacer { display: none; }
  .status span { display: none; }
  .status { padding: 6px; }
  #views { margin-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .view { padding: 10px 10px 20px; }
  .view-chart { padding: 0; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); z-index: 40; }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; }
  .bottomnav a svg { width: 21px; height: 21px; }
  .bottomnav a.active { color: var(--accent); }
  .mk-top { grid-template-columns: 1fr; }
  .movers { grid-template-columns: 1fr; }
  .sum-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cbody, .cbody.no-detail { grid-template-columns: minmax(0, 1fr); }
  .drawbar { display: none; }
  .mobile-draw { display: inline-flex !important; }
  .cbody.show-detail .detail { position: fixed; left: 0; right: 0; top: auto; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); width: auto; max-height: 62vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; }
  .dash { right: 6px; top: auto; bottom: 26px; min-width: 0; max-width: 62%; font-size: 11px; }
  .legend { max-width: calc(100% - 64px); font-size: 11px; }
  .legend .ttl { font-size: 13px; }
  .pane.sub { height: 15%; min-height: 60px; }
  .ctool .sym-btn .nm { display: none; }
  .hide-m { display: none !important; }
  .scr .tbl-wrap { max-height: none; }
  .fa-head { gap: 10px 16px; }
  .svgc { height: 210px; }
  .wl-add .inp { width: 150px; }
  #toast { bottom: calc(var(--nav-h) + 16px); }
}
.mobile-draw { display: none !important; }
