/* 一路 — 拾取沿途
   Paper / ink / vermilion. No build step, no framework. */

:root {
  --paper: #f4efe4;
  --paper-2: #fbf7ee;
  --paper-3: #efe8d9;
  --ink: #17323a;
  --ink-soft: #4d6064;
  --ink-faint: #8a9799;
  --red: #c0392b;
  --red-soft: rgba(192, 57, 43, 0.1);
  --ochre: #c79a3e;
  --line: rgba(23, 50, 58, 0.13);
  --line-strong: rgba(23, 50, 58, 0.28);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(23, 50, 58, 0.05), 0 8px 24px -12px rgba(23, 50, 58, 0.25);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px 120px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--paper) 78%, rgba(244, 239, 228, 0));
  z-index: 20;
}
.topbar .mark { width: 30px; height: 30px; flex: 0 0 auto; }
.brand {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.16em;
  font-weight: 600;
}
.brand small {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  margin-top: 1px;
  font-weight: 400;
}
.topbar .spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.5); border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 27px; letter-spacing: 0.02em; }
h2 { font-size: 18px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--ink);
  color: var(--paper-2);
  border-color: var(--ink);
}
.btn--red {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn--ghost { border-color: var(--line); color: var(--ink-soft); }
.btn--sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--icon { width: 42px; padding: 0; }
.btn svg { width: 16px; height: 16px; }

/* ---------- cards ---------- */
.sheet {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }

/* ---------- list ---------- */
.hero {
  padding: 10px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: 0.04em; }
.hero p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
  max-width: 30em;
}

.trip-list { display: flex; flex-direction: column; gap: 12px; }

.trip-card {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.trip-card::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  opacity: 0.85;
}
.trip-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.trip-card .glyph {
  width: 46px; height: 46px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--paper-3);
  display: grid;
  place-items: center;
  font-size: 22px;
}
.trip-card .meta { min-width: 0; flex: 1; }
.trip-card .name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-card .sub {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.trip-card .sub span { display: inline-flex; align-items: center; gap: 4px; }
.dot::before { content: "·"; margin-right: 6px; color: var(--ink-faint); }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-soft);
}
.empty p { margin: 0 0 16px; font-size: 14px; line-height: 1.7; }

/* ---------- trip header ---------- */
.trip-head { padding: 4px 0 18px; }
.trip-head h1 { font-size: 30px; line-height: 1.2; }
.trip-head .facts {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.trip-head .facts b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.daytabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 14px;
  position: sticky;
  top: 62px;
  background: linear-gradient(var(--paper) 80%, rgba(244, 239, 228, 0));
  z-index: 15;
  scrollbar-width: none;
}
.daytabs::-webkit-scrollbar { display: none; }
.daytab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 6px;
  transition: all 0.15s;
}
.daytab b { font-family: var(--serif); font-size: 14px; }
.daytab[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-2);
}

.day-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 6px 0 12px;
}
.day-title .t { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.day-title .d { font-size: 12px; color: var(--ink-faint); }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(var(--line-strong), rgba(23, 50, 58, 0.05));
}
.item {
  position: relative;
  padding: 0 0 14px;
  animation: rise 0.24s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.item::before {
  content: "";
  position: absolute;
  left: -24px; top: 14px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
}
.item--done::before { background: var(--ochre); border-color: var(--ochre); }
.item-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.item-card:hover { border-color: var(--line-strong); }
.item-top { display: flex; align-items: baseline; gap: 10px; }
.item-time {
  font-size: 12px;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
  min-width: 42px;
}
.item-title { font-size: 15px; font-weight: 500; flex: 1; min-width: 0; }
.item--done .item-title { text-decoration: line-through; color: var(--ink-faint); }
.item-cost { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.item-sub {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--ink-faint);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-3);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.chip--map { background: var(--red-soft); color: var(--red); cursor: pointer; }
.chip--note { background: transparent; padding: 0; color: var(--ink-faint); }

.item-actions {
  display: flex;
  gap: 4px;
  margin-top: 9px;
  opacity: 0.75;
}
.item-actions button {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.item-actions button:hover { background: var(--paper-3); color: var(--ink); }
.item-actions .danger:hover { color: var(--red); background: var(--red-soft); }

.add-line {
  padding-left: 0;
  margin-top: 2px;
}

/* ---------- summary cards ---------- */
.cards { display: grid; gap: 12px; margin-top: 22px; align-items: start; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }

.budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.budget-row:last-child { border-bottom: none; }
.budget-row .bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--paper-3);
  overflow: hidden;
}
.budget-row .bar i { display: block; height: 100%; background: var(--ochre); border-radius: 2px; }
.budget-row .amt { font-variant-numeric: tabular-nums; color: var(--ink-soft); min-width: 62px; text-align: right; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.check:last-child { border-bottom: none; }
.check .box {
  width: 17px; height: 17px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.check[data-done="1"] .box { background: var(--ink); border-color: var(--ink); }
.check[data-done="1"] .box::after { content: ""; width: 8px; height: 4px; border-left: 1.5px solid var(--paper); border-bottom: 1.5px solid var(--paper); transform: rotate(-45deg) translateY(-1px); }
.check[data-done="1"] .txt { text-decoration: line-through; color: var(--ink-faint); }
.check .txt { flex: 1; }

/* ---------- bottom dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(724px, calc(100% - 36px));
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(251, 247, 238, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 32px -16px rgba(23, 50, 58, 0.4);
  z-index: 40;
}
.dock .btn { flex: 1; }
.dock .btn--icon { flex: 0 0 42px; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(23, 50, 58, 0.38);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fade 0.18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 640px) { .modal-back { align-items: center; } }

.modal {
  background: var(--paper);
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 22px 22px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  animation: slideup 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@media (min-width: 640px) { .modal { border-radius: 24px; padding-bottom: 24px; } }
@keyframes slideup { from { transform: translateY(18px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal h2 { margin-bottom: 4px; }
.modal .hint { font-size: 12px; color: var(--ink-faint); margin: 0 0 18px; line-height: 1.6; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 11px;
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(23, 50, 58, 0.06);
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
.field .pair { display: flex; gap: 10px; }
.field .pair > * { flex: 1; }
.field .sub { font-size: 11px; color: var(--ink-faint); margin-top: 5px; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ---------- poster ---------- */
.poster-wrap { display: grid; gap: 18px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.poster-canvas-list { display: grid; gap: 14px; }
@media (min-width: 560px) { .poster-canvas-list { grid-template-columns: 1fr 1fr; } }
.poster-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper-3);
}
.poster-item canvas { width: 100%; display: block; }
.poster-item .cap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 11px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-2);
}
.caption-box {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  background: var(--paper-2);
  font: inherit;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-soft);
  resize: vertical;
}

/* ---------- toast ---------- */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper-2);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  animation: toastin 0.22s ease both;
  max-width: 78vw;
  text-align: center;
}
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.footnote { font-size: 11.5px; color: var(--ink-faint); line-height: 1.7; margin-top: 18px; }
.link { color: var(--red); border-bottom: 1px solid rgba(192, 57, 43, 0.3); cursor: pointer; }
.avatars { display: flex; }
.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px;
  color: #fff;
  border: 2px solid var(--paper);
  margin-left: -6px;
}
.avatar:first-child { margin-left: 0; }
