:root {
  --green: #0f8a5f;
  --green-dark: #0a6e4b;
  --gold: #d9a441;
  --up: #e0483e;    /* 涨-红 */
  --down: #12a150;  /* 跌-绿 */
  --flat: #9aa0a6;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1f2933;
  --text-sub: #6b7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

/* 顶部 */
.header {
  background: linear-gradient(135deg, #0a6e4b, #0f8a5f 55%, #17a06e);
  color: #fff;
  padding: 24px 18px 14px;
  position: relative;
}
.header .title { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.header .sub { font-size: 13px; opacity: .85; margin-top: 6px; }
.header .date-badge {
  position: absolute; right: 18px; top: 24px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
}

/* 分类切换: 下划线标签 (贴在绿色头部内) */
.tabs {
  display: flex; gap: 30px; margin-top: 20px;
  overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 7px 1px 12px;
  font-size: 18px; font-weight: 500; color: rgba(255,255,255,.74);
  cursor: pointer; transition: color .2s; user-select: none;
}
.tab.active { color: #fff; font-weight: 600; }
.tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; border-radius: 3px; background: var(--gold);
  box-shadow: 0 1px 6px rgba(217,164,65,.55);
}

/* 内容 */
.section { padding: 14px; }
.section-title { font-size: 13px; color: var(--text-sub); margin: 6px 2px 10px; }
.card {
  background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  display: flex; align-items: center; justify-content: space-between;
}
.card .left .name { font-size: 16px; font-weight: 600; }
.card .left .unit { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.card .right { text-align: right; }
.card .price { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-tag {
  font-size: 11px; font-weight: 400; color: var(--text-sub);
  margin-right: 4px; vertical-align: 2px;
}
.card .chg { font-size: 13px; margin-top: 4px; }
.up .price, .up .chg { color: var(--up); }
.down .price, .down .chg { color: var(--down); }
.flat .price, .flat .chg { color: var(--flat); }

.empty { text-align: center; color: var(--text-sub); padding: 40px 0; font-size: 14px; }

/* 我的订阅 复选框 */
.check-row {
  background: var(--card); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.03);
}
.check-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); flex-shrink: 0; }
.check-row .info { flex: 1; }
.check-row .info .name { font-size: 15px; font-weight: 600; }
.check-row .info .unit { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.check-row .price { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.check-row.up .price { color: var(--up); }
.check-row.down .price { color: var(--down); }
.check-row.flat .price { color: var(--flat); }

/* 按钮与底部 */
.btn-save {
  /* 吸附在底部导航栏之上 (导航高约 58px), 避免被遮挡 */
  position: sticky; bottom: calc(74px + env(safe-area-inset-bottom));
  display: block; width: calc(100% - 28px); margin: 8px 14px 0; z-index: 9;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff; border: none; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(15,138,95,.3); cursor: pointer;
}
.btn-save:active { transform: scale(.98); }

.tip { background: #fff8e8; border: 1px solid #f0dfae; color: #8a6d1a; border-radius: 12px; padding: 12px 14px; margin: 0 2px 14px; font-size: 13px; line-height: 1.6; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #eceff1;
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 10;
}
.bottom-nav a { flex: 1; text-align: center; color: var(--text-sub); text-decoration: none; font-size: 13px; }
.bottom-nav a.active { color: var(--green-dark); font-weight: 600; }
.bottom-nav a .ic { font-size: 20px; display: block; line-height: 1; margin-bottom: 2px; }
body.has-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 14px; z-index: 99; display: none;
}

/* 可点击卡片 */
a.card { text-decoration: none; color: inherit; }

/* 走势页 */
.back { position: absolute; left: 14px; top: 20px; color: #fff; font-size: 28px; text-decoration: none; line-height: 1; }
.trend-title { padding-left: 34px; }
.chips { display: flex; overflow-x: auto; gap: 8px; padding: 12px 14px; background: #fff; white-space: nowrap; }
.chip { flex-shrink: 0; padding: 7px 14px; border-radius: 999px; background: #eef2f0; color: #4b5563; font-size: 13px; cursor: pointer; }
.chip.active { background: #0a6e4b; color: #fff; }
.chart-wrap { padding: 14px; }
#chart { width: 100%; height: 340px; background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
