:root {
  --bg: #070f1c;
  --bg-2: #0a1424;
  --panel: #0f1b2e;
  --panel-2: #121f34;
  --line: #1e304a;
  --line-soft: rgba(129, 160, 198, .14);
  --text: #e7eef8;
  --muted: #8da1ba;
  --muted-2: #5f7692;
  --teal: #2dd4bf;
  --blue: #60a5fa;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --radius: 16px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1000px 500px at 82% -12%, rgba(45, 212, 191, .10), transparent 55%),
    radial-gradient(800px 420px at -8% 16%, rgba(96, 165, 250, .08), transparent 52%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar {
  height: 74px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 15, 28, .86); backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(45,212,191,.24), rgba(96,165,250,.2));
  border: 1px solid rgba(45,212,191,.42); color: var(--teal); font-weight: 800; letter-spacing: .5px;
  box-shadow: inset 0 0 22px rgba(45,212,191,.08);
}
.brand-name { font-size: 17px; font-weight: 750; letter-spacing: .2px; }
.brand-name span { color: var(--teal); font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.snapshot-chip {
  font-family: var(--mono); font-size: 11px; color: #b8c8dc; border: 1px solid var(--line);
  background: rgba(18, 31, 52, .75); border-radius: 999px; padding: 8px 12px;
}
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 10px; padding: 9px 13px; font-size: 12px; font-weight: 650;
  transition: .18s ease; white-space: nowrap;
}
.btn:hover { border-color: rgba(45,212,191,.5); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #0f766e, #0e7490); border-color: #14958b; }
.btn-primary:hover { background: linear-gradient(135deg, #0d9488, #0e7490); }
.btn-ghost { background: transparent; color: #b7c6d9; }
.layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar {
  border-right: 1px solid var(--line-soft); padding: 24px 18px 28px;
  background: rgba(8, 18, 32, .72); position: sticky; top: 74px; height: calc(100vh - 74px); overflow-y: auto;
}
.side-head h2 { font-size: 17px; margin: 6px 0 6px; }
.side-head p { color: var(--muted); font-size: 12px; line-height: 1.65; margin: 0 0 17px; }
.eyebrow { color: var(--teal); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
.preset-list { display: grid; gap: 7px; margin-bottom: 22px; }
.preset {
  width: 100%; text-align: left; border: 1px solid var(--line-soft); background: rgba(18,31,52,.42);
  color: var(--text); border-radius: 11px; padding: 10px 11px; transition: .16s ease;
}
.preset:hover { border-color: rgba(45,212,191,.35); background: rgba(20,36,60,.7); }
.preset.active { border-color: rgba(45,212,191,.72); background: rgba(13,148,136,.14); box-shadow: inset 3px 0 0 var(--teal); }
.preset b { display: block; font-size: 12px; margin-bottom: 2px; }
.preset small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.filter-block { border-top: 1px solid var(--line-soft); padding-top: 17px; margin-top: 17px; }
.filter-title { color: #c9d7e8; font-size: 12px; font-weight: 700; margin-bottom: 12px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.field b { color: var(--text); font-family: var(--mono); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--teal); height: 4px; }
input[type="number"], .search, .select {
  width: 100%; border: 1px solid var(--line); background: #0a1628; color: var(--text);
  border-radius: 9px; padding: 9px 10px; outline: none; font-size: 12px; transition: .16s;
}
input[type="number"]:focus, .search:focus, .select:focus { border-color: rgba(45,212,191,.6); box-shadow: 0 0 0 3px rgba(45,212,191,.08); }
.weight-row { display: grid; grid-template-columns: 36px 1fr 26px; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; margin: 9px 0; }
.weight-row b { color: var(--text); font-family: var(--mono); font-size: 11px; text-align: right; }
.check-row { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; margin: 10px 0; cursor: pointer; }
.check-row input, .toggle input { accent-color: var(--teal); }
.sidebar-note { margin-top: 20px; padding: 12px; border-radius: 12px; background: rgba(251,191,36,.055); border: 1px solid rgba(251,191,36,.17); display: grid; gap: 5px; }
.sidebar-note strong { color: #f5cd6b; font-size: 11px; }
.sidebar-note span { color: var(--muted); font-size: 10px; line-height: 1.55; }
.main { padding: 28px 30px 40px; min-width: 0; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.hero h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: -.8px; margin: 7px 0 9px; }
.hero p { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0; max-width: 720px; }
.hero-status { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(15,27,46,.72); min-width: 160px; }
.hero-status b { display: block; font-size: 11px; }
.hero-status small { color: var(--muted); font-size: 10px; display: block; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.12); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: linear-gradient(145deg, rgba(18,31,52,.96), rgba(11,23,40,.96)); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 15px 13px; box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: 10px; letter-spacing: .2px; }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -.5px; margin-top: 7px; font-family: var(--mono); }
.kpi-sub { color: var(--muted-2); font-size: 10px; margin-top: 4px; }
.kpi.accent .kpi-value { color: var(--teal); }
.kpi.blue .kpi-value { color: var(--blue); }
.kpi.amber .kpi-value { color: var(--amber); }
.panel { background: rgba(12, 24, 41, .82); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.results-panel { overflow: hidden; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: 16px; margin: 5px 0 0; display: flex; align-items: center; gap: 8px; }
.panel-head p { margin: 0; }
.muted { color: var(--muted); font-size: 11px; }
.count-badge { font-family: var(--mono); font-size: 10px; color: var(--teal); border: 1px solid rgba(45,212,191,.25); background: rgba(45,212,191,.07); border-radius: 999px; padding: 3px 7px; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.search { width: 190px; }
.select { width: auto; min-width: 152px; }
.toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.table-wrap { overflow: auto; max-height: 620px; }
.stock-table { width: 100%; border-collapse: collapse; min-width: 1040px; }
.stock-table th {
  position: sticky; top: 0; z-index: 2; background: #0c192b; color: var(--muted-2);
  font-size: 10px; font-weight: 650; text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line);
  letter-spacing: .3px; white-space: nowrap;
}
.stock-table td { padding: 10px 11px; border-bottom: 1px solid rgba(30,48,74,.55); font-size: 11px; vertical-align: middle; white-space: nowrap; }
.stock-table tbody tr { cursor: pointer; transition: .12s ease; }
.stock-table tbody tr:hover { background: rgba(45,212,191,.045); }
.stock-table tbody tr.selected { background: rgba(45,212,191,.08); box-shadow: inset 3px 0 0 var(--teal); }
.stock-cell { display: flex; align-items: center; gap: 8px; }
.stock-code { color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.stock-name { font-weight: 650; color: #e7eef8; }
.stock-name small { display: block; color: var(--muted-2); font-weight: 400; font-family: var(--mono); font-size: 9px; margin-top: 2px; }
.sector-pill { display: inline-block; color: #a9bdd5; background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.15); border-radius: 999px; padding: 3px 7px; font-size: 9px; }
.num { text-align: right !important; font-family: var(--mono); }
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }
.signal-list { display: flex; gap: 4px; flex-wrap: wrap; max-width: 180px; }
.signal { color: #b3c7de; background: rgba(148,163,184,.08); border: 1px solid rgba(148,163,184,.13); border-radius: 5px; padding: 2px 5px; font-size: 9px; }
.signal.hot { color: #f7c76b; background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.16); }
.score-cell { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.score-num { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.score-bar { width: 38px; height: 4px; background: #1b2a40; border-radius: 999px; overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: inherit; }
.grade { font-family: var(--mono); font-size: 9px; font-weight: 700; border-radius: 5px; padding: 2px 4px; }
.grade.A { color: #052e2b; background: var(--teal); }
.grade.B { color: #082f49; background: var(--blue); }
.grade.C { color: #422006; background: var(--amber); }
.grade.D { color: #450a0a; background: #fb7185; }
.star-btn { border: 0; background: transparent; color: #50657e; font-size: 16px; line-height: 1; padding: 0; }
.star-btn.on { color: var(--amber); }
.table-empty { padding: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.backtest-panel { overflow: hidden; }
.backtest-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 18px; }
.backtest-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.metric-box { border: 1px solid var(--line-soft); background: rgba(18,31,52,.55); border-radius: 10px; padding: 9px; }
.metric-box span { color: var(--muted-2); font-size: 9px; display: block; }
.metric-box b { font-family: var(--mono); font-size: 14px; display: block; margin-top: 4px; }
.placeholder { grid-column: 1 / -1; color: var(--muted); font-size: 11px; padding: 10px 0; }
.chart-card { border: 1px solid var(--line-soft); background: rgba(8,18,32,.55); border-radius: 12px; padding: 12px; min-height: 230px; }
.chart-legend { display: flex; gap: 15px; align-items: center; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.legend { width: 16px; height: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.legend.strategy { background: var(--teal); }
.legend.benchmark { background: #64748b; }
.equity-chart { height: 205px; }
.equity-chart svg { width: 100%; height: 100%; overflow: visible; }
.backtest-note { padding: 0 18px 16px; color: var(--muted-2); font-size: 10px; }
.footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: 10px; padding: 8px 2px 0; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(1,6,14,.62); z-index: 50; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 51; height: 100vh; width: min(470px, 94vw);
  background: #0b1728; border-left: 1px solid var(--line); box-shadow: -24px 0 60px rgba(0,0,0,.35);
  padding: 24px 20px 28px; overflow-y: auto;
}
.drawer-close { position: absolute; top: 14px; right: 16px; border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }
.drawer-head { padding-right: 30px; margin-bottom: 18px; }
.drawer-head h2 { margin: 8px 0 4px; font-size: 24px; }
.drawer-head p { margin: 0; color: var(--muted); font-size: 11px; }
.drawer-price { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.drawer-price b { font-family: var(--mono); font-size: 30px; }
.drawer-price span { font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.detail-item { border: 1px solid var(--line-soft); background: rgba(18,31,52,.6); border-radius: 9px; padding: 9px; }
.detail-item span { display: block; color: var(--muted-2); font-size: 9px; }
.detail-item b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; }
.score-block { margin-top: 18px; }
.score-block h3 { font-size: 12px; margin: 0 0 9px; color: #c6d5e7; }
.factor-row { display: grid; grid-template-columns: 52px 1fr 31px; gap: 8px; align-items: center; font-size: 10px; color: var(--muted); margin: 8px 0; }
.factor-track { height: 5px; background: #1b2a40; border-radius: 999px; overflow: hidden; }
.factor-track i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #2dd4bf); border-radius: inherit; }
.mini-chart { height: 95px; margin: 13px 0; }
.mini-chart svg { width: 100%; height: 100%; overflow: visible; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.note { color: var(--muted); font-size: 10px; line-height: 1.6; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 80; background: #13243c; border: 1px solid #2a4261; color: var(--text); font-size: 12px; border-radius: 10px; padding: 10px 15px; box-shadow: var(--shadow); }
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 15px; }
  .snapshot-chip, .btn-ghost { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 18px 15px; }
  .main { padding: 20px 15px 30px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; justify-content: flex-start; }
  .search { flex: 1; min-width: 160px; }
  .backtest-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 20px; }
  .hero h1 { font-size: 25px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* Live monitor */
.view[hidden] { display: none; }
.nav-tabs {
  display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line-soft);
  background: rgba(10, 22, 40, .72); border-radius: 11px;
}
.nav-tab {
  border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  padding: 7px 12px; font-size: 11px; font-weight: 650; transition: .16s ease;
}
.nav-tab:hover { color: var(--text); background: rgba(148, 163, 184, .08); }
.nav-tab.active { color: #dffcf7; background: rgba(13, 148, 136, .22); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .22); }
.nav-live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--green); margin-left: 3px; box-shadow: 0 0 0 3px rgba(52, 211, 153, .1); vertical-align: middle; }
.live-hero { align-items: center; }
.live-controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.live-status {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px;
  color: var(--muted); font-family: var(--mono); font-size: 10px; background: rgba(15,27,46,.72);
}
.live-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.live-status.ok { color: #b8f5e8; border-color: rgba(45,212,191,.25); }
.live-status.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.12); }
.live-status.error { color: #fecaca; border-color: rgba(248,113,113,.25); }
.live-status.error::before { background: var(--red); }
.live-indices { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
.live-panel { overflow: hidden; margin-bottom: 18px; }
.live-code-bar { display: flex; gap: 8px; align-items: center; }
.live-code-bar .search { width: 380px; }
.live-table { width: 100%; border-collapse: collapse; min-width: 940px; }
.live-table th {
  position: sticky; top: 0; z-index: 2; background: #0c192b; color: var(--muted-2);
  font-size: 10px; font-weight: 650; text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.live-table td { padding: 10px 11px; border-bottom: 1px solid rgba(30,48,74,.55); font-size: 11px; white-space: nowrap; }
.live-table tbody tr:hover { background: rgba(45,212,191,.045); }
.live-table .num { text-align: right; font-family: var(--mono); }
.live-stock { display: flex; align-items: center; gap: 8px; }
.live-stock b { font-size: 11px; }
.live-stock small { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 9px; margin-top: 2px; }
.mini-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 6px; padding: 4px 7px; font-size: 9px; }
.mini-btn:hover { color: var(--teal); border-color: rgba(45,212,191,.4); }
.live-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 18px; margin-bottom: 18px; }
.alerts-panel, .flow-screen-panel { overflow: hidden; min-width: 0; }
.alert-settings, .flow-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); background: rgba(8,18,32,.3); }
.alert-settings label, .flow-filters label { color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 5px; }
.alert-settings input, .flow-filters input, .flow-filters select {
  width: 68px; border: 1px solid var(--line); background: #0a1628; color: var(--text);
  border-radius: 7px; padding: 6px 7px; font-size: 10px; outline: none;
}
.flow-filters select { width: 55px; }
.alert-settings input:focus, .flow-filters input:focus { border-color: rgba(45,212,191,.5); }
.alert-feed { padding: 13px 18px; max-height: 370px; overflow-y: auto; }
.alert-item { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid rgba(30,48,74,.5); font-size: 10px; line-height: 1.45; }
.alert-item:last-child { border-bottom: 0; }
.alert-time { color: var(--muted-2); font-family: var(--mono); font-size: 9px; min-width: 50px; }
.alert-message { color: #c9d8e9; }
.alert-message b { color: var(--text); }
.alert-message.hot { color: #f6c76d; }
.alert-message.risk { color: #fca5a5; }
.live-note { color: var(--muted-2); font-size: 10px; line-height: 1.6; padding: 2px 2px 8px; }
.live-note code, .table-empty code { color: var(--teal); background: rgba(45,212,191,.07); border: 1px solid rgba(45,212,191,.13); border-radius: 4px; padding: 1px 4px; font-family: var(--mono); }
.screen-summary { color: var(--muted); font-size: 10px; padding: 0 18px 10px; }
@media (max-width: 1180px) {
  .live-grid { grid-template-columns: 1fr; }
  .nav-tabs { margin-left: auto; margin-right: 12px; }
}
@media (max-width: 900px) {
  .nav-tabs { order: 3; width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .topbar { height: auto; min-height: 74px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .live-code-bar { width: 100%; }
  .live-code-bar .search { width: 100%; }
  .live-indices { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .live-indices { grid-template-columns: 1fr; }
  .live-controls { justify-content: flex-start; }
}

/* iPhone / PWA */
html { -webkit-text-size-adjust: 100%; }
button, .nav-tab, .preset, .stock-table tbody tr { touch-action: manipulation; }
.table-wrap, .alert-feed, .drawer { -webkit-overflow-scrolling: touch; }
.install-hint {
  position: fixed; left: 12px; right: 12px; bottom: 18px; z-index: 75; display: none;
  align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1px solid rgba(45,212,191,.32); border-radius: 14px;
  background: rgba(9, 25, 39, .96); box-shadow: 0 18px 45px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
}
.install-hint div { display: grid; gap: 3px; }
.install-hint b { font-size: 12px; color: var(--teal); }
.install-hint span { color: var(--muted); font-size: 10px; }
.install-hint button { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 3px; }
@media (max-width: 900px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 64px; padding: 9px 14px; flex-wrap: nowrap; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .topbar-right { margin-left: auto; }
  .snapshot-chip, .btn-ghost { display: none; }
  .nav-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex;
    margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid rgba(129,160,198,.18); border-radius: 0;
    background: rgba(8, 18, 32, .96); backdrop-filter: blur(18px);
  }
  .nav-tab { flex: 1; padding: 10px 12px; font-size: 12px; border-radius: 9px; }
  .nav-tab.active { box-shadow: inset 0 0 0 1px rgba(45,212,191,.24); }
  .main { padding-bottom: 30px; }
  .install-hint { display: flex; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: 18px; }
  .hero { margin-bottom: 18px; }
  .hero h1 { margin-top: 5px; }
  .kpi { padding: 13px; }
  .kpi-value { font-size: 21px; }
  .panel-head { padding: 14px 15px; }
  .table-wrap { max-height: 56vh; }
  .live-hero { align-items: flex-start; }
  .live-controls { justify-content: flex-start; }
  .live-code-bar { flex-direction: column; align-items: stretch; }
  .live-code-bar .search { width: 100%; }
  .alert-settings, .flow-filters { padding: 11px 14px; }
  .alert-feed { padding: 10px 14px; max-height: 300px; }
  .drawer { width: 100vw; padding: 20px 16px calc(26px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: 8px; }
}
@media (max-width: 520px) {
  .topbar-right .btn-primary { padding: 8px 10px; font-size: 10px; }
  .live-indices { grid-template-columns: 1fr 1fr; }
  .live-indices .kpi:last-child { grid-column: 1 / -1; }
  .kpi-grid { gap: 9px; }
  .alert-settings label, .flow-filters label { width: calc(50% - 4px); justify-content: space-between; }
  .alert-settings input, .flow-filters input { width: 72px; }
}

.proxy-row {
  display: flex; gap: 8px; align-items: center; padding: 9px 18px;
  border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 10px;
}
.proxy-row span { min-width: 68px; }
.proxy-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: #0a1628; color: var(--text);
  border-radius: 8px; padding: 7px 9px; font-size: 10px; outline: none;
}
.proxy-row input:focus { border-color: rgba(45,212,191,.5); }
.proxy-row .btn { padding: 7px 9px; font-size: 10px; }

.mobile-scroll-hint { display: none; }
@media (max-width: 900px) {
  .mobile-scroll-hint {
    display: block; padding: 7px 15px; color: var(--muted-2); font-size: 9px;
    border-bottom: 1px solid var(--line-soft); background: rgba(18,31,52,.35);
  }
  .live-table { min-width: 0; width: 100%; }
  .live-table thead { display: none; }
  .live-table, .live-table tbody { display: block; width: 100%; }
  .live-table tbody { padding: 9px; }
  .live-table tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 10px;
    padding: 12px; margin-bottom: 9px; border: 1px solid var(--line-soft);
    border-radius: 12px; background: rgba(10, 21, 36, .72);
  }
  .live-table td {
    display: block; min-width: 0; padding: 0; border: 0; white-space: normal;
    text-align: left !important; font-size: 11px; line-height: 1.35;
  }
  .live-table td::before {
    content: attr(data-label); display: block; color: var(--muted-2);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
    font-size: 8px; font-weight: 500; margin-bottom: 3px;
  }
  .live-table td:first-child { grid-column: 1 / -1; }
  .live-table td:last-child { grid-column: 1 / -1; }
  .live-table td:last-child::before { display: none; }
  .live-table td:last-child .mini-btn { width: 100%; padding: 7px; }
  .flow-table tbody { padding: 9px; }
}
