:root {
  --primary: #1b6ef3;
  --primary-dark: #0f56c7;
  --danger: #e23c3c;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1f2430;
  --text-2: #5a6472;
  --text-3: #8a93a3;
  --border: #e6e9ef;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .05);
  --tabbar-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

#app { max-width: 560px; margin: 0 auto; padding: 0 14px; }
.view { display: none; padding-top: 12px; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 页头 */
.hero { padding: 18px 4px 6px; }
.hero h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.hero .sub, .page-head .sub, .foot-note { color: var(--text-2); font-size: 13px; margin: 4px 0 0; }
.page-head { padding: 14px 4px 8px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; }
.page-head .sub { margin-top: 2px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 10px 0;
}
.sec-title { margin: 4px 0 12px; font-size: 15px; color: var(--primary); font-weight: 700; }
.sec-title + .sec-title { margin-top: 18px; }

/* 表单 */
.form { padding: 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-style: normal; font-weight: 400; color: var(--text-3); font-size: 12px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
input[type=text], input[type=number], input[type=time], select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; color: var(--text); background: #fbfcfe; outline: none;
}
input:focus, select:focus { border-color: var(--primary); background: #fff; }
.geo-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; }
.geo-status { font-size: 12px; color: var(--text-3); flex: 1; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.switch-row .hint { font-size: 12px; color: var(--text-3); display: block; }
.switch-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-block { width: 100%; padding: 13px; margin-top: 6px; font-size: 16px; }
.btn-mini { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { color: var(--danger); border-color: #f3c6c6; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0; }

/* 规划列表 */
.summary { background: linear-gradient(135deg, #eef4ff, #f6f9ff); border: 1px solid #dbe8ff; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.plan-list { margin-top: 6px; }
.plan-row {
  display: flex; gap: 12px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 14px; margin: 10px 0; align-items: flex-start;
}
.plan-time { flex: 0 0 78px; font-weight: 700; font-size: 13px; color: var(--primary); padding-top: 2px; }
.plan-body { flex: 1; }
.plan-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.plan-stars { font-size: 13px; color: #e0800a; margin-top: 2px; }
.plan-stars .score, .gold-item .score, .week-km { color: var(--text-3); font-size: 12px; }
.plan-strategy { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.plan-km { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.plan-nonwork { border-left: 3px solid #c7cdd6; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.b-hot { background: #fde3e3; color: #c22020; }
.b-warm { background: #fff0dc; color: #c9740a; }
.b-cool { background: #e6f2fd; color: #1b6ef3; }
.b-supply { background: #e1f7ec; color: #158a53; }
.b-meal { background: #fff0dc; color: #c9740a; }
.b-end { background: #eef0f3; color: #5a6472; }
.b-week { background: #eef4ff; color: #1b6ef3; }

.legend-box { font-size: 13px; }
.legend-box > * { vertical-align: middle; }

/* 周卡片 */
.week-card { padding: 14px 16px; }
.week-head { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 6px; }
.week-theme { font-size: 13px; color: var(--text-2); }
.week-gold { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.gold-item { font-size: 13px; margin: 3px 0; }
.gold-time { font-weight: 700; color: var(--primary); display: inline-block; min-width: 82px; }
.week-km { margin-top: 6px; }

/* 空态 */
.empty { text-align: center; color: var(--text-3); padding: 60px 20px; font-size: 14px; }

/* 我的 */
.hist-item { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.hist-item:last-child { border-bottom: none; }
.muted { color: var(--text-3); }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); height: var(--tabbar-h);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: none; background: none; cursor: pointer;
  font-size: 11px; color: var(--text-3); transition: color .15s;
}
.tab .ico { font-size: 20px; line-height: 1; }
.tab.on { color: var(--primary); font-weight: 600; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); transform: translateX(-50%);
  background: rgba(20, 24, 32, .92); color: #fff; padding: 10px 18px; border-radius: 24px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200; max-width: 80%;
}
#toast.show { opacity: 1; }

/* 高德在线地图与 POI */
.map-card { padding: 8px; }
.route-status { margin-top: 8px; font-size: 12px; color: var(--text-2); text-align: center; }
.plan-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: 0 0 auto; }
.poi-slot { margin-top: 6px; font-size: 12px; border-top: 1px dashed var(--border); padding-top: 6px; }
.poi-item { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.poi-name { color: var(--text); }
.field-row-weather { align-items: flex-end; }
.field-row-weather .field { flex: 1; }

/* 密钥提示条 */
.key-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff8e6; border: 1px solid #f3dc9a; }
.key-banner-text { font-size: 13px; color: #8a6d1a; flex: 1; }

/* 现在推荐卡片 */
.now-card { background: linear-gradient(135deg, #fff4f4, #fff8f0); border: 1px solid #f6cfc5; }
.now-label { font-size: 13px; font-weight: 700; color: #c22020; margin-bottom: 6px; }
.now-body { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.now-body strong { font-size: 16px; }
.now-strategy { font-size: 13px; color: var(--text-2); }

/* 和风诊断 */
.qw-diag { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f6f8fa; font-size: 12px; line-height: 1.5; }

/* 示意图模式切换 tab */
.map-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.map-tab { flex: 1; padding: 8px 0; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-2); font-size: 14px; color: var(--text-2); cursor: pointer; }
.map-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* 商圈热力图 */
.heatmap-wrap { display: flex; flex-direction: column; gap: 10px; }
.rank-box { padding: 12px; }
.rank-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-no { width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: #eee; font-size: 11px; color: #666; flex: 0 0 auto; }
.rank-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rank-name { flex: 1; font-size: 13px; color: var(--text); }
.rank-score { font-size: 13px; font-weight: 700; flex: 0 0 auto; }

/* 开源引用 */
.credit-list { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--text-2); line-height: 1.8; }
