:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-deep: #000000;
  --card: #0c0c0c;
  --card-inner: #111111;
  --border: rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.28);
  --text: #f7f7f8;
  --muted: #b4b4b9;
  --accent: #e8b86a;
  --accent-dim: rgba(232,184,106,0.22);
  --ok: #5ee884;
  --warn: #f0b429;
}
* { box-sizing: border-box; }
strong { font-weight: 650; color: #fff; }
body {
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(100% 55% at 50% -10%, rgba(255,255,255,0.045), transparent 50%),
    linear-gradient(180deg, var(--bg-deep), var(--bg));
  color: var(--text);
  margin: 0;
  padding: 1rem clamp(0.65rem, 1.5vw, 1.25rem) 2.25rem;
  line-height: 1.5;
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
.app-head {
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 0.95rem;
  margin-bottom: 1rem;
}
.app-head h1 {
  font-size: 1.4rem;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}
.app-head .sub {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}
h2.section {
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: none;
  margin: 1.35rem 0 0.5rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
h2.section:first-of-type { margin-top: 0.85rem; }
h2 { font-size: 1.05rem; font-weight: 620; margin: 1.25rem 0 0.5rem; color: #e8e8eb; }
.lead { color: var(--muted); font-size: 0.88rem; width: 100%; max-width: 100%; margin: 0.15rem 0 0.85rem; line-height: 1.62; }
.grid {
  display: grid;
  gap: 0.75rem 1rem;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  width: 100%;
  max-width: 100%;
}
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
input, select, button {
  font: inherit;
  padding: 0.45rem 0.58rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #080808;
  color: var(--text);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
button {
  background: linear-gradient(180deg, #f5d491, #c9953d);
  color: #0a0a0a;
  border-color: transparent;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
button.secondary { background: #161616; color: var(--text); box-shadow: none; border: 1px solid var(--border); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; width: 100%; max-width: 100%; }
.card {
  background: linear-gradient(170deg, var(--card) 0%, var(--card-inner) 70%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem 1.05rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.92);
}
.err { color: #f85149; font-size: 0.9rem; white-space: pre-wrap; }
.ok { color: var(--ok); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}
th, td { padding: 0.45rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
td { color: var(--text); }
th { color: #d8d8dc; font-weight: 600; letter-spacing: 0.015em; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: ui-monospace, monospace; font-size: 0.78rem; }
.scroll { overflow: auto; max-height: 22rem; border: 1px solid var(--border); border-radius: 6px; }
.scroll.wide { max-height: min(70vh, 48rem); overflow: auto; }
.scroll.wide.tx-journal {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.scroll.wide.tx-journal table {
  min-width: 72rem;
  width: max(100%, 72rem);
  font-size: 0.76rem;
  table-layout: auto;
}
.scroll.wide.tx-journal th,
.scroll.wide.tx-journal td {
  white-space: nowrap;
  vertical-align: top;
}
.scroll.wide.tx-journal td.tx-exec {
  white-space: normal;
  min-width: 16rem;
  max-width: 28rem;
  line-height: 1.45;
}
.muted-note { color: #c6c6cc; font-size: 0.76rem; line-height: 1.62; margin: 0.35rem 0 0.6rem; max-width: 100%; }
.muted { color: var(--muted); }
footer { margin-top: 1.5rem; font-size: 0.78rem; color: #bfbfbf; }
a { color: var(--accent); }
.pill { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; background: #222226; border: 1px solid var(--border); font-size: 0.75rem; margin-right: 0.35rem; }
.buy { color: var(--ok); }
.sell { color: #f85149; }
details.adv {
  margin: 0.5rem 0 0;
  padding: 0.58rem 0.82rem;
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  max-width: 100%;
}
details.adv > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  list-style-position: outside;
}
details.adv .adv-body { margin-top: 0.55rem; color: #c4c4ca; font-size: 0.82rem; line-height: 1.58; }
details.adv .adv-body p { margin: 0 0 0.45rem; }
details.adv .adv-body p:last-child { margin-bottom: 0; }
.inline-hint { font-size: 0.76rem; color: #c0c0c6; margin: 0.35rem 0 0; line-height: 1.58; }
.query-panel { margin-top: 0; }
.query-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
  width: 100%;
  margin-top: 0.35rem;
}
.query-row label.inline-field {
  flex-direction: row;
  align-items: center;
  gap: 0.38rem;
  flex: 1 1 auto;
  min-width: 7rem;
  margin: 0;
}
.query-row label.inline-field.sym-field { flex: 2 1 12rem; min-width: 10rem; }
.query-row label.inline-field .lbl {
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}
.query-row label.inline-field input { flex: 1 1 auto; min-width: 0; }
.query-row .query-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}
.query-row .query-actions button { margin-top: 0; white-space: nowrap; }
@media (max-width: 640px) {
  .query-row .query-actions { margin-left: 0; width: 100%; }
  .query-row .query-actions button { flex: 1 1 auto; }
}
.algo-desc-panel {
  margin-top: 0.65rem;
  padding: 0.55rem 0.72rem;
  border-radius: 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.58;
  color: #c8c8ce;
}
.algo-desc-panel p { margin: 0 0 0.4rem; }
.algo-desc-panel p:last-child { margin-bottom: 0; }
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.45rem;
  margin: 0.65rem 0 0.55rem;
}
.mini-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  min-height: 3.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
}
.mini-card .mc-label { font-size: 0.68rem; color: var(--muted); text-transform: none; letter-spacing: 0.02em; }
.mini-card .mc-val { font-size: 0.98rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.25; }
.mini-card .mc-sub { font-size: 0.68rem; color: #9b9ba3; font-variant-numeric: tabular-nums; }
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.result-meta .chip {
  display: inline-block;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: #dcdce2;
}

/* 顶栏导航 · 指标表 */
.head-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.85rem;
}
.head-wrap .brand {
  flex: 1 1 auto;
  min-width: min(14rem, 100%);
}
nav.head-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}
nav.head-nav a {
  white-space: nowrap;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.filter-bar label.inline-field {
  flex-direction: row;
  align-items: center;
  gap: 0.38rem;
  margin: 0;
}
.filter-bar input {
  flex: 1 1 14rem;
  min-width: 10rem;
  max-width: 28rem;
}
.scroll.ind-catalog {
  max-height: min(78vh, 52rem);
  margin-top: 0.65rem;
}
.ind-catalog table {
  min-width: 56rem;
  table-layout: auto;
}
.ind-catalog td {
  vertical-align: top;
}
.ind-catalog .col-name {
  white-space: nowrap;
  font-weight: 600;
}
.ind-catalog .cell-pre {
  white-space: pre-wrap;
  font-size: 0.78rem;
  line-height: 1.45;
}
.ind-catalog .mono-pre {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  line-height: 1.38;
  white-space: pre-wrap;
}

/* 个股指标 · 顶部信号汇总条 */
.ind-sum-card {
  margin-top: 0.55rem;
  padding: 0.62rem 0.72rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border);
}
.ind-sum-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.38rem;
  font-size: 0.9rem;
  color: #e8e8ee;
}
.ind-sum-head .rec-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}
.ind-sum-meta-n {
  font-size: 0.72rem;
  margin-left: 0.25rem;
}
.ind-sum-other-chip {
  font-size: 0.72rem;
  margin: 0;
}
.ind-sum-stats .pill.ind-sum-neutral {
  color: #c8c8d0;
  border-color: rgba(255, 255, 255, 0.16);
}

.ind-sum-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: center;
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  color: #c2c2ca;
}
.ind-sum-stats .stat-item strong {
  font-variant-numeric: tabular-nums;
  color: #f0f0f4;
}
.ind-signal-track {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: #141418;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: 0 0 0.45rem;
}
.ind-signal-track .seg {
  flex: 0 0 auto;
  min-width: 0;
  height: 100%;
  transition: width 0.2s ease;
}
.ind-signal-track .seg.ind-seg-buy {
  background: linear-gradient(180deg, rgba(90, 190, 145, 0.95), rgba(55, 140, 105, 0.88));
}
.ind-signal-track .seg.ind-seg-sell {
  background: linear-gradient(180deg, rgba(255, 110, 100, 0.95), rgba(200, 55, 60, 0.88));
}
.ind-signal-track .seg.ind-seg-hold {
  background: linear-gradient(180deg, rgba(120, 120, 135, 0.55), rgba(75, 75, 88, 0.5));
}
.ind-signal-track .seg.ind-seg-other {
  background: linear-gradient(180deg, rgba(180, 150, 80, 0.65), rgba(120, 95, 45, 0.55));
}
.ind-sum-rec {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #b8b8c2;
}
.ind-sum-rec .rec-lead {
  color: #dcdce4;
  font-weight: 500;
}
