/* +1的奇妙冒险 · 全局样式 (复用 mockup 的设计 token) */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

:root {
  --bg: #FAFAF7;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #999999;
  --line: rgba(0,0,0,0.06);
  --line-strong: rgba(0,0,0,0.12);
  --moss: #2F3E2D;
  --moss-soft: #E5EBDD;
  --gold: #A88251;
  --gold-soft: rgba(168,130,81,0.1);
  --danger: #C24C3D;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: "Inter", -apple-system, "SF Pro Display", "PingFang SC", sans-serif;
  color: var(--ink);
  font-feature-settings: "ss01", "cv11", "tnum";
  overflow: hidden;
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; -webkit-appearance: none; appearance: none; }
a { color: inherit; text-decoration: none; }

#root {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 481px) {
  body { background: #ECE9E2; }
  #root { box-shadow: 0 0 60px rgba(0,0,0,0.08); }
}

/* === 通用 === */
.page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-top);
}
.page-scroll { flex: 1; overflow-y: auto; padding: 0 22px 100px; }
.page-scroll::-webkit-scrollbar { display: none; }

.page-head {
  padding: 14px 22px 12px;
  display: flex; align-items: center; gap: 12px;
}
.page-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.page-title-row { flex: 1; min-width: 0; }
.page-eyebrow { font-size: 9px; color: var(--ink-3); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; margin-bottom: 2px; }
.page-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }

.greeting { font-size: 28px; font-weight: 700; letter-spacing: -0.7px; line-height: 1.1; padding: 16px 22px 4px; }
.greeting .gold-dot { color: var(--gold); }
.sub-meta { font-size: 10px; color: var(--ink-3); letter-spacing: 1.4px; font-weight: 600; padding: 0 22px; margin-bottom: 24px; text-transform: uppercase; }

/* === 卡片 === */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.card + .card { margin-top: 8px; }
.card-pinned {
  border-color: rgba(168,130,81,0.25);
  background: linear-gradient(180deg, rgba(168,130,81,0.05), rgba(168,130,81,0.02));
}

.section { margin-bottom: 22px; }
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px;
  margin-bottom: 12px;
}
.section-title { font-size: 11px; color: var(--ink); font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; }
.section-action { font-size: 11px; color: var(--gold); font-weight: 600; letter-spacing: 0.2px; }

/* === 按钮 === */
.btn {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--ink); color: white; }
.btn-gold { background: var(--gold); color: white; }
.btn-soft { background: white; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-danger { background: white; color: var(--danger); border: 1px solid var(--line-strong); }
.btn-block { display: flex; width: 100%; padding: 13px; font-size: 13px; }
.btn:active { opacity: 0.85; }

/* === 输入 === */
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: white;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--gold); }
.input-block + .input-block { margin-top: 10px; }
.label-text { font-size: 11px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.3px; margin-bottom: 6px; display: block; }

/* === 待办 === */
.todo-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.todo-row + .todo-row { margin-top: 6px; }
.todo-row.done { opacity: 0.55; }
.todo-row.done .todo-title { text-decoration: line-through; }
.todo-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.6px solid var(--line-strong);
  background: white;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}
.todo-check::after {
  content: "✓";
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 11px; font-weight: 700;
  opacity: 0;
}
.todo-row.done .todo-check {
  background: var(--moss);
  border-color: var(--moss);
}
.todo-row.done .todo-check::after { opacity: 1; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.1px; margin-bottom: 2px; }
.todo-sub { font-size: 10.5px; color: var(--ink-3); }
.todo-action {
  background: var(--ink); color: white;
  padding: 5px 10px; border-radius: 8px;
  font-size: 10.5px; font-weight: 600;
}
.todo-action.gold { background: var(--gold); }
.todo-action.soft { background: white; color: var(--ink-2); border: 1px solid var(--line-strong); }
.todo-del {
  font-size: 14px; color: var(--ink-3); padding: 4px;
}

/* === 清单卡片 === */
.cl-card {
  display: block;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
}
.cl-card + .cl-card { margin-top: 8px; }
.cl-card.pinned {
  border-color: rgba(168,130,81,0.25);
  background: linear-gradient(180deg, rgba(168,130,81,0.05), rgba(168,130,81,0.02));
}
.cl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.cl-title-row { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.cl-pin { color: var(--gold); font-size: 11px; }
.cl-title { font-size: 14px; font-weight: 600; letter-spacing: -0.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-progress { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cl-bar { width: 44px; height: 4px; background: rgba(0,0,0,0.06); border-radius: 2px; overflow: hidden; }
.cl-fill { display: block; height: 100%; background: var(--moss); border-radius: 2px; transition: width 0.3s; }
.cl-card.pinned .cl-fill { background: var(--gold); }
.cl-progress-text { font-size: 10px; color: var(--ink-2); font-weight: 600; min-width: 28px; text-align: right; }
.cl-desc { font-size: 11px; color: var(--ink-3); }

.cl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.cl-item:first-child { border-top: none; }
.cl-item.done { opacity: 0.55; }
.cl-item.done .cl-item-title { text-decoration: line-through; }
.cl-mark {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.6px solid var(--line-strong);
  background: white;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}
.cl-mark::after {
  content: "✓";
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white; font-size: 10px; font-weight: 700; opacity: 0;
}
.cl-item.done .cl-mark { background: var(--moss); border-color: var(--moss); }
.cl-item.done .cl-mark::after { opacity: 1; }
.cl-item-title { flex: 1; font-size: 13px; }
.cl-cat-head {
  font-size: 10px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.5px;
  padding: 14px 0 6px; text-transform: uppercase;
}
.cl-cat-head:first-child { padding-top: 4px; }

/* === Tab bar === */
.tabbar {
  position: absolute;
  bottom: max(14px, var(--safe-bottom));
  left: 16px; right: 16px;
  background: var(--ink);
  border-radius: 100px;
  padding: 8px;
  display: flex; justify-content: space-around;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-width: 448px;
  margin: 0 auto;
  z-index: 20;
}
.tab {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: rgba(255,255,255,0.45);
}
.tab.active { background: white; color: var(--ink); }
.tab svg { width: 18px; height: 18px; }

/* === 行程列表 === */
.trip-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
}
.trip-card + .trip-card { margin-top: 10px; }
.trip-card.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.trip-card-eyebrow { font-size: 10px; letter-spacing: 1.5px; opacity: 0.6; font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.trip-card-name { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.trip-card-dates { font-size: 11px; opacity: 0.7; letter-spacing: 0.5px; margin-bottom: 12px; }
.trip-card-foot { display: flex; gap: 14px; font-size: 11px; opacity: 0.7; }
.trip-card.active .trip-card-eyebrow { color: var(--gold); opacity: 1; }

.trip-new {
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
}

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 18px 20px max(28px, var(--safe-bottom));
  animation: slide-up 0.2s ease-out;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 36px; height: 4px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
  margin: 0 auto 12px;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; letter-spacing: -0.3px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

/* === Toast === */
.toast {
  position: fixed;
  left: 50%; bottom: 80px;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12px;
  z-index: 200;
  white-space: pre-line; text-align: center;
  max-width: 280px;
  animation: toast-in 0.2s;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* === Loading === */
.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.empty .empty-emoji { font-size: 28px; opacity: 0.6; margin-bottom: 8px; }

/* === 登录页 === */
.auth-page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 32px 24px max(24px, var(--safe-bottom));
  padding-top: max(60px, calc(var(--safe-top) + 60px));
}
.auth-logo { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; margin-bottom: 6px; }
.auth-logo .gold { color: var(--gold); }
.auth-tag { font-size: 12px; color: var(--ink-3); letter-spacing: 0.4px; margin-bottom: 32px; }
.auth-form { flex: 1; }
.auth-toggle {
  display: flex; gap: 4px; background: rgba(0,0,0,0.04);
  padding: 4px; border-radius: 12px; margin-bottom: 22px;
}
.auth-toggle button {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-3);
}
.auth-toggle button.active { background: white; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.auth-error { color: var(--danger); font-size: 12px; padding: 10px; background: rgba(194,76,61,0.08); border-radius: 10px; margin-top: 10px; }

/* === Date chips === */
.date-chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 0 22px 8px;
  margin-bottom: 16px;
}
.date-chips::-webkit-scrollbar { display: none; }
.date-chip {
  flex-shrink: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 10px;
  text-align: center;
  min-width: 48px;
}
.date-chip .day-name { font-size: 9px; color: var(--ink-3); letter-spacing: 1px; font-weight: 600; margin-bottom: 1px; }
.date-chip .day-num { font-size: 14px; font-weight: 700; }
.date-chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.date-chip.active .day-name { color: white; }

/* === 分账 === */
.balance-card {
  background: linear-gradient(135deg, var(--ink), #2c2c2c);
  color: white;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}
.balance-total { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.balance-label { font-size: 11px; opacity: 0.7; letter-spacing: 0.4px; }
.settle-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.settle-row:first-of-type { border-top: 1px solid rgba(255,255,255,0.15); margin-top: 14px; padding-top: 14px; }
.settle-from { color: rgba(255,255,255,0.85); }
.settle-arrow { color: var(--gold); font-weight: 700; }
.settle-to { color: white; font-weight: 600; flex: 1; }
.settle-amt { color: var(--gold); font-weight: 700; font-feature-settings: "tnum"; }

/* === 地点 === */
.spot-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.spot-row + .spot-row { margin-top: 6px; }
.spot-row.starred { border-color: rgba(168,130,81,0.3); background: rgba(168,130,81,0.03); }
.spot-row.visited { opacity: 0.7; }
.spot-info { flex: 1; min-width: 0; }
.spot-name-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.spot-star-icon { color: var(--gold); font-size: 12px; }
.spot-visited {
  background: var(--moss); color: white;
  font-size: 9px; padding: 1px 6px; border-radius: 6px;
  letter-spacing: 0.3px; font-weight: 600;
}
.spot-name { font-size: 13.5px; font-weight: 600; letter-spacing: -0.1px; }
.spot-cat { font-size: 11px; color: var(--moss); margin-bottom: 2px; font-weight: 500; }
.spot-addr { font-size: 10.5px; color: var(--ink-3); }
.spot-star-btn {
  font-size: 18px; padding: 4px 8px;
  color: var(--gold); flex-shrink: 0;
}

/* 高德搜索结果 */
.amap-results {
  max-height: 40vh;
  overflow-y: auto;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,0.02);
}
.amap-results:empty { display: none; }
.amap-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.amap-item:last-child { border-bottom: none; }
.amap-item:active { background: rgba(168,130,81,0.08); }
.amap-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; letter-spacing: -0.1px; }
.amap-addr { font-size: 11px; color: var(--ink-3); }

.expense-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.expense-row + .expense-row { margin-top: 6px; }
.exp-body { flex: 1; min-width: 0; }
.exp-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.exp-meta { font-size: 10.5px; color: var(--ink-3); }
.exp-amount { font-size: 14px; font-weight: 700; color: var(--gold); font-feature-settings: "tnum"; flex-shrink: 0; }
