/* ==========================================================================
   QTML Grid Agent OS — Hybrid A + B/C Studio Design System
   Binance Pro Obsidian Dark  ×  Brushed-Titanium .ai Metal Card  ×  Daylight Pearl Light
   Zero Emojis · Hairline Dividers · Tabular Numerals · Mobile-First Native Flow
   ========================================================================== */

:root, [data-theme="dark"] {
  --bg: #0B0E11;
  --bg2: #12161C;
  --panel: #161A1F;
  --panel2: #1E2329;
  --line: rgba(255, 255, 255, 0.075);
  --line2: rgba(255, 255, 255, 0.13);
  --txt: #EAECEF;
  --txt-strong: #FFFFFF;
  --dim: #848E9C;
  --dim2: #5E6673;
  --up: #0ECB81;
  --up-dim: rgba(14, 203, 129, 0.12);
  --dn: #F6465D;
  --dn-dim: rgba(246, 70, 93, 0.12);
  --bnb: #F0B90B;
  --bnb-hover: #F8C92B;
  --bnb-dim: rgba(240, 185, 11, 0.12);
  --accent: #F0B90B;
  --accent-dim: rgba(240, 185, 11, 0.14);
  --cyan: #22D3EE;
  --cyan-dim: rgba(34, 211, 238, 0.11);
  --warn: #F0B90B;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --top-bg: rgba(11, 14, 17, 0.90);
  --code-bg: #080A0D;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #F6F7F9;
  --bg2: #EFF2F6;
  --panel: #FFFFFF;
  --panel2: #F3F5F8;
  --line: rgba(15, 23, 42, 0.08);
  --line2: rgba(15, 23, 42, 0.15);
  --txt: #1E293B;
  --txt-strong: #0F172A;
  --dim: #475569;
  --dim2: #64748B;
  --up: #059669;
  --up-dim: rgba(5, 150, 105, 0.10);
  --dn: #DC2626;
  --dn-dim: rgba(220, 38, 38, 0.10);
  --bnb: #D99B00;
  --bnb-hover: #C28900;
  --bnb-dim: rgba(217, 155, 0, 0.11);
  --accent: #0F172A;
  --accent-dim: rgba(15, 23, 42, 0.08);
  --cyan: #0891B2;
  --cyan-dim: rgba(8, 145, 178, 0.10);
  --warn: #D97706;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 10px 26px rgba(15, 23, 42, 0.04);
  --top-bg: rgba(255, 255, 255, 0.92);
  --code-bg: #0F172A;
}

/* ---------- Global Reset & Typography Overrides ---------- */
html, body {
  background: var(--bg) !important;
  color: var(--txt) !important;
  font-family: var(--sans) !important;
  overflow-x: clip;
  transition: background .2s ease, color .2s ease;
}
body {
  background-image: none !important;
}
[data-theme="dark"] body {
  background-image: radial-gradient(900px 420px at 82% -12%, rgba(240, 185, 11, 0.055), transparent 60%),
                    radial-gradient(700px 380px at 8% 95%, rgba(14, 203, 129, 0.04), transparent 60%) !important;
}

.v, .s, td, th, .qtml-mono, .ahub-kpi b, .ahub-prog-top b, .qtml-hero-val {
  font-variant-numeric: tabular-nums;
}

svg.q-ic {
  width: 15px; height: 15px; flex: 0 0 auto; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: inline-block;
}
svg.q-ic.sm { width: 13px; height: 13px; }
svg.q-ic.lg { width: 18px; height: 18px; }

/* ---------- Unified Single-Row Top Bar (Binance Pro Style) ---------- */
.top {
  height: 56px !important;
  padding: 0 18px !important;
  gap: 12px !important;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--line) !important;
  background: var(--top-bg) !important;
  backdrop-filter: blur(14px) !important;
}
.top .spacer { min-width: 6px; }
.brand, #viewTabs, #ahubTopCtrl { flex-shrink: 0; }
.brand, #viewTabs button, #statusPill { white-space: nowrap; }
.brand {
  gap: 9px !important; font-size: 14.5px !important; font-weight: 800 !important;
  letter-spacing: -0.01em !important; color: var(--txt-strong) !important;
}
.brand .mark {
  width: 28px !important; height: 28px !important; border-radius: 7px !important;
  background: var(--bnb-dim) !important; border: 1px solid rgba(240, 185, 11, 0.35) !important;
  color: var(--bnb) !important;
}
.brand small {
  font-size: 11px !important; font-weight: 600 !important; color: var(--dim2) !important;
  padding-left: 8px; border-left: 1px solid var(--line2); letter-spacing: .02em !important;
}

/* High-Visibility Primary Page Navigation Rail (Segmented Binance Pro Pill Bar) */
#viewTabs.tabs {
  display: inline-flex; align-items: center; gap: 4px; height: 38px;
  padding: 3px; border-radius: 11px;
  background: var(--bg2); border: 1px solid var(--line2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
#viewTabs.tabs a, #viewTabs.tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 14px !important; border-radius: 8px !important;
  border: 1px solid transparent !important; background: transparent !important;
  color: var(--txt) !important; font-size: 13px !important; font-weight: 700 !important;
  letter-spacing: -0.01em !important; text-decoration: none !important;
  white-space: nowrap; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
#viewTabs.tabs a svg, #viewTabs.tabs button svg {
  width: 14px; height: 14px; opacity: 0.78; transition: opacity .15s;
}
#viewTabs.tabs a:hover, #viewTabs.tabs button:hover {
  color: var(--txt-strong) !important;
  background: rgba(255, 255, 255, 0.07) !important;
}
[data-theme="light"] #viewTabs.tabs a:hover,
[data-theme="light"] #viewTabs.tabs button:hover {
  background: rgba(15, 23, 42, 0.06) !important;
}
#viewTabs.tabs a.on, #viewTabs.tabs button.on {
  background: #F0B90B !important;
  color: #0B0E11 !important;
  border-color: rgba(240, 185, 11, 0.65) !important;
  box-shadow: 0 2px 12px rgba(240, 185, 11, 0.30) !important;
}
#viewTabs.tabs a.on svg, #viewTabs.tabs button.on svg { opacity: 1; }
[data-theme="light"] #viewTabs.tabs a.on,
[data-theme="light"] #viewTabs.tabs button.on {
  background: #0F172A !important;
  color: #FFFFFF !important;
  border-color: #0F172A !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.20) !important;
}
[data-theme="light"] #viewTabs.tabs a.on svg,
[data-theme="light"] #viewTabs.tabs button.on svg { color: #F0B90B; }
#viewTabs.tabs a.on::after, #viewTabs.tabs button.on::after { display: none; }

#enginePill, #indexReport, #statusPill {
  border-color: var(--line) !important; background: transparent !important;
  color: var(--dim2) !important; font-size: 11px !important;
}
#enginePill { display: none !important; }

/* Right Top Bar Controls */
.ahub-lang-grp {
  display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--bg2); padding: 2px; gap: 2px;
}
.ahub-lang-btn {
  border: none; background: transparent; color: var(--dim); font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; cursor: pointer; transition: .15s; line-height: 1.1;
}
.ahub-lang-btn:hover { color: var(--txt-strong); }
.ahub-lang-btn.on { background: var(--panel); color: var(--txt-strong); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

.ahub-icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--dim); cursor: pointer; transition: .15s;
}
.ahub-icon-btn:hover { color: var(--txt-strong); border-color: var(--bnb); }

.ahub-nav-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--txt);
  font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: .14s;
}
.ahub-nav-btn:hover { color: var(--txt-strong); border-color: var(--line2); background: var(--panel2); }
.ahub-nav-btn.tour {
  color: var(--cyan); border-color: rgba(34, 211, 238, 0.35); background: var(--cyan-dim);
}
.ahub-nav-btn.tour:hover { border-color: var(--cyan); filter: brightness(1.08); }

.ahub-top-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px;
  border: none; background: #F0B90B; color: #0B0E11;
  font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .14s, transform .1s;
}
[data-theme="light"] .ahub-top-btn { background: #0F172A; color: #FFFFFF; }
.ahub-top-btn:hover { filter: brightness(1.08); }
.ahub-top-btn:active { transform: translateY(1px); }
.ahub-top-btn.connected {
  background: var(--up-dim) !important; color: var(--up) !important;
  border: 1px solid rgba(14, 203, 129, 0.35); font-family: var(--mono); font-size: 12px;
}
.ahub-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 9px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--txt-strong);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.ahub-badge.verified { border-color: rgba(14, 203, 129, 0.38); color: var(--up); background: var(--up-dim); }
.ahub-badge .vdot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.ahub-logout-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid rgba(246, 70, 93, 0.3); background: var(--dn-dim); color: var(--dn);
  cursor: pointer; transition: .14s;
}
.ahub-logout-btn:hover { background: var(--dn); color: #fff; }

/* ---------- Pro 70/30 Workspace Layout (#btView & #demoView) ---------- */
.layout {
  max-width: 1440px !important;
  padding: 20px 24px 48px !important;
  gap: 18px !important;
  grid-template-columns: minmax(0, 1fr) 336px !important;
}
.layout > main { grid-column: 1; grid-row: 1; min-width: 0; }
.layout > aside.side { grid-column: 2; grid-row: 1; }
.side-inner { top: 74px !important; gap: 14px !important; }

/* Hairline Surfaces — Zero Heavy Box Soup */
.card {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow);
}
.card-h {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--line) !important;
  background: transparent !important;
}
.card-h h3 {
  font-size: 11.5px !important; letter-spacing: .06em !important;
  color: var(--dim) !important; font-weight: 700 !important;
}
.card-b { padding: 14px 16px !important; }

/* Clean Horizontal Hairline KPI Strip (Matches Option A Mockup!) */
.metrics {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin-bottom: 16px !important;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.m {
  background: transparent !important; border: none !important; border-radius: 0 !important;
  padding: 14px 18px !important;
  border-right: 1px solid var(--line) !important;
  border-bottom: 1px solid var(--line) !important;
}
.m:nth-child(4n) { border-right: none !important; }
.m:nth-last-child(-n+4) { border-bottom: none !important; }
.m .k {
  font-size: 11px !important; letter-spacing: .02em !important;
  text-transform: none !important; color: var(--dim) !important; font-weight: 500;
}
.m .v {
  font-family: var(--mono) !important; font-size: 22px !important;
  font-weight: 700 !important; letter-spacing: -.02em !important; margin-top: 3px;
}
.m .s { font-size: 10.5px !important; color: var(--dim2) !important; margin-top: 3px !important; }
.pos { color: var(--up) !important; }
.neg { color: var(--dn) !important; }
.neutral { color: var(--txt-strong) !important; }

/* Clean Inputs, Segmented Controls & Binance Gold Primary CTA */
label.lb { font-size: 11.5px !important; color: var(--dim) !important; font-weight: 500; }
input[type=text], input[type=number], input[type=date], select, .combo-btn {
  background: var(--bg2) !important; border: 1px solid var(--line2) !important;
  color: var(--txt-strong) !important; border-radius: 9px !important;
  padding: 8px 11px !important; font-family: var(--mono) !important; font-size: 12.5px !important;
  transition: border-color .15s, box-shadow .15s;
}
select { font-family: var(--sans) !important; }
input:focus, select:focus {
  border-color: var(--bnb) !important; box-shadow: 0 0 0 3px var(--bnb-dim) !important;
}
.quick {
  background: var(--bg2); padding: 3px; border-radius: 9px; border: 1px solid var(--line);
  gap: 3px !important; margin-top: 8px !important;
}
.quick button {
  background: transparent !important; border: none !important; border-radius: 7px !important;
  color: var(--dim) !important; padding: 6px 0 !important; font-size: 11.5px !important;
  font-weight: 600; transition: .14s;
}
.quick button:hover { color: var(--txt-strong) !important; background: var(--panel2) !important; }
.qtml-bt-lev button.on {
  background: var(--bnb-dim) !important; color: var(--bnb) !important;
  box-shadow: inset 0 0 0 1px rgba(240, 185, 11, 0.45);
}
.qtml-cap-summary {
  margin-top: 8px; padding: 7px 10px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--dim); line-height: 1.4;
}

/* ---------- Binance Margin Health Banner & Leverage Stress Test ---------- */
.qtml-margin-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 14px; border-radius: 12px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel);
}
.qtml-margin-banner.safe {
  border-color: rgba(14, 203, 129, 0.42); background: var(--up-dim); color: var(--up);
}
.qtml-margin-banner.warn {
  border-color: rgba(240, 185, 11, 0.48); background: var(--bnb-dim); color: var(--bnb);
}
.qtml-margin-banner.liq {
  border-color: rgba(246, 70, 93, 0.55); background: var(--dn-dim); color: var(--dn);
}
.qtml-margin-banner small { font-weight: 500; opacity: .9; }

.qtml-st-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; font-family: var(--mono);
}
.qtml-st-badge.ok { background: var(--up-dim); color: var(--up); }
.qtml-st-badge.sl { background: var(--bnb-dim); color: var(--bnb); }
.qtml-st-badge.liq { background: var(--dn-dim); color: var(--dn); }
tr.qtml-stress-row { cursor: pointer; transition: background .12s; }
tr.qtml-stress-row:hover { background: var(--panel2); }

.btn {
  border-radius: 10px !important; padding: 10px 14px !important; font-size: 13px !important;
  font-weight: 700 !important; border: 1px solid var(--line2) !important;
  background: var(--panel2) !important; color: var(--txt-strong) !important;
}
.btn.primary {
  background: #F0B90B !important; border-color: #F0B90B !important; color: #0B0E11 !important;
  box-shadow: 0 4px 16px rgba(240, 185, 11, 0.22);
}
[data-theme="light"] .btn.primary {
  background: #0F172A !important; border-color: #0F172A !important; color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent !important; color: var(--dim) !important; }
.btn.ghost:hover { color: var(--txt-strong) !important; border-color: var(--bnb) !important; }

/* iOS Switch Style for Checkboxes */
.chk input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 34px; height: 20px; flex: 0 0 34px;
  border-radius: 999px; background: var(--line2); position: relative; cursor: pointer;
  transition: background .18s; border: none; outline: none;
}
.chk input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.chk input[type="checkbox"]:checked { background: var(--up); }
.chk input[type="checkbox"]:checked::after { transform: translateX(14px); }

/* Chart Tabs & Tables */
#chartTabs.tabs {
  background: var(--bg2); padding: 3px; border-radius: 9px; border: 1px solid var(--line);
}
#chartTabs.tabs button {
  padding: 5px 11px !important; border-radius: 7px !important; font-size: 11.5px !important;
  font-weight: 600; color: var(--dim) !important; border: none !important;
}
#chartTabs.tabs button.on {
  background: var(--panel) !important; color: var(--txt-strong) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.chart-wrap { height: 355px !important; padding: 12px 10px 4px !important; }
th { background: var(--panel) !important; color: var(--dim2) !important; border-bottom: 1px solid var(--line) !important; }
td { border-bottom: 1px solid var(--line) !important; color: var(--dim) !important; }
td:first-child { color: var(--txt-strong) !important; font-weight: 600; }
.chart-tip { background: var(--panel) !important; border-color: var(--line2) !important; color: var(--txt-strong) !important; }

/* ---------- Studio Top Inline Bar inside Quant Studio (Verified .ai + Tier + BSC Badge) ---------- */
.qtml-studio-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.qtml-studio-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qtml-studio-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.qtml-mini-prog {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim);
  cursor: pointer; padding: 4px 10px; border-radius: 8px; background: var(--bg2);
  border: 1px solid var(--line); transition: border-color .14s;
}
.qtml-mini-prog:hover { border-color: var(--bnb); color: var(--txt-strong); }
.qtml-mini-prog b { font-family: var(--mono); color: var(--txt-strong); font-weight: 700; }
.qtml-mini-bar {
  width: 52px; height: 5px; border-radius: 99px; background: var(--line2); overflow: hidden;
}
.qtml-mini-bar > i {
  display: block; height: 100%; background: linear-gradient(90deg, #F0B90B, #0ECB81);
}

.ahub-tier-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  font-size: 11px; font-weight: 700; font-family: var(--mono); cursor: pointer;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--dim); transition: .15s;
}
.ahub-tier-pill.guest { border-color: rgba(240, 185, 11, 0.4); background: var(--bnb-dim); color: var(--bnb); }
.ahub-tier-pill.signed_in { border-color: rgba(14, 203, 129, 0.4); background: var(--up-dim); color: var(--up); }
.ahub-tier-pill.vip { border-color: #F0B90B; background: linear-gradient(90deg, rgba(240,185,11,.22), rgba(14,203,129,.16)); color: var(--bnb); }

.qtml-founding-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  font-size: 11px; font-weight: 700; font-family: var(--mono); cursor: pointer;
  border: 1px solid rgba(240, 185, 11, 0.48);
  background: linear-gradient(90deg, rgba(240, 185, 11, 0.16), rgba(34, 211, 238, 0.10));
  color: var(--bnb); transition: transform .12s, border-color .14s;
}
.qtml-founding-pill:hover { border-color: #F0B90B; transform: translateY(-1px); }

.ahub-founding-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(110deg, rgba(240, 185, 11, 0.13) 0%, rgba(14, 203, 129, 0.07) 55%, var(--panel) 100%);
  border: 1px solid rgba(240, 185, 11, 0.38);
  box-shadow: var(--shadow);
}
.ahub-founding-banner.active {
  background: linear-gradient(110deg, rgba(14, 203, 129, 0.14) 0%, rgba(240, 185, 11, 0.12) 60%, var(--panel) 100%);
  border-color: rgba(14, 203, 129, 0.48);
}
.ahub-founding-banner.full {
  background: var(--panel); border-color: var(--line2);
}
.ahub-fb-main { flex: 1 1 320px; min-width: 0; }
.ahub-fb-title {
  display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--txt-strong);
}
.ahub-fb-title svg { color: var(--bnb); }
.ahub-founding-banner.active .ahub-fb-title svg { color: var(--up); }
.ahub-fb-sub { font-size: 12px; color: var(--dim); margin-top: 3px; line-height: 1.45; }
.ahub-fb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ahub-fb-tag {
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg2);
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--txt-strong); white-space: nowrap;
}
.ahub-founding-tag {
  padding: 2px 6px; border-radius: 5px; font-size: 9.5px; font-weight: 700; margin-left: 6px;
  background: linear-gradient(90deg, rgba(240, 185, 11, 0.22), rgba(14, 203, 129, 0.18));
  border: 1px solid rgba(240, 185, 11, 0.42); color: var(--bnb);
}

/* ---------- Apply Strategy to My Account Modal (Zero-Custody 3-Mode Bridge) ---------- */
.qtml-apply-cta {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 7px;
  border-color: rgba(240, 185, 11, 0.48) !important;
  background: linear-gradient(90deg, rgba(240, 185, 11, 0.14), rgba(14, 203, 129, 0.08)) !important;
  color: var(--txt-strong) !important;
}
.qtml-apply-cta svg { color: var(--bnb); }
.qtml-apply-cta:hover { border-color: #F0B90B !important; filter: brightness(1.06); }

.qtml-apply { max-width: 760px; }
.qtml-apply-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.qtml-apply-pillbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--bg2);
}
.qtml-apply-safe {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px;
  background: var(--up-dim); border: 1px solid rgba(14, 203, 129, 0.35);
  color: var(--up); font-size: 11px; font-weight: 600;
}
.qtml-apply-opts {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--line); margin-bottom: 12px;
}
.qtml-seg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qtml-seg-lbl { font-size: 12px; font-weight: 600; color: var(--txt-strong); }
.qtml-apply-toggles { display: flex; flex-wrap: wrap; gap: 12px; }
.qtml-apply-toggles .chk { margin-bottom: 0; }
.qtml-apply-warn {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; margin-bottom: 12px;
  background: var(--bnb-dim); border: 1px solid rgba(240, 185, 11, 0.45);
  color: var(--bnb); font-size: 11.5px; font-weight: 600;
}
.qtml-apply-step { font-size: 12px; font-weight: 600; color: var(--txt-strong); margin: 10px 0 4px; }
.qtml-lev-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.qtml-lev-chips .ahub-chip.on {
  border-color: var(--bnb); background: var(--bnb-dim); color: var(--bnb);
}
.qtml-apply-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
@media(max-width: 680px) { .qtml-apply-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qtml-apply-kv {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.qtml-apply-kv span { display: block; font-size: 10.5px; color: var(--dim); }
.qtml-apply-kv b {
  display: block; font-family: var(--mono); font-size: 14.5px; color: var(--txt-strong); margin-top: 4px;
}
.qtml-apply-foot {
  flex: 0 0 auto;
  padding: 9px 18px; border-top: 1px solid var(--line); background: var(--up-dim);
  color: var(--up); font-size: 12px; font-weight: 600; font-family: var(--mono);
}
.qtml-man-tab { display: inline-flex; align-items: center; gap: 6px; }

.qtml-bsc-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--dim);
  font-family: var(--mono); font-size: 11px; text-decoration: none; transition: .14s;
}
.qtml-bsc-chip:hover { border-color: var(--bnb); color: var(--txt-strong); }
.qtml-bsc-dot { width: 7px; height: 7px; border-radius: 50%; background: #F0B90B; }

.qtml-lock-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; margin-left: 6px;
  border-radius: 6px; font-size: 9.5px; font-family: var(--mono); font-weight: 700;
  border: 1px solid rgba(240, 185, 11, 0.38); background: var(--bnb-dim); color: var(--bnb);
}
.qtml-vip-lock {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 7px;
  background: var(--bnb-dim); border: 1px dashed rgba(240, 185, 11, 0.5);
  color: var(--bnb); font-size: 11.5px; font-weight: 700; cursor: pointer;
}

/* ==========================================================================
   BRUSHED-TITANIUM METALLIC .AI QUANT CARD (Constant Luxury Metal in Dark & Light!)
   ========================================================================== */
.qtml-metal-card {
  position: relative; border-radius: 16px; padding: 18px 20px; overflow: hidden;
  color: #F4F5F7;
  background:
    radial-gradient(120% 100% at 72% 18%, rgba(245, 196, 81, 0.22), transparent 52%),
    radial-gradient(90% 100% at 15% 85%, rgba(34, 211, 238, 0.12), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.025) 0px, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 4px),
    linear-gradient(135deg, #272B33 0%, #14171D 48%, #221E17 100%);
  border: 1px solid rgba(240, 185, 11, 0.36);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.qtml-metal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 16px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase;
}
.qtml-metal-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(240, 185, 11, 0.14); border: 1px solid rgba(240, 185, 11, 0.38); color: #F5C451; font-weight: 700;
}
.qtml-metal-custody {
  display: inline-flex; align-items: center; gap: 5px; color: #0ECB81; font-weight: 700;
}
.qtml-metal-handle {
  font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  color: #FFFFFF; margin: 0 0 4px;
}
.qtml-metal-meta {
  font-size: 12px; color: #A6B0BF; font-family: var(--mono); margin-bottom: 16px;
}
.qtml-metal-foot {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.qtml-metal-stat span {
  display: block; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #848E9C;
}
.qtml-metal-stat b {
  display: block; font-family: var(--mono); font-size: 19px; font-weight: 700; color: #0ECB81; margin-top: 2px;
}
.qtml-metal-chip {
  width: 34px; height: 24px; border-radius: 5px;
  background: linear-gradient(135deg, #F5D47A, #B58518);
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
  opacity: 0.9;
}

/* Compact Sidebar Titanium Quick Card (in Quant Studio Right Rail) */
.qtml-side-metal { padding: 15px 16px; }
.qtml-side-metal .qtml-metal-handle { font-size: 19px; }
.qtml-side-metal .qtml-metal-meta { font-size: 11px; margin-bottom: 12px; }
.qtml-side-metal-acts { display: flex; gap: 8px; margin-top: 12px; }
.qtml-side-metal-acts .ahub-btn { flex: 1; padding: 8px 10px; font-size: 12px; }

/* ==========================================================================
   DEDICATED .AI HUB BENTO WORKSPACE (Tab 3 — Clean, Spacious, Zero Clutter!)
   ========================================================================== */
.ahub-wrap { max-width: 1440px; margin: 0 auto; padding: 20px 24px 56px; }
.ahub-bento-top {
  display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 16px; margin-bottom: 16px;
}
@media(max-width: 1100px) { .ahub-bento-top { grid-template-columns: 1fr; } }

.ahub-bento-cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between;
}
.ahub-bento-cell.pulse {
  background: radial-gradient(240px 140px at 15% 0%, var(--cyan-dim), transparent 70%), var(--panel);
}
.ahub-cell-k {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--dim); margin-bottom: 10px;
}
.ahub-pulse-wave { width: 100%; height: 42px; display: block; margin: 2px 0 8px; }
.ahub-big-val { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--txt-strong); letter-spacing: -.02em; }
.ahub-sub-meta { font-size: 11.5px; color: var(--dim); margin-top: 4px; font-family: var(--mono); }

.ahub-bar { height: 7px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; margin: 10px 0 6px; }
.ahub-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #F0B90B, #0ECB81); transition: width .35s ease; }

.ahub-kpi-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 10px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.ahub-kpi span { display: block; font-size: 10px; color: var(--dim2); text-transform: uppercase; letter-spacing: .04em; }
.ahub-kpi b { display: block; font-family: var(--mono); font-size: 14px; color: var(--txt-strong); margin-top: 2px; }

/* Hub Main Workspace Card */
.ahub-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
}
.ahub-subtabs {
  display: flex; align-items: center; gap: 4px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: transparent; overflow-x: auto;
}
.ahub-subtab {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 13px 14px; border: none; background: transparent; color: var(--dim);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: color .14s;
}
.ahub-subtab:hover { color: var(--txt-strong); }
.ahub-subtab.on { color: var(--txt-strong); }
.ahub-subtab.on::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2.5px;
  border-radius: 99px 99px 0 0; background: var(--bnb);
}

.ahub-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ahub-panel { display: none; }
.ahub-panel.on { display: block; }
.ahub-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: start; }
@media(max-width: 1050px) { .ahub-grid { grid-template-columns: 1fr; } }

.ahub-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.ahub-box h3 {
  margin: 0 0 6px; font-size: 13px; color: var(--txt-strong); font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.ahub-subnote { font-size: 12px; color: var(--dim); margin: 0 0 12px; line-height: 1.5; }

.ahub-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media(max-width: 720px) { .ahub-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ahub-f label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 4px; font-weight: 500; }

.ahub-btn-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.ahub-btn {
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel);
  color: var(--txt-strong); font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .13s;
}
.ahub-btn:hover { border-color: var(--bnb); }
.ahub-btn.bnb { background: #F0B90B; border-color: #F0B90B; color: #0B0E11; }
.ahub-btn.bnb:hover { background: #F8C92B; }
.ahub-btn.primary { background: var(--cyan); border-color: var(--cyan); color: #061318; }
.ahub-btn.ok { background: var(--up-dim); border-color: rgba(14, 203, 129, 0.4); color: var(--up); }
.ahub-btn.sm { padding: 6px 11px; font-size: 11.5px; border-radius: 8px; }

.ahub-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ahub-chip {
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel);
  color: var(--dim); font-family: var(--mono); font-size: 11px; font-weight: 600; cursor: pointer;
}
.ahub-chip:hover { border-color: var(--bnb); color: var(--txt-strong); }

.ahub-status {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.ahub-status.ok { border-color: rgba(14, 203, 129, 0.45); background: var(--up-dim); color: var(--up); }
.ahub-status.err { border-color: rgba(246, 70, 93, 0.45); background: var(--dn-dim); color: var(--dn); }
.ahub-status.warn { border-color: rgba(240, 185, 11, 0.45); background: var(--bnb-dim); color: var(--bnb); }
.ahub-status a { color: var(--bnb); font-weight: 700; text-decoration: underline; }

.ahub-tbl-wrap { max-height: 280px; overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.ahub-tbl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.ahub-tbl th, .ahub-tbl td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.ahub-tbl th:first-child, .ahub-tbl td:first-child { text-align: left; }
.ahub-house { padding: 2px 6px; border-radius: 5px; font-size: 9.5px; background: var(--bnb-dim); color: var(--bnb); margin-left: 6px; font-weight: 700; }

.ahub-sig-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
@media(max-width: 760px) { .ahub-sig-grid { grid-template-columns: repeat(2, 1fr); } }
.ahub-sig-kv { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.ahub-sig-kv span { display: block; font-size: 10.5px; color: var(--dim); }
.ahub-sig-kv b { display: block; font-family: var(--mono); font-size: 15px; color: var(--txt-strong); margin-top: 4px; }
.ahub-hash-box {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
  font-family: var(--mono); font-size: 11.5px; color: #93C5FD; word-break: break-all;
}
.ahub-pre {
  margin: 8px 0; padding: 12px 14px; border-radius: 10px; background: var(--code-bg);
  border: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px;
  color: #CBD5E1; overflow: auto; max-height: 220px; line-height: 1.5;
}
.ahub-uc-list { margin: 8px 0 0; padding-left: 18px; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
.ahub-uc-list li { margin-bottom: 6px; }
.ahub-tok-note {
  padding: 8px 11px; border-radius: 9px; background: var(--up-dim); border: 1px solid rgba(14,203,129,.35);
  color: var(--up); font-size: 11.5px; font-weight: 600; margin-bottom: 10px;
}

/* ---------- User Manual Modal, 3-Tier Gate Modal & Spotlight Tour ---------- */
.qtml-manual-bg, .qtml-gate-bg {
  position: fixed; inset: 0; background: rgba(4, 6, 11, 0.72); backdrop-filter: blur(6px);
  z-index: 120; display: none; align-items: center; justify-content: center; padding: 18px;
}
.qtml-manual-bg.on, .qtml-gate-bg.on { display: flex; }
.qtml-manual {
  width: 100%; max-width: 860px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
}
.qtml-gate {
  width: 100%; max-width: 500px; background: var(--panel); border: 1px solid rgba(240, 185, 11, 0.45);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.qtml-gate h3 { margin: 0 0 6px; font-size: 16px; color: var(--txt-strong); font-weight: 700; }
.qtml-gate p.sub { margin: 0 0 14px; font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.qtml-gate-tiers { display: grid; gap: 8px; margin-bottom: 16px; }
.qtml-gate-row {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  font-size: 12px; color: var(--txt); line-height: 1.45;
}
.qtml-gate-row.hi { border-color: rgba(14, 203, 129, 0.45); background: var(--up-dim); }
.qtml-gate-row.vip { border-color: rgba(240, 185, 11, 0.45); background: var(--bnb-dim); }

.qtml-man-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.qtml-man-head h3 { margin: 0; font-size: 14.5px; color: var(--txt-strong); font-weight: 700; }
.qtml-man-tabs {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line);
  background: var(--bg2); overflow-x: auto; overflow-y: hidden;
}
.qtml-man-tab {
  flex: 0 0 auto;
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--dim); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.qtml-man-tab.on { border-color: var(--bnb); background: var(--bnb-dim); color: var(--bnb); }
.qtml-man-body { flex: 1 1 auto; min-height: 0; padding: 18px 20px; overflow-y: auto; font-size: 13px; line-height: 1.65; color: var(--txt); }
.qtml-man-body h4 { margin: 14px 0 6px; font-size: 13.5px; color: var(--txt-strong); }
.qtml-man-body p, .qtml-man-body ul { color: var(--dim); }
.qtml-man-body code {
  background: var(--bg2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px;
  font-family: var(--mono); font-size: 11.5px; color: var(--bnb);
}
.man-steps { display: grid; gap: 10px; margin: 12px 0; }
.man-step {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2);
}
.man-step > b {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; display: grid; place-items: center;
  background: #F0B90B; color: #0B0E11; font-family: var(--mono); font-size: 11.5px; font-weight: 800;
}
.man-step h4 { margin: 0 0 3px; font-size: 13px; color: var(--txt-strong); }
.man-step p { margin: 0; font-size: 12px; color: var(--dim); }
.man-callout { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 12px; margin-top: 10px; }
.man-callout.ok { border-color: rgba(14, 203, 129, 0.4); background: var(--up-dim); }
.man-callout a { color: var(--bnb); font-weight: 700; }

.qtml-tour-dim { position: fixed; inset: 0; background: rgba(3, 5, 10, 0.64); z-index: 130; display: none; }
.qtml-tour-dim.on { display: block; }
.qtml-tour-ring {
  position: fixed; z-index: 132; border-radius: 12px; pointer-events: none; display: none;
  border: 2px solid #F0B90B; box-shadow: 0 0 0 4px rgba(240,185,11,.20), 0 0 24px rgba(240,185,11,.35);
  transition: top .22s ease, left .22s ease, width .22s ease, height .22s ease;
}
.qtml-tour-ring.on { display: block; }
.qtml-tour-pop {
  position: fixed; z-index: 135; width: 400px; max-width: calc(100vw - 24px); display: none;
  background: var(--panel); border: 1px solid rgba(240, 185, 11, 0.5); border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 22px 60px rgba(0,0,0,.65);
}
.qtml-tour-pop.on { display: block; }
.qtml-tour-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.qtml-tour-badge {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--bnb);
  background: var(--bnb-dim); border: 1px solid rgba(240, 185, 11, 0.35); padding: 2px 9px; border-radius: 999px;
}
.qtml-tour-pop h4 { margin: 0 0 6px; font-size: 14px; color: var(--txt-strong); }
.qtml-tour-pop p { margin: 0 0 9px; font-size: 12.5px; color: var(--dim); line-height: 1.55; }
.qtml-tour-tip {
  padding: 8px 10px; border-radius: 8px; background: var(--up-dim);
  border: 1px solid rgba(14, 203, 129, 0.35); font-size: 11.5px; color: var(--up); margin-bottom: 11px;
}
.qtml-tour-dots { display: flex; gap: 5px; margin-bottom: 12px; }
.qtml-tour-dots i { flex: 1; height: 3.5px; border-radius: 999px; background: var(--line2); }
.qtml-tour-dots i.on { background: #F0B90B; }
.qtml-tour-dots i.done { background: var(--up); }
.qtml-tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Hidden on Desktop; Native Chrome on Mobile ---------- */
.qtml-mob-nav, .qtml-mob-btbar { display: none; }

/* ==========================================================================
   DATA LOADING ANIMATIONS — SKELETON SHIMMER, ANIMATED EQUITY WAVE & SPINNER
   ========================================================================== */
@keyframes qtmlShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes qtmlWaveDash {
  0% { stroke-dashoffset: 280; opacity: .45; }
  55% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -280; opacity: .55; }
}
@keyframes qtmlDotPulse {
  0%, 100% { transform: scale(1); opacity: .95; }
  50% { transform: scale(1.65); opacity: .35; }
}
@keyframes qtmlIndet {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(310%); }
}
@keyframes qtmlSpin {
  to { transform: rotate(360deg); }
}

.qtml-sk {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.11) 50%, rgba(255, 255, 255, 0.04) 100%);
  background-size: 220% 100%;
  animation: qtmlShimmer 1.35s ease-in-out infinite;
}
[data-theme="light"] .qtml-sk {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.055) 0%, rgba(15, 23, 42, 0.115) 50%, rgba(15, 23, 42, 0.055) 100%);
  background-size: 220% 100%;
}
.qtml-sk-card { display: flex; flex-direction: column; gap: 7px; min-height: 76px; justify-content: center; }
.qtml-sk-k { height: 10px; width: 54%; }
.qtml-sk-v { height: 22px; width: 76%; }
.qtml-sk-s { height: 9px; width: 64%; opacity: .75; }
.qtml-sk-row td { padding: 11px 10px !important; }
.qtml-sk-row .qtml-sk { height: 11px; margin-left: auto; }
.qtml-sk-row td:first-child .qtml-sk { margin-left: 0; }
.qtml-arch-sk { display: flex; flex-direction: column; gap: 10px; padding: 16px 4px; }

.qtml-loading-dim { opacity: 0.52; transition: opacity .18s ease; pointer-events: none; }

.chart-wrap { position: relative; }
.qtml-chart-loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--panel);
  transition: opacity .22s ease, visibility .22s ease;
}
.qtml-chart-loader.on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.qtml-chart-loader.on.reloading {
  background: rgba(11, 14, 17, 0.68);
  backdrop-filter: blur(4px);
}
[data-theme="light"] .qtml-chart-loader.on.reloading {
  background: rgba(255, 255, 255, 0.78);
}

.qtml-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 340px;
  width: 100%;
  gap: 8px;
}
.qtml-loader-wave { width: 210px; height: 54px; overflow: visible; }
.qtml-wave-bg { stroke: var(--line2); }
.qtml-wave-fg {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: qtmlWaveDash 1.9s cubic-bezier(.4, 0, .2, 1) infinite;
}
.qtml-wave-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: qtmlDotPulse 1.3s ease-in-out infinite;
}
.qtml-loader-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--txt-strong);
  letter-spacing: -0.01em;
}
.qtml-loader-sub {
  font-size: 11.5px;
  color: var(--dim);
  line-height: 1.4;
}
.qtml-loader-bar {
  width: 184px;
  height: 3.5px;
  border-radius: 999px;
  background: var(--line2);
  overflow: hidden;
  margin-top: 4px;
}
.qtml-loader-bar i {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--up), var(--cyan), var(--bnb));
  animation: qtmlIndet 1.25s cubic-bezier(.4, 0, .2, 1) infinite;
}

.qtml-spin {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-block;
  vertical-align: -2px;
  animation: qtmlSpin .85s linear infinite;
}
#runBtn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: .88;
}
.qtml-period-loading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
}

/* ==========================================================================
   PROGRESSIVE DESKTOP / TABLET TOPBAR FIT (Zero Right-Edge Clipping!)
   ========================================================================== */
@media(max-width: 1340px) {
  #indexReport { display: none !important; }
}
@media(max-width: 1200px) {
  .brand small { display: none !important; }
  .top { gap: 10px !important; padding: 0 14px !important; }
  #viewTabs.tabs a, #viewTabs.tabs button { padding: 0 10px !important; font-size: 12.5px !important; }
}
@media(max-width: 1080px) {
  #ahubManualBtn span, #ahubTourBtn span { display: none; }
  #ahubManualBtn, #ahubTourBtn { padding: 6px 8px; }
  .ahub-top-btn { padding: 7px 11px; font-size: 12px; }
}
@media(max-width: 980px) {
  #statusPill { display: none !important; }
}

/* ==========================================================================
   MOBILE-FIRST NATIVE BINANCE WALLET EXPERIENCE (<= 960px & <= 860px)
   ========================================================================== */
@media(max-width: 960px) {
  #btView.layout, #demoView.layout {
    display: flex !important; flex-direction: column; gap: 12px;
    padding: 12px 14px 92px !important;
  }
  #btView.layout[style*="display: none"], #demoView.layout[style*="display: none"],
  #btView.layout[style*="display:none"], #demoView.layout[style*="display:none"] {
    display: none !important;
  }
  .layout > main { order: 1; width: 100%; }
  .layout > aside.side { order: 2; width: 100%; }
  .side-inner { position: static !important; }

  .qtml-mob-btbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 12px; margin-bottom: 10px; border-radius: 12px;
    background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .qtml-mob-btbar-info { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--txt-strong); }
  .qtml-mob-btbar-info small { display: block; font-weight: 500; font-size: 10.5px; color: var(--dim); font-family: var(--sans); }
  .qtml-mob-btbar-act { display: flex; gap: 6px; flex: 0 0 auto; }
  body.qtml-mob-settings-closed #btView > aside.side > .side-inner > .card,
  body.qtml-mob-settings-closed #btView > aside.side > .side-inner > #runBtn {
    display: none;
  }
}

@media(max-width: 860px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

  .top {
    height: 52px !important; padding: 0 12px !important; gap: 8px !important; flex-wrap: nowrap !important;
  }
  .brand small, #viewTabs, #statusPill, #enginePill, #indexReport, #ahubManualBtn, #ahubTourBtn {
    display: none !important;
  }
  .top .spacer { display: block; flex: 1; }
  #ahubTopCtrl { gap: 6px !important; flex-wrap: nowrap !important; }
  .ahub-top-btn { padding: 7px 12px; font-size: 12px; min-height: 36px; }
  .ahub-badge { max-width: 92px; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; padding: 5px 8px; }

  /* Native Fixed Bottom Navigation Bar (4 Minimal Stroke SVG Icons) */
  .qtml-mob-nav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: var(--top-bg); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
  }
  .qtml-mob-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: none; background: transparent; color: var(--dim);
    font-size: 10.5px; font-weight: 600; padding: 5px 4px; border-radius: 10px;
    cursor: pointer; min-height: 46px; position: relative; transition: color .14s;
  }
  .qtml-mob-nav button.on { color: var(--bnb); }
  .qtml-mob-nav button.on::before {
    content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 2px;
    border-radius: 99px; background: var(--bnb);
  }

  .ahub-wrap { padding: 12px 14px 92px; }
  .ahub-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .metrics { grid-template-columns: repeat(2, 1fr) !important; }
  .m { padding: 11px 12px !important; }
  .m:nth-child(2n) { border-right: none !important; }
  .m .v { font-size: 18px !important; }
  .chart-wrap { height: 235px !important; }

  /* 44px Touch Targets & 16px Inputs (Zero iOS Zoom) */
  input[type="text"], input[type="number"], input[type="date"], select, .combo-btn {
    font-size: 16px !important; min-height: 44px;
  }
  .btn, .ahub-btn { min-height: 44px; }
  .ahub-btn.sm { min-height: 36px; }
  .ahub-btn-row { flex-direction: column; }
  .ahub-btn-row .ahub-btn { width: 100%; }

  /* Native Bottom Sheets */
  .qtml-manual-bg, .qtml-gate-bg { align-items: flex-end; padding: 0; }
  .qtml-manual, .qtml-gate {
    max-width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .qtml-tour-pop {
    left: 10px !important; right: 10px !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; top: auto !important;
    width: auto !important; border-radius: 16px;
  }
}


/* ---------- Drawdown Defense 1-Click Preset Bar ---------- */
.qtml-risk-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 2px;
}
.qtml-risk-bar button {
  padding: 6px 4px; border-radius: 7px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--dim); font-size: 11px; font-weight: 700;
  cursor: pointer; transition: .14s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qtml-risk-bar button:hover { color: var(--txt-strong); border-color: var(--bnb); }
.qtml-risk-bar button.on {
  background: var(--bnb); color: #0B0E11; border-color: var(--bnb);
  box-shadow: 0 2px 8px rgba(240, 185, 11, 0.25);
}
[data-theme="light"] .qtml-risk-bar button.on {
  background: #0F172A; color: #FFFFFF; border-color: #0F172A;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
}


/* ---------- Mode A Cloud Bot, Mode B Private Cloud & Mode C Copy Trading ---------- */
.qtml-cloud-ip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2);
  margin-bottom: 12px;
}
.qtml-ip-code {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line); font-family: var(--mono);
  font-size: 12px; font-weight: 700; color: var(--txt-strong);
}
.qtml-cloud-gate {
  padding: 16px; border-radius: 12px; border: 1px dashed var(--line2); background: var(--bg2);
  text-align: center;
}
.qtml-cloud-gate p { margin: 0 0 12px; font-size: 13px; color: var(--dim); }
.qtml-cloud-ok {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(14, 203, 129, 0.35); background: var(--up-dim); color: var(--up);
  font-size: 12px;
}
.qtml-cloud-form {
  display: grid; gap: 10px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--bg2);
}
.qtml-cloud-bots { display: grid; gap: 8px; }
.qtml-cloud-bot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2);
}
.qtml-cb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.qtml-cb-meta { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.qtml-cb-sub { margin-top: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--dim2); }
.qtml-cb-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* Fix password input styling to match full-width text inputs */
input[type="password"] {
  width: 100%; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--txt-strong);
  font-family: var(--mono); font-size: 13px; box-sizing: border-box; transition: border-color .14s;
}
input[type="password"]:focus { outline: none; border-color: var(--bnb); }

/* Visual API Key Trust Matrix (CAN vs CANNOT) & 60s Binance Checklist */
.qtml-trust-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
@media (max-width: 640px) { .qtml-trust-grid { grid-template-columns: 1fr; } }
.qtml-trust-box {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2);
  font-size: 12px; line-height: 1.45;
}
.qtml-trust-box.can { border-color: rgba(14, 203, 129, 0.32); background: var(--up-dim); }
.qtml-trust-box.cannot { border-color: rgba(246, 70, 93, 0.28); background: var(--dn-dim); }
.qtml-trust-h {
  display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 6px;
}
.qtml-trust-box.can .qtml-trust-h { color: var(--up); }
.qtml-trust-box.cannot .qtml-trust-h { color: var(--dn); }
.qtml-trust-box ul { margin: 0; padding-left: 16px; color: var(--txt); }
.qtml-trust-box li { margin-bottom: 3px; }

.qtml-perm-guide { margin-bottom: 12px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); }
.qtml-perm-guide summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--txt-strong); display: flex; align-items: center; gap: 6px; }
.qtml-perm-body { margin-top: 8px; display: grid; gap: 6px; font-size: 12px; color: var(--txt); }
.qtml-perm-row { display: flex; align-items: flex-start; gap: 8px; }
.qtml-perm-tag {
  flex: 0 0 34px; text-align: center; font-family: var(--mono); font-size: 10px; font-weight: 800;
  padding: 2px 4px; border-radius: 5px; line-height: 1.3;
}
.qtml-perm-tag.on { background: var(--up-dim); color: var(--up); border: 1px solid rgba(14,203,129,.35); }
.qtml-perm-tag.off { background: var(--dn-dim); color: var(--dn); border: 1px solid rgba(246,70,93,.35); }
.qtml-perm-tag.ip { background: rgba(240,185,11,.15); color: var(--bnb); border: 1px solid rgba(240,185,11,.35); }

.qtml-sec-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.qtml-sec-pill {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; font-family: var(--mono);
}
.qtml-sec-pill.ok { background: rgba(14,203,129,.16); color: var(--up); border: 1px solid rgba(14,203,129,.35); }
.qtml-sec-pill.warn { background: rgba(240,185,11,.16); color: var(--bnb); border: 1px solid rgba(240,185,11,.4); }

.qtml-zero-escape {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line2);
  background: var(--bg2); display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--dim);
}
.qtml-ze-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.qtml-sandbox-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; margin-bottom: 12px;
  border-radius: 99px; border: 1px solid rgba(14, 203, 129, 0.38); background: var(--up-dim);
  color: var(--up); font-size: 11.5px; font-weight: 700;
}
.qtml-agent-box {
  padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(240, 185, 11, 0.35);
  background: var(--bg2);
}
.qtml-agent-box summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--txt-strong);
  display: flex; align-items: center; gap: 7px;
}

/* ---------- Smart AI Model Guard & Community AI / Strategy Hub ---------- */
.qtml-ai-avail {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin: 4px 0 8px; padding: 6px 9px; border-radius: 8px; font-size: 11px; line-height: 1.35;
}
.qtml-ai-avail.ok {
  background: var(--up-dim); border: 1px solid rgba(14, 203, 129, 0.32); color: var(--up);
}
.qtml-ai-avail.miss {
  background: var(--bnb-dim); border: 1px solid rgba(240, 185, 11, 0.38); color: var(--bnb);
}
.qtml-train-inline {
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--bnb); background: var(--bnb);
  color: #0B0E11; font-size: 10.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.qtml-train-inline:hover { filter: brightness(1.06); }

.qtml-share-cta {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 7px;
  margin-top: 6px; border-color: rgba(34, 211, 238, 0.42) !important;
  background: var(--cyan-dim) !important; color: var(--txt-strong) !important;
}
.qtml-share-cta svg { color: var(--cyan); }
.qtml-share-cta:hover { border-color: var(--cyan) !important; filter: brightness(1.06); }

.qtml-comm-models {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 10px;
}
.qtml-model-card {
  padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel);
  display: flex; flex-direction: column; gap: 6px;
}
.qtml-model-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.qtml-model-top b { font-family: var(--mono); font-size: 13.5px; color: var(--txt-strong); }
.qtml-model-stats {
  display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.qtml-model-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px;
  font-size: 11px; color: var(--dim2);
}

.qtml-comm-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.qtml-comm-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qtml-comm-feed {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px;
}
.qtml-strat-card {
  padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel);
  display: flex; flex-direction: column; gap: 8px;
}
.qtml-strat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.qtml-strat-title { font-size: 13px; font-weight: 700; color: var(--txt-strong); }
.qtml-strat-by { font-size: 11px; color: var(--dim); font-family: var(--mono); margin-top: 2px; }
.qtml-strat-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.qtml-strat-chip {
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg2);
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
}
.qtml-strat-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  padding: 8px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line);
}
.qtml-strat-metrics span { display: block; font-size: 9.5px; color: var(--dim2); text-transform: uppercase; }
.qtml-strat-metrics b { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--txt-strong); margin-top: 2px; }
.qtml-strat-metrics b.pos { color: var(--up); }
.qtml-strat-metrics b.neg { color: var(--dn); }
.qtml-strat-note { font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.qtml-strat-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.qtml-train-log {
  margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--code-bg);
  border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: #CBD5E1;
  max-height: 150px; overflow: auto; line-height: 1.45;
}

/* ---------- MetaTrader (MQL) Visual Backtesting Playback ---------- */
#chartTabs .qtml-replay-tab {
  display: inline-flex; align-items: center; gap: 5px;
  border-color: rgba(240, 185, 11, 0.42) !important;
  color: var(--bnb) !important;
}
#chartTabs .qtml-replay-tab.on {
  background: #F0B90B !important; color: #0B0E11 !important; border-color: #F0B90B !important;
}
[data-theme="light"] #chartTabs .qtml-replay-tab.on {
  background: #0F172A !important; color: #FFFFFF !important; border-color: #0F172A !important;
}
.qtml-rp-pane { display: flex; flex-direction: column; }
.qtml-rp-hud {
  display: grid; grid-template-columns: repeat(9, minmax(0, auto)); gap: 8px 12px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg2);
}
@media(max-width: 1120px) { .qtml-rp-hud { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media(max-width: 640px)  { .qtml-rp-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qtml-rp-kv span { display: block; font-size: 9.5px; color: var(--dim2); text-transform: uppercase; letter-spacing: .04em; }
.qtml-rp-kv b { display: block; font-family: var(--mono); font-size: 12px; color: var(--txt-strong); margin-top: 1px; white-space: nowrap; }
.qtml-rp-state { display: flex; justify-content: flex-end; }
.qtml-sec-pill.cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(34,211,238,.4); }
.qtml-sec-pill.liq  { background: var(--dn-dim); color: var(--dn); border: 1px solid rgba(246,70,93,.45); }

.qtml-rp-canvas-wrap { position: relative; width: 100%; height: 420px; background: var(--panel); }
.qtml-rp-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
@media(max-width: 860px) { .qtml-rp-canvas-wrap { height: 320px; } }

.qtml-rp-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg2);
}
.qtml-rp-transport { display: inline-flex; align-items: center; gap: 5px; }
.qtml-rp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; min-width: 32px; padding: 0 9px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--txt-strong);
  font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; transition: .13s;
}
.qtml-rp-btn:hover { border-color: var(--bnb); }
.qtml-rp-btn.play {
  background: #F0B90B; border-color: #F0B90B; color: #0B0E11; padding: 0 13px;
}
.qtml-rp-btn.play.playing {
  background: var(--cyan); border-color: var(--cyan); color: #061318;
}
.qtml-rp-scrub-wrap {
  flex: 1 1 180px; display: flex; align-items: center; gap: 10px; min-width: 150px;
}
.qtml-rp-scrub-wrap input[type="range"] {
  flex: 1; accent-color: #F0B90B; cursor: pointer; height: 5px;
}
.qtml-rp-step-cnt {
  font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; min-width: 66px; text-align: right;
}
.qtml-rp-opts { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qtml-rp-opts select {
  width: auto !important; height: 30px; min-height: 30px !important; padding: 0 8px;
  font-size: 11.5px !important; font-family: var(--mono);
}
.qtml-rp-chk {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--dim);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.qtml-rp-chk input { accent-color: #F0B90B; }

/* ==========================================================================
   Animated Price History Download Progress Bar (%) — Obsidian Dark & Pearl Light
   ========================================================================== */
.pill.dl-live {
  color: var(--bnb) !important;
  border-color: rgba(240, 185, 11, 0.42) !important;
  background: var(--bnb-dim) !important;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
[data-theme="light"] .pill.dl-live {
  color: #9A6700 !important;
  border-color: rgba(217, 155, 0, 0.45) !important;
  background: rgba(240, 185, 11, 0.14) !important;
}
.pill.dl-ok {
  color: var(--up) !important;
  border-color: rgba(14, 203, 129, 0.42) !important;
  background: var(--up-dim) !important;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.pill .dl-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block; flex-shrink: 0;
  animation: dlPulseDot 1.15s ease-in-out infinite;
}

.btn.is-dl {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 1 !important;
  cursor: progress !important;
  color: var(--txt-strong) !important;
  border-color: rgba(240, 185, 11, 0.48) !important;
  background: linear-gradient(180deg, rgba(240, 185, 11, 0.10), rgba(240, 185, 11, 0.04)) !important;
  font-variant-numeric: tabular-nums;
}
[data-theme="light"] .btn.is-dl {
  color: #0F172A !important;
  border-color: rgba(217, 155, 0, 0.55) !important;
  background: linear-gradient(180deg, rgba(240, 185, 11, 0.16), rgba(240, 185, 11, 0.06)) !important;
}
.btn.is-dl::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: var(--dl-pct, 0%);
  background: linear-gradient(90deg, #D99B00 0%, #F0B90B 55%, #0ECB81 100%);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.dl-spin {
  width: 14px; height: 14px; flex-shrink: 0;
  animation: dlSpin 0.9s linear infinite;
}

.dl-prog {
  margin-top: 10px;
  padding: 10px 11px 9px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--bg2);
  animation: dlSlideIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.dl-prog[hidden] { display: none !important; }
.dl-prog.is-running {
  border-color: rgba(240, 185, 11, 0.34);
  box-shadow: 0 4px 18px rgba(240, 185, 11, 0.08);
}
.dl-prog.is-done {
  border-color: rgba(14, 203, 129, 0.42);
  background: linear-gradient(180deg, var(--up-dim), var(--bg2));
}
.dl-prog.is-err {
  border-color: rgba(246, 70, 93, 0.42);
  background: linear-gradient(180deg, var(--dn-dim), var(--bg2));
}

.dl-prog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.dl-prog-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--txt);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--bnb);
  box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.55);
  animation: dlPing 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.dl-prog.is-done .dl-dot {
  background: var(--up);
  box-shadow: 0 0 8px rgba(14, 203, 129, 0.5);
  animation: none;
}
.dl-prog.is-err .dl-dot {
  background: var(--dn);
  box-shadow: none;
  animation: none;
}
.dl-prog-pct {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--bnb);
  flex-shrink: 0;
}
[data-theme="light"] .dl-prog-pct { color: #B47B00; }
.dl-prog.is-done .dl-prog-pct { color: var(--up) !important; }
.dl-prog.is-err .dl-prog-pct  { color: var(--dn) !important; }

.dl-bar-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
}
[data-theme="light"] .dl-bar-track {
  background: #E2E8F0;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.dl-bar-fill {
  position: relative;
  height: 100%;
  min-width: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #D99B00 0%, #F0B90B 52%, #0ECB81 100%);
  box-shadow: 0 0 12px rgba(240, 185, 11, 0.42);
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
  overflow: hidden;
}
/* Layer 1: Diagonal flowing telemetry stripes */
.dl-bar-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.26) 0px,
    rgba(255, 255, 255, 0.26) 6px,
    transparent 6px,
    transparent 12px
  );
  background-size: 17px 17px;
  animation: dlStripes 0.75s linear infinite;
}
/* Layer 2: Luminous specular sweep */
.dl-bar-fill::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -45%;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: dlShimmer 1.75s ease-in-out infinite;
}
/* Indeterminate startup glow while connecting / loading cache */
.dl-bar-fill.is-indet {
  width: 34% !important;
  animation: dlIndet 1.35s ease-in-out infinite;
}
.dl-prog.is-done .dl-bar-fill {
  background: linear-gradient(90deg, #059669 0%, #0ECB81 100%);
  box-shadow: 0 0 10px rgba(14, 203, 129, 0.38);
}
.dl-prog.is-done .dl-bar-fill::before,
.dl-prog.is-done .dl-bar-fill::after,
.dl-prog.is-err .dl-bar-fill::before,
.dl-prog.is-err .dl-bar-fill::after {
  animation: none;
  opacity: 0;
}
.dl-prog.is-err .dl-bar-fill {
  background: var(--dn);
  box-shadow: none;
}

.dl-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}
.dl-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--dim2);
  transition: color 0.2s ease;
}
.dl-st-ic {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--line2);
  background: transparent;
  display: inline-block;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.dl-step.active { color: var(--txt-strong); }
.dl-step.active .dl-st-ic {
  border-color: var(--bnb);
  background: var(--bnb);
  box-shadow: 0 0 0 3px var(--bnb-dim);
}
.dl-step.done { color: var(--up); }
.dl-step.done .dl-st-ic {
  border-color: var(--up);
  background: var(--up);
}

.dl-prog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}
.dl-meta-l, .dl-meta-r {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-meta-r { color: var(--dim2); text-align: right; }

.md-cov.fresh {
  border-color: rgba(14, 203, 129, 0.55) !important;
  box-shadow: 0 0 0 3px var(--up-dim);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

@keyframes dlSpin { to { transform: rotate(360deg); } }
@keyframes dlStripes { from { background-position: 0 0; } to { background-position: 17px 0; } }
@keyframes dlShimmer { 0% { left: -45%; } 100% { left: 115%; } }
@keyframes dlIndet { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }
@keyframes dlPulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.32; } }
@keyframes dlPing {
  0% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.55); }
  75%, 100% { box-shadow: 0 0 0 6px rgba(240, 185, 11, 0); }
}
@keyframes dlSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dl-spin, .dl-dot, .dl-pill-dot, .dl-bar-fill::before, .dl-bar-fill::after, .dl-bar-fill.is-indet {
    animation: none !important;
  }
}

/* ==========================================================================
   Price Action Chart Toolbar & High-Contrast Live Price Controls
   ========================================================================== */
.qtml-chart-head {
  flex-wrap: wrap !important;
  row-gap: 8px !important;
}
.qtml-ct-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-left: auto;
}
.qtml-ct-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--line2);
}
.qtml-ct-seg button {
  border: none;
  background: transparent;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}
.qtml-ct-seg button:hover { color: var(--txt-strong); }
.qtml-ct-seg button.on {
  background: var(--bnb);
  color: #0B0E11;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(240, 185, 11, 0.25);
}
[data-theme="light"] .qtml-ct-seg button.on {
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}
.qtml-ct-sel {
  width: auto !important;
  height: 27px;
  min-height: 27px !important;
  padding: 0 8px !important;
  border-radius: 7px !important;
  border: 1px solid var(--line2) !important;
  background: var(--bg2) !important;
  color: var(--txt-strong) !important;
  font-family: var(--sans) !important;
  font-size: 11px !important;
  font-weight: 600;
  cursor: pointer;
}
.qtml-ct-sel:focus {
  border-color: var(--bnb) !important;
}
.qtml-live-px-pill {
  font-family: var(--mono) !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  color: var(--txt-strong) !important;
  background: var(--bg2) !important;
  border-color: var(--line2) !important;
}
.qtml-live-px-pill.up {
  color: var(--up) !important;
  border-color: rgba(14, 203, 129, 0.42) !important;
  background: var(--up-dim) !important;
}
.qtml-live-px-pill.dn {
  color: var(--dn) !important;
  border-color: rgba(246, 70, 93, 0.42) !important;
  background: var(--dn-dim) !important;
}
.qtml-chart-head .tabs { margin-left: auto; }
.qtml-bt-ct-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qtml-bt-ct-wrap[hidden] { display: none !important; }
#demoChartWrap {
  height: 340px !important;
}
@media (max-width: 720px) {
  #demoChartWrap { height: 280px !important; }
  .qtml-ct-seg button { padding: 4px 6px; font-size: 10.5px; }
}

/* ---------- TradingView-Style Zoom & Drag-Pan Canvas Controls ---------- */
#chart, #demoChart, #replayCanvas {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#chart.is-dragging, #demoChart.is-dragging, #replayCanvas.is-dragging {
  cursor: grabbing !important;
}
.qtml-zoom-hud {
  position: absolute;
  top: 10px;
  right: 92px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(18, 22, 28, 0.78);
  border: 1px solid var(--line2);
  backdrop-filter: blur(6px);
  opacity: 0.78;
  transition: opacity 0.16s ease, border-color 0.16s ease;
}
.chart-wrap:hover .qtml-zoom-hud,
.qtml-rp-canvas-wrap:hover .qtml-zoom-hud,
.qtml-zoom-hud.zoomed {
  opacity: 1;
}
[data-theme="light"] .qtml-zoom-hud {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.qtml-zoom-hud.axis-left {
  right: 20px;
}
.qtml-zoom-hud button {
  border: none;
  background: transparent;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.qtml-zoom-hud button:hover {
  background: var(--panel2);
  color: var(--txt-strong);
}
.qtml-zoom-hud button.qtml-zh-reset {
  display: none;
  color: var(--bnb);
  padding: 0 7px;
  font-size: 10px;
}
[data-theme="light"] .qtml-zoom-hud button.qtml-zh-reset {
  color: #B47B00;
}
.qtml-zoom-hud.zoomed button.qtml-zh-reset {
  display: inline-flex;
}
.qtml-zoom-hud.zoomed {
  border-color: rgba(240, 185, 11, 0.45);
}

/* ==========================================================================
   Live 54-Indicator & Real-Time Risk Check Inspector
   ========================================================================== */
.ahub-ind-trigger {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--txt);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ahub-ind-trigger:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}
.ahub-ind-trigger .ind-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 6px var(--up);
  flex-shrink: 0;
}
.qtml-ind-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  margin-bottom: 14px;
}
.qtml-ind-tb-l, .qtml-ind-tb-r {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qtml-ind-risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.qtml-ind-risk-pill.low { background: var(--up-dim); color: var(--up); border: 1px solid rgba(14,203,129,.4); }
.qtml-ind-risk-pill.elevated { background: var(--bnb-dim); color: var(--bnb); border: 1px solid rgba(240,185,11,.45); }
.qtml-ind-risk-pill.high { background: var(--dn-dim); color: var(--dn); border: 1px solid rgba(246,70,93,.45); }
.qtml-ind-sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}
.qtml-ind-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}
@media (max-width: 820px) { .qtml-ind-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qtml-ind-card {
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.qtml-ind-card.ok { border-left: 3px solid var(--up); }
.qtml-ind-card.warn { border-left: 3px solid var(--bnb); }
.qtml-ind-card.danger { border-left: 3px solid var(--dn); }
.qtml-ind-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
}
.qtml-ind-card-val {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  color: var(--txt-strong);
  font-variant-numeric: tabular-nums;
}
.qtml-ind-meter {
  height: 5px;
  border-radius: 999px;
  background: var(--bg2);
  overflow: hidden;
}
.qtml-ind-meter > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}
.qtml-ind-card.ok .qtml-ind-meter > i { background: var(--up); }
.qtml-ind-card.warn .qtml-ind-meter > i { background: var(--bnb); }
.qtml-ind-card.danger .qtml-ind-meter > i { background: var(--dn); }
.qtml-ind-card-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--dim2);
}
.qtml-ind-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.qtml-ind-dot.ok { background: var(--up); }
.qtml-ind-dot.warn { background: var(--bnb); }
.qtml-ind-dot.danger { background: var(--dn); }

.qtml-ind-grp {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  margin-bottom: 8px;
  overflow: hidden;
}
.qtml-ind-grp summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--txt-strong);
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}
.qtml-ind-grp summary::-webkit-details-marker { display: none; }
.qtml-ind-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
}
@media (max-width: 760px) { .qtml-ind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .qtml-ind-grid { grid-template-columns: 1fr; } }
.qtml-ind-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg2);
  font-family: var(--mono);
  font-size: 11px;
}
.qtml-ind-kv span { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qtml-ind-kv b { color: var(--txt-strong); font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }

.qtml-alpha-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.qtml-alpha-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--txt);
}

/* Highlighted Train AI Model menu pill & section */
.qtml-train-nav {
  border: 1px solid rgba(240, 185, 11, 0.45);
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.14), rgba(240, 185, 11, 0.04));
  color: #f0b90b;
}
.qtml-train-nav:hover {
  border-color: rgba(240, 185, 11, 0.85);
  background: rgba(240, 185, 11, 0.22);
}
.qtml-train-highlight {
  border: 1px solid rgba(240, 185, 11, 0.45) !important;
  background: linear-gradient(180deg, rgba(240, 185, 11, 0.08) 0%, rgba(17, 24, 39, 0) 100%);
  box-shadow: 0 0 0 1px rgba(240, 185, 11, 0.12), 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Animated AI Training Progress Bar */
.qtml-train-prog-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(240, 185, 11, 0.35);
}
.qtml-train-prog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 6px;
}
.qtml-train-prog-pct {
  color: #f0b90b;
  font-variant-numeric: tabular-nums;
}
.qtml-train-prog-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.qtml-train-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0b90b, #fcd535, #f0b90b);
  background-size: 200% 100%;
  animation: qtmlProgShimmer 1.4s linear infinite;
  transition: width 0.4s ease;
}
@keyframes qtmlProgShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
