:root {
  --black-1: #14100a;
  --black-2: #050403;
  --panel: #18130d;
  --panel-2: #211a10;
  --gold: #d9a93b;
  --gold-light: #f3d98b;
  --gold-deep: #9c6e15;
  --cream: #f3eedf;
  --muted: #a89877;
  --border-gold: rgba(217, 169, 59, 0.22);
  --up: #e2574c;
  --down: #3aa76d;
  --error: #e2574c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--black-1) 0%, var(--black-2) 340px, var(--black-2) 100%);
  min-height: 100vh;
  color: var(--cream);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header .logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
}

.app-header h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.refresh-btn, .add-btn {
  background: var(--panel-2);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.refresh-btn:active, .add-btn:active { background: var(--gold-deep); color: var(--black-1); }
.refresh-btn.loading { opacity: 0.6; pointer-events: none; }

.update-bar {
  padding: 0 16px 8px;
  font-size: 11px;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
}

.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  width: 100%;
}

.board-section {
  padding: 0 16px;
  min-width: 0;
}

.board-section h2 {
  font-size: 12px;
  color: var(--gold);
  margin: 0 0 6px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.section-head h2 { margin: 0; }

/* 密度优先：不用一张张卡片横向轮播（一屏只能看2-3个），
   改成竖排列表——一个区块共用一个边框面板，条目之间只用1px发丝线分隔，
   一屏能看到的行数明显更多，也更接近专业行情软件的观感而不是消费级App卡片墙 */
.quote-list {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  overflow: hidden;
}

.quote-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-gold);
}
.quote-row:last-child { border-bottom: none; }
.quote-row.clickable { cursor: pointer; }
.quote-row.clickable:active { background: var(--panel-2); }

.quote-row .q-main {
  flex: 1;
  min-width: 0;
}

.quote-row .q-name {
  font-size: 13px;
  color: var(--cream);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.quote-row .q-code {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.quote-row svg.sparkline { flex: 0 0 auto; display: block; }
.quote-row svg.sparkline path.line { fill: none; stroke-width: 1.4; }
.quote-row svg.sparkline path.line.up { stroke: var(--up); }
.quote-row svg.sparkline path.line.down { stroke: var(--down); }
.quote-row svg.sparkline path.line.flat { stroke: var(--muted); }

.quote-row .q-nums {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 72px;
}

.quote-row .q-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.3;
}

.quote-row .q-change {
  font-size: 11px;
  line-height: 1.3;
}

.quote-row .q-change.up { color: var(--up); }
.quote-row .q-change.down { color: var(--down); }
.quote-row .q-change.flat { color: var(--muted); }

.quote-row.error .q-price { color: var(--muted); font-size: 12px; font-weight: 500; }

.quote-row .del-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 3, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}

.modal h3 {
  margin: 0 0 14px;
  color: var(--gold-light);
  font-size: 16px;
}

.modal label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal select, .modal input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  background: var(--black-1);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  color: var(--cream);
  font-size: 14px;
}

.modal-error {
  color: var(--error);
  font-size: 12px;
  min-height: 16px;
  margin: 0 0 8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary, .btn-secondary, .btn-danger {
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid var(--border-gold);
  cursor: pointer;
}

.btn-primary { background: var(--gold); color: var(--black-1); font-weight: 600; }
.btn-secondary { background: var(--panel-2); color: var(--cream); }
.btn-danger { background: var(--up); color: var(--cream); border-color: var(--up); }

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 10px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 3, 0.85);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.detail-overlay.hidden { display: none; }

.detail-panel {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 14px 16px 20px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.detail-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-light);
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.detail-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
}

.detail-change { font-size: 13px; }
.detail-change.up { color: var(--up); }
.detail-change.down { color: var(--down); }
.detail-change.flat { color: var(--muted); }

.detail-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.tab-btn {
  flex: 1;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 8px 0;
  font-size: 13px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--gold);
  color: var(--black-1);
  font-weight: 600;
  border-color: var(--gold);
}

.detail-chart {
  margin-top: 16px;
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-hint {
  color: var(--muted);
  font-size: 13px;
}

.ai-card {
  margin-top: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 12px;
}
.ai-card.hidden { display: none; }

.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ai-badge {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-confidence {
  font-size: 11px;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
  background: var(--black-1);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 2px 7px;
}

.ai-verdict-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.verdict-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.verdict-dot.bullish { background: var(--up); }
.verdict-dot.bearish { background: var(--down); }
.verdict-dot.neutral { background: var(--muted); }

.verdict-text {
  font-size: 17px;
  font-weight: 700;
}
.verdict-text.bullish { color: var(--up); }
.verdict-text.bearish { color: var(--down); }
.verdict-text.neutral { color: var(--cream); }

.ai-summary {
  font-size: 13px;
  color: var(--cream);
  margin-bottom: 10px;
}

.ai-position-line {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 10px;
}

.ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.ai-grid .grid-item { display: flex; justify-content: space-between; }
.ai-grid .grid-label { color: var(--muted); }
.ai-grid .grid-value { color: var(--cream); font-weight: 600; }
.ai-grid .grid-value.up { color: var(--up); }
.ai-grid .grid-value.down { color: var(--down); }

.ai-narrative {
  font-size: 13px;
  color: var(--cream);
  line-height: 1.6;
  margin-bottom: 10px;
}

.ai-signals { margin-bottom: 8px; }
.signal-line {
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--cream);
}
.signal-line::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.signal-line.bull::before { background: var(--up); }
.signal-line.risk::before { background: var(--gold); }

.moneyflow-detail {
  font-size: 11px;
  color: var(--muted);
  margin: -1px 0 6px 13px;
  font-variant-numeric: tabular-nums;
}

.ai-edit-position {
  background: none;
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.ai-disclaimer {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  text-align: right;
}

.detail-chart svg { width: 100%; height: 220px; display: block; }
.detail-chart .kline-line { fill: none; stroke: var(--gold-light); stroke-width: 1.5; }
.detail-chart .kline-axis-label { fill: var(--muted); font-size: 9px; }
.detail-chart .candle-wick { stroke-width: 1; }
.detail-chart .candle-wick.up { stroke: var(--up); }
.detail-chart .candle-wick.down { stroke: var(--down); }
.detail-chart .candle-body.up { fill: var(--up); }
.detail-chart .candle-body.down { fill: var(--down); }
