/* Travel PWA — 共用樣式 */

:root {
  --color-bg: #fafaf9;
  --color-surface: #ffffff;
  --color-text: #18181b;
  --color-text-muted: #71717a;
  --color-border: #e4e4e7;
  --color-primary: #0ea5e9;
  --color-primary-soft: #e0f2fe;
  --color-accent: #f97316;

  --status-yellow: #fde68a;
  --status-yellow-text: #92400e;
  --status-blue: #bfdbfe;
  --status-blue-text: #1e40af;
  --status-green: #bbf7d0;
  --status-green-text: #166534;
  --status-orange: #fed7aa;
  --status-orange-text: #9a3412;
  --status-gray: #e5e7eb;
  --status-gray-text: #374151;
  --status-red: #fecaca;
  --status-red-text: #991b1b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 10px 15px rgba(0, 0, 0, 0.06);

  --font-sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); line-height: 1.6; -webkit-font-smoothing: antialiased; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 720px; margin: 0 auto; padding: 24px 16px 80px; }

/* ===== App Bar ===== */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  max-width: 720px;
  margin: 0 auto;
}
.appbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.appbar .sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.appbar .actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .appbar { padding: 16px 12px 8px; gap: 8px; }
  .appbar h1 { font-size: 16px; }
  .appbar .sub { font-size: 11px; }
  .appbar .actions { gap: 4px; flex-shrink: 0; }
  .appbar .actions .btn { padding: 6px 9px; font-size: 12px; }
}
.btn:hover { background: #f4f4f5; }
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: #0284c7; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
}
.tabs button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tabs button.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }

/* ===== Trip Card ===== */
.trip-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
  color: var(--color-text);
}
.trip-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }

.trip-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--color-primary-soft), #fef3c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
}
.trip-body { padding: 16px 20px 20px; }
.trip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.trip-title { font-size: 18px; font-weight: 700; }
.trip-meta { font-size: 13px; color: var(--color-text-muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.trip-meta span { display: inline-flex; align-items: center; gap: 4px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-yellow { background: var(--status-yellow); color: var(--status-yellow-text); }
.badge-blue   { background: var(--status-blue);   color: var(--status-blue-text); }
.badge-green  { background: var(--status-green);  color: var(--status-green-text); }
.badge-orange { background: var(--status-orange); color: var(--status-orange-text); }
.badge-gray   { background: var(--status-gray);   color: var(--status-gray-text); }
.badge-red    { background: var(--status-red);    color: var(--status-red-text); }

.trip-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
}
.trip-foot .label { color: var(--color-text-muted); }
.trip-foot .value { font-weight: 600; }

/* ===== Detail Page ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--color-text); text-decoration: none; }

.trip-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 10px;
  border-bottom: 1px solid var(--color-border, #e7e5e4);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.trip-topbar .back-link {
  margin-bottom: 0;
  font-weight: 600;
  color: var(--color-text);
  font-size: 15px;
}
body.has-topbar { padding-top: 56px; }

/* anchor scroll 時避開 fixed topbar (56) + sticky sec-nav (~44) */
[id^="sec-"] {
  scroll-margin-top: 110px;
}

.detail-hero {
  background: linear-gradient(135deg, var(--color-primary-soft), #fef3c7);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 24px;
  text-align: center;
}
.detail-hero .emoji { font-size: 64px; }
.detail-hero h1 { font-size: 28px; font-weight: 800; margin-top: 8px; }
.detail-hero .where { font-size: 15px; color: var(--color-text-muted); margin-top: 6px; }
.detail-hero .route { font-size: 14px; color: var(--color-text-muted); margin-top: 4px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.info-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.info-item .label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.info-item .value { font-size: 16px; font-weight: 600; }
.info-item .flight-route { font-size: 16px; font-weight: 600; }
.info-item .flight-time { font-size: 13px; font-weight: 500; color: var(--color-text-muted); margin-top: 2px; }
.flight-pair { display: flex; align-items: center; gap: 8px; }
.flight-pair input { flex: 1; }
.flight-arrow { color: var(--color-text-muted); font-weight: 600; }

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0 12px;
}

.note-box {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  color: #78350f;
  white-space: pre-wrap;
}
.note-box.note-editable:hover { background: #fce791; }

/* ===== Day Tabs (詳情頁日程表) ===== */
.day-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.day-tab.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.day-tab .day-num { font-weight: 700; }
.day-tab .day-date { font-size: 11px; opacity: 0.75; margin-left: 4px; }
.day-tab-add {
  border-style: dashed;
  color: var(--color-primary);
  font-weight: 600;
  min-width: 44px;
  text-align: center;
}
.day-tab-add:hover { background: rgba(14, 165, 233, 0.08); }

.day-header {
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.day-header .provider { font-weight: 600; color: var(--color-text); }
.day-header .provider-cost { color: var(--color-text-muted); margin-top: 2px; }
.day-header .provider-reminder {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fef3c7;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #78350f;
  border-left: 3px solid #f59e0b;
}
.day-header-editable { cursor: pointer; position: relative; }
.day-header-editable:hover { outline: 2px dashed var(--color-primary); outline-offset: -4px; }
.day-header-edit-hint {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 0;
  list-style: none;
}
.timeline li {
  position: relative;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.tl-row1 { display: flex; align-items: baseline; gap: 8px; }
.tl-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-primary);
  min-width: 86px;
}
.tl-name { font-size: 15px; font-weight: 500; flex: 1; }
.tl-row2 { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; padding-left: 94px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tl-row2 .stay::before { content: "⏱ "; }
.tl-row2 .badge-mini {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.tl-row2 .b-vbp { background: var(--status-green); color: var(--status-green-text); }
.tl-row2 .b-reserved { background: var(--status-blue); color: var(--status-blue-text); }
.tl-row2 .b-citypass { background: #fef3c7; color: #92400e; }
.tl-row2 .b-flag { background: #e0e7ff; color: #4338ca; }

.chip-check { position: relative; }
.chip-check .chip-del {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
  line-height: 1;
}
.chip-check .chip-del:hover { color: #dc2626; }
.tl-maps {
  display: inline-flex;
  gap: 4px;
}
.tl-maps a {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.tl-maps a:hover { text-decoration: none; background: var(--color-primary-soft); color: var(--color-primary); }

/* type 色條 */
.timeline li.t-food   { border-left: 3px solid #f97316; }
.timeline li.t-sight  { border-left: 3px solid #0ea5e9; }
.timeline li.t-play   { border-left: 3px solid #a855f7; }
.timeline li.t-shop   { border-left: 3px solid #14b8a6; }
.timeline li.t-transit{ border-left: 3px solid #94a3b8; }
.timeline li.t-stay   { border-left: 3px solid #8b5cf6; }
.timeline li.t-work   { border-left: 3px solid #ef4444; }

@media (max-width: 480px) {
  .tl-time { min-width: 78px; font-size: 12px; }
  .tl-row2 { padding-left: 0; }
}

/* ===== Checklist ===== */
.checklist-group { margin-bottom: 20px; }
.checklist-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.checklist-group ul {
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.checklist-group li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  gap: 8px;
}
.checklist-group li:last-child { border-bottom: none; }
.checklist-group li .check { flex-shrink: 0; }
.checklist-group li.done .label { color: var(--color-text-muted); text-decoration: line-through; }
.checklist-group li .meta { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }
.checklist-group li .meta .cost-ntd { color: var(--color-primary); margin-left: 4px; opacity: 0.85; }

.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #14b8a6);
  transition: width 0.4s ease;
}

/* ===== Budget Table ===== */
.budget-table {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 14px;
}
.budget-table .row {
  display: grid;
  grid-template-columns: 50px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.budget-table .row:last-child { border-bottom: none; }
.budget-table .row.head { background: var(--color-bg); font-weight: 600; font-size: 12px; color: var(--color-text-muted); }
.budget-table .row.over { color: var(--status-red-text); background: #fef2f2; }
.budget-table .day { color: var(--color-text-muted); font-size: 12px; }
.budget-table .amt { font-variant-numeric: tabular-nums; font-weight: 600; }

.budget-summary {
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 14px;
}
.budget-summary .over-warn { color: var(--status-red-text); font-weight: 600; }

/* ===== Expenses ===== */
.rates-row {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: -8px 0 14px;
  padding: 6px 10px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}


.exp-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
.exp-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.exp-total-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}
.exp-total-label {
  font-size: 13px;
  color: var(--color-text-muted);
}
.exp-budget-cmp {
  padding: 10px 0;
  font-size: 13px;
  color: var(--color-text-muted);
}
.exp-budget-cmp.over .over-warn {
  color: var(--status-red-text);
  font-weight: 600;
}

.cat-bars {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.cat-bar .cat-label { color: var(--color-text); }
.cat-bar .cat-amt { color: var(--color-text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.cat-bar .cat-pct {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 11px;
  min-width: 44px;
  text-align: center;
}

.exp-group { margin-bottom: 16px; }
.exp-group-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 6px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.exp-day-total { color: var(--color-primary); font-variant-numeric: tabular-nums; }

.exp-list {
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.exp-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.exp-item:last-child { border-bottom: none; }
.exp-item.exp-editable { cursor: pointer; }
.exp-item.exp-editable:hover { background: var(--color-primary-soft); }
.exp-cat { font-size: 18px; }
.exp-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exp-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-note { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-orig { font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.exp-ntd { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-split { color: var(--color-primary); font-weight: 500; }

/* ===== Date quick chips ===== */
.date-quick-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.date-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.date-chip:hover,
.date-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.date-input-inline {
  flex: 1;
  min-width: 140px;
  padding: 6px 12px !important;
  font-size: 14px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
}

/* ===== Split section in expense modal ===== */
.split-section {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}
.split-toggle { width: fit-content; margin-bottom: 0; }
.split-toggle:has(input:checked) ~ .split-fields { display: block; }
.split-fields { margin-top: 12px; }
.split-fields[hidden] { display: none; }
.split-preview {
  font-size: 13px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  line-height: 1.6;
}
.split-preview.empty { background: transparent; color: var(--color-text-muted); padding: 4px 0; }

/* ===== Alternatives ===== */
.alt-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alt-list li {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}
.alt-list .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--status-orange);
  color: var(--status-orange-text);
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
}

/* ===== Sticky section nav ===== */
.sec-nav {
  position: sticky;
  top: 56px;
  z-index: 50;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  margin: 0 -16px 16px;
  padding-left: 16px;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--color-border);
}
.sec-nav::-webkit-scrollbar { display: none; }
.sec-nav-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.sec-nav-chip:hover { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }

/* ===== Collapse / Accordion ===== */
.checklist-group,
.section-collapse {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.checklist-group summary,
.section-collapse summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
}
.checklist-group summary::-webkit-details-marker,
.section-collapse summary::-webkit-details-marker { display: none; }
.checklist-group summary:hover,
.section-collapse summary:hover { background: var(--color-bg); }
.checklist-group .chev,
.section-collapse .chev {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
  color: var(--color-text-muted);
  width: 12px;
}
.checklist-group[open] > summary .chev,
.section-collapse[open] > summary .chev { transform: rotate(90deg); }
.checklist-group .g-title { flex: 1; color: var(--color-text-muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; }
.checklist-group .g-progress {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.checklist-group .g-progress.all-done { background: var(--status-green); color: var(--status-green-text); }
.checklist-group > ul {
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  border: none;
}
.section-collapse .section-summary {
  margin: 0 !important;
  border: none;
}
.section-collapse > .alt-list {
  padding: 0 16px 16px;
}

/* hero 跟導航之間留呼吸空間 */
.detail-hero { margin-bottom: 16px; }

/* ===== Detail Edit ===== */
.info-item[style*="cursor: pointer"]:hover,
.info-item[style*="cursor:pointer"]:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}
.detail-hero[style*="cursor: pointer"]:hover,
.detail-hero[style*="cursor:pointer"]:hover {
  outline: 2px dashed var(--color-primary);
  outline-offset: -4px;
}

.act-handle {
  position: absolute;
  left: 8px;
  top: 14px;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: grab;
}
.timeline li.act-editable {
  padding-left: 28px;
  cursor: pointer;
  position: relative;
}
.timeline li.act-editable:hover { background: var(--color-primary-soft); }
.timeline li.act-dragging { opacity: 0.4; }

.add-act-btn {
  width: 100%;
  margin-top: 8px;
  border-style: dashed;
  color: var(--color-text-muted);
}

.check-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  margin: 0;
  line-height: 1;
}
.btn-tiny {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-tiny:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
.checklist-group-title { display: flex; align-items: center; gap: 8px; }
.checklist-group li[data-group] { cursor: default; }

.budget-table .row.budget-editable { cursor: pointer; }
.budget-table .row.budget-editable:hover { background: var(--color-primary-soft); }

/* ===== Edit Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--color-surface);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(40px); } to { transform: translateY(0); } }

@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius-lg); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-head h2 { font-size: 18px; font-weight: 700; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

.form-row { margin-bottom: 14px; }
.amount-input-wrap { position: relative; }
.amount-input-wrap .amount-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}
.amount-input-wrap input { padding-left: 44px !important; font-variant-numeric: tabular-nums; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--color-text-muted); margin-bottom: 6px; font-weight: 500; }
.form-row input[type=text],
.form-row input[type=number],
.form-row input[type=date],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  background: var(--color-surface);
}
.form-row textarea { resize: vertical; min-height: 40px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  background: var(--color-surface);
}
.chip-check input { margin-right: 2px; }
.chip-check:has(input:checked) { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); }

.btn-danger { color: var(--status-red-text); border-color: var(--status-red); background: #fef2f2; }
.btn-danger:hover { background: var(--status-red); }

/* ===== Drag handle ===== */
.trip-card.draggable { cursor: grab; }
.trip-card.dragging { opacity: 0.4; }
.drag-handle {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: grab;
  z-index: 2;
  border: 1px solid var(--color-border);
}
.trip-card.has-drag { position: relative; }

/* ===== Saving / Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast.rich {
  border-radius: 12px;
  padding: 12px 14px 12px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
}
.toast .toast-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
}
.toast .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.toast .toast-close:hover { color: white; }
.toast .toast-detail {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 0;
}
.toast .toast-detail li {
  list-style: none;
  padding: 1px 0;
}
.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }

/* ===== Receipt scan ===== */
.receipt-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  margin: 8px 0;
}
.receipt-loading[hidden] { display: none; }
.receipt-loading .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #fdba74;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty / Loading ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}
.empty .emoji { font-size: 48px; margin-bottom: 12px; }

/* ===== Mobile tweaks ===== */
@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
}
