:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-soft: #F3EFE6;
  --border: #E2DAC8;
  --ink: #1E1D1A;
  --muted: #5C584F;
  --brand: #1F6E43;
  --brand-dark: #154E2F;
  --red-ink: #991B1B;
  --red-bg: #FEE2E2;
  --red-border: #FCA5A5;
  --yellow-ink: #92400E;
  --yellow-bg: #FEF3C7;
  --yellow-border: #FCD34D;
  --green-ink: #166534;
  --green-bg: #DCFCE7;
  --green-border: #86EFAC;
  --blue-ink: #1E40AF;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(30, 29, 26, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

.app-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 14px 36px;
}

/* 顶部栏 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: 0.3px;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.btn-outline {
  border: 1.5px solid var(--brand);
  background: var(--surface);
  color: var(--brand-dark);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
}

.btn-outline:active {
  background: var(--surface-soft);
}

/* 红黄绿大结论卡片 */
.signal-card {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.signal-card.red {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-ink);
}

.signal-card.yellow {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
  color: var(--yellow-ink);
}

.signal-card.green {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green-ink);
}

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

.signal-badge {
  font-size: 16px;
  font-weight: 800;
}

.signal-headline {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.35;
}

.signal-reason {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.6;
}

.btn-speak {
  border: 1.5px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
}

/* 通用白卡 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* 调节价格器 */
.price-adjust {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.price-label {
  font-size: 16px;
  font-weight: 700;
}

.price-main {
  font-size: 21px;
  font-weight: 800;
  color: var(--brand-dark);
}

.price-jin {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.stepper-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-step {
  width: 48px;
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-step:active {
  background: #E7E0CF;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
  height: 28px;
}

.btn-save {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.btn-save:active {
  background: var(--brand-dark);
}

/* 4格指标卡 */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.kpi-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.kpi-value.warn { color: var(--red-ink); }
.kpi-value.good { color: var(--green-ink); }

/* SVG 图表 */
.chart-wrap {
  width: 100%;
  overflow: hidden;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-caption {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* 行情条目 */
.quote-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-radius: 12px;
}

.quote-name {
  font-weight: 700;
  font-size: 16px;
}

.quote-meta {
  font-size: 13px;
  color: var(--muted);
}

.quote-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-dark);
  text-align: right;
  white-space: nowrap;
}

/* 问答对话（豆包简明风） */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.q-chip {
  border: 1.5px solid var(--brand);
  background: #EFF7F2;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.bubble {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.bubble-user {
  align-self: flex-end;
  background: var(--brand);
  color: #FFFFFF;
  max-width: 88%;
}

.bubble-ai {
  align-self: flex-start;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--ink);
  width: 100%;
}

.bubble-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}

.ask-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ask-input {
  flex: 1;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
}

.btn-send {
  min-width: 74px;
  min-height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-mic {
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #1F6E43, #15803D);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(31, 110, 67, 0.25);
}

.btn-mic.recording {
  background: #B91C1C;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.35);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* 顶部吸顶三大页签（绝不遮挡底部录音或滑块按钮） */
.top-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin: 0 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 4px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
}

.nav-btn.active {
  background: var(--brand);
  color: #FFFFFF;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* PIN 锁屏 */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pin-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: center;
}

.pin-input {
  width: 100%;
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  margin: 12px 0;
}

.status-banner {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--blue-ink);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.hidden { display: none !important; }
