/* ============================================================
   Wander — trip planner styles
   ============================================================ */

:root {
  --accent: #0ea89b;
  --accent-strong: #0b8b81;
  --accent-soft: rgba(14, 168, 155, 0.13);
  --accent-contrast: #ffffff;
  --grad-accent: linear-gradient(135deg, #0ea89b, #22c48f);
  --sun: #f59e0b;
  --sun-soft: #fff3d6;
  --hero: rgba(255, 255, 255, 0.6);
  --glass: rgba(255, 255, 255, 0.78);
  --page-bg: linear-gradient(180deg, #e9f8f3 0%, #f4fafc 45%, #fbf6ea 100%);

  /* cartoon world map */
  --map-ocean: #b5e3ee;
  --map-ocean2: #c6ecf3;
  --map-land: #cdeab7;
  --map-land-edge: #9fce85;
  --map-ice: #eef8fa;
  --map-sand: #f2e3b8;
  --map-route: #0d9488;
  --map-wave: #8fd0dd;
  --map-cloud: rgba(255, 255, 255, 0.9);
  --map-hull: #e07a3f;
  --map-sail: #ffffff;
  --map-detail: #4f7f8b;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);

  --bg: #f0faf7;
  --bg-panel: #ffffff;
  --bg-sunken: #ecf4f1;
  --bg-hover: #edf6f3;
  --text: #16302e;
  --text-soft: #52706c;
  --text-faint: #8aa5a0;
  --border: #dcebe6;
  --shadow: 0 1px 3px rgba(10, 60, 54, 0.07), 0 4px 14px rgba(10, 60, 54, 0.06);
  --shadow-lift: 0 4px 10px rgba(10, 60, 54, 0.10), 0 12px 32px rgba(10, 60, 54, 0.13);
  --radius: 14px;
  --radius-sm: 9px;

  --day-0: #0d9488; --day-1: #e0762c; --day-2: #7c5cd6; --day-3: #d0366f;
  --day-4: #2563eb; --day-5: #ca8a04; --day-6: #16a34a; --day-7: #db2777;
  --day-8: #0891b2; --day-9: #9333ea;
}

html[data-theme="dark"] {
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-contrast: #06302b;
  --grad-accent: linear-gradient(135deg, #2dd4bf, #34d399);
  --sun: #fbbf24;
  --sun-soft: #3a2f14;
  --hero: rgba(20, 28, 34, 0.62);
  --glass: rgba(24, 33, 40, 0.78);
  --page-bg: #0f1519;

  --map-ocean: #102733;
  --map-ocean2: #143140;
  --map-land: #1f4034;
  --map-land-edge: #2f5c47;
  --map-ice: #1d3742;
  --map-sand: #4a4230;
  --map-route: #2dd4bf;
  --map-wave: #2e5665;
  --map-cloud: rgba(255, 255, 255, 0.09);
  --map-hull: #b06033;
  --map-sail: #d7e4e6;
  --map-detail: #7fa8b3;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --bg: #0f1519;
  --bg-panel: #1a2228;
  --bg-sunken: #131a1f;
  --bg-hover: #212b33;
  --text: #e6edf3;
  --text-soft: #9fb0bf;
  --text-faint: #64788a;
  --border: #2a3640;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 4px 10px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.5);

  --day-0: #2dd4bf; --day-1: #fb923c; --day-2: #a78bfa; --day-3: #f472b6;
  --day-4: #60a5fa; --day-5: #facc15; --day-6: #4ade80; --day-7: #f472b6;
  --day-8: #22d3ee; --day-9: #c084fc;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--text-faint); font-weight: 400; font-size: 0.85em; }

.view { min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  background: var(--bg-hover);
  color: var(--text);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-sunken); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--grad-accent); color: var(--accent-contrast); box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--shadow-lift); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); background: var(--danger); }
.btn-icon { padding: 8px 11px; font-size: 16px; line-height: 1; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-invert { background: #fff; color: #0f766e; }
.btn-invert:hover { background: #e8fffb; }

/* ---------- cartoon world-map background ---------- */
#view-home { position: relative; overflow: hidden; }
.world-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; display: block;
}
.home-header, .home-main { position: relative; z-index: 1; }

.wb-ocean { fill: var(--map-ocean); }
.wb-ocean-glow { fill: var(--map-ocean2); opacity: 0.55; }
.wb-land { fill: var(--map-land); stroke: var(--map-land-edge); stroke-width: 3; stroke-linejoin: round; }
.wb-ice { fill: var(--map-ice); }
.wb-sand { fill: var(--map-sand); stroke: var(--map-land-edge); stroke-width: 2; }
.wb-trunk { fill: none; stroke: #a06b3a; stroke-width: 4; stroke-linecap: round; }
.wb-frond { fill: #7cc46c; stroke: #5da850; stroke-width: 1.5; }
html[data-theme="dark"] .wb-frond { fill: #2f6b45; stroke: #3d8557; }
html[data-theme="dark"] .wb-trunk { stroke: #7c5330; }
.wb-route {
  fill: none; stroke: var(--map-route); stroke-width: 3;
  stroke-dasharray: 2 12; stroke-linecap: round; opacity: 0.7;
}
.wb-plane { fill: var(--map-sail); stroke: var(--map-detail); stroke-width: 2; stroke-linejoin: round; }
.wb-plane-trail { fill: none; stroke: var(--map-detail); stroke-width: 2; stroke-linecap: round; opacity: 0.55; }
.wb-hull { fill: var(--map-hull); stroke-linejoin: round; }
.wb-sail, .wb-sail2 { fill: var(--map-sail); stroke: var(--map-detail); stroke-width: 1.5; }
.wb-mast { stroke: var(--map-detail); stroke-width: 2.5; stroke-linecap: round; }
.wb-funnel { fill: var(--map-detail); }
.wb-puff { fill: var(--map-cloud); }
.wb-waves path { fill: none; stroke: var(--map-wave); stroke-width: 3; stroke-linecap: round; }
.wb-cloud ellipse { fill: var(--map-cloud); }
.wb-sun-core { fill: #ffd76e; stroke: #f7b93d; stroke-width: 3; }
.wb-rays path { stroke: #f7b93d; stroke-width: 4; stroke-linecap: round; }
.wb-night { display: none; }
html[data-theme="dark"] .wb-sun-wrap { display: none; }
html[data-theme="dark"] .wb-night { display: block; }
.wb-moon { fill: #e8dfb8; opacity: 0.9; }
.wb-stars path { fill: #d9d29f; opacity: 0.8; }
.wb-compass-ring { fill: var(--glass); stroke: var(--map-detail); stroke-width: 3; }
.wb-compass-n { fill: var(--map-route); }
.wb-compass-s { fill: var(--map-detail); opacity: 0.6; }

.wb-float  { animation: wb-float 7s ease-in-out infinite; }
.wb-float2 { animation: wb-float 9s ease-in-out infinite reverse; }
.wb-bob    { animation: wb-bob 5s ease-in-out infinite; }
.wb-bob2   { animation: wb-bob 6.5s ease-in-out infinite reverse; }
.wb-cloud1 { animation: wb-drift 26s ease-in-out infinite alternate; }
.wb-cloud2 { animation: wb-drift 34s ease-in-out infinite alternate-reverse; }
.wb-sun    { animation: wb-spin 120s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes wb-float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(16px, -9px); } }
@keyframes wb-bob   { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(7px) rotate(-2deg); } }
@keyframes wb-drift { from { transform: translateX(0); } to { transform: translateX(46px); } }
@keyframes wb-spin  { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .wb-float, .wb-float2, .wb-bob, .wb-bob2, .wb-cloud1, .wb-cloud2, .wb-sun { animation: none; }
}

/* ---------- home ---------- */
.home-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 30px 34px 26px; gap: 16px; flex-wrap: wrap;
  background: var(--hero); border-radius: 0 0 30px 30px;
  backdrop-filter: blur(8px) saturate(1.15);
  -webkit-backdrop-filter: blur(8px) saturate(1.15);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  font-size: 32px; background: linear-gradient(135deg, var(--accent-soft), var(--sun-soft));
  border-radius: 16px; width: 58px; height: 58px; display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.brand h1 { font-size: 26px; }
.tagline { color: var(--text-soft); font-size: 14px; }
.home-actions { display: flex; gap: 8px; }

.home-main { padding: 10px 34px 60px; max-width: 1100px; width: 100%; margin: 0 auto; flex: 1; }
.home-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 16px; }
.home-toolbar h2 { font-size: 18px; color: var(--text-soft); font-weight: 600; }

.trip-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.trip-card {
  background: var(--bg-panel); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 20px; cursor: pointer; position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.trip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.trip-card-emoji {
  font-size: 30px; width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--accent-soft); border-radius: 14px;
}
.trip-card h3 { font-size: 17px; }
.trip-card-dest { color: var(--text-soft); font-size: 13.5px; }
.trip-card-meta { color: var(--text-faint); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.trip-card-menu {
  position: absolute; top: 12px; right: 12px; display: flex; gap: 4px;
  opacity: 0; transition: opacity 0.15s ease;
}
.trip-card:hover .trip-card-menu, .trip-card:focus-within .trip-card-menu { opacity: 1; }
.icon-btn {
  border: none; background: var(--bg-hover); border-radius: 8px;
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 13px;
  color: var(--text-soft); transition: background 0.15s;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- empty states ---------- */
.empty-state {
  text-align: center; color: var(--text-soft); padding: 22px 14px;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state.big {
  padding: 70px 20px; margin-top: 24px;
  background: var(--glass);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.empty-art { font-size: 42px; }
.empty-state h3 { color: var(--text); }
.empty-state p { font-size: 14px; max-width: 380px; }

/* ---------- trip header ---------- */
.share-banner {
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 9px 16px; font-weight: 600; font-size: 14px; flex-wrap: wrap;
}
.trip-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--bg-panel);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: 0; z-index: 500;
}
.trip-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.trip-title-emoji {
  font-size: 24px; background: var(--accent-soft); width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 12px; flex-shrink: 0;
}
.trip-title-text { min-width: 0; }
.trip-title h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-sub { color: var(--text-soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------- trip layout ---------- */
.trip-layout {
  flex: 1; display: grid; min-height: 0;
  grid-template-columns: minmax(340px, 420px) 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas: "days map" "budget budget";
}
.panel { min-width: 0; min-height: 0; }
.panel-days { grid-area: days; overflow-y: auto; padding: 18px 16px 30px; border-right: 1px solid var(--border); }
.panel-map { grid-area: map; display: flex; flex-direction: column; position: relative; }
.panel-budget { grid-area: budget; }

/* ---------- timeline / days ---------- */
.day-section { margin-bottom: 22px; }
.day-header {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 5; padding: 6px 2px;
  border-bottom: 1px solid transparent;
}
.day-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; align-self: center; }
.day-header h3 { font-size: 15px; }
.day-header .day-date { color: var(--text-soft); font-weight: 500; font-size: 13px; }
.day-header .day-meta { margin-left: auto; color: var(--text-faint); font-size: 12px; text-align: right; }

.stop-list { display: flex; flex-direction: column; min-height: 8px; }
.stop-list.drag-over { background: var(--accent-soft); border-radius: var(--radius-sm); }

.drop-indicator {
  height: 3px; background: var(--accent); border-radius: 2px; margin: 2px 6px;
}

.stop-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 10px 12px; margin: 4px 0; cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s;
}
.stop-card:hover { box-shadow: var(--shadow-lift); }
.stop-card.dragging { opacity: 0.4; }
.stop-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-lift); }

.stop-row { display: flex; align-items: center; gap: 9px; }
.stop-num {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px;
  font-weight: 700; display: grid; place-items: center; flex-shrink: 0;
}
.stop-cat { font-size: 16px; flex-shrink: 0; }
.stop-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-chip { color: var(--text-soft); font-size: 12.5px; flex-shrink: 0; }
.stop-cost-chip { color: var(--accent-strong); font-weight: 600; font-size: 12.5px; flex-shrink: 0; }
html[data-theme="dark"] .stop-cost-chip { color: var(--accent); }
.stop-expand { border: none; background: none; color: var(--text-faint); font-size: 12px; padding: 4px; flex-shrink: 0; transition: transform 0.2s; }
.stop-card.open .stop-expand { transform: rotate(180deg); }
.stop-note-preview {
  color: var(--text-faint); font-size: 12.5px; margin: 5px 0 0 33px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.stop-edit { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: grid; gap: 8px; }
.stop-edit-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stop-edit label { font-size: 11.5px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 3px; }
.stop-edit input, .stop-edit select, .stop-edit textarea {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 9px; font-size: 13.5px; width: 100%;
}
.stop-edit input:focus, .stop-edit select:focus, .stop-edit textarea:focus,
.search-input:focus, .expense-form input:focus, .budget-input-row input:focus,
.form-row input:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent;
}
.stop-edit textarea { resize: vertical; min-height: 44px; }
.se-time { flex: 0 0 110px; }
.se-cat { flex: 1 1 130px; }
.se-cost { flex: 0 0 110px; }
.se-note { flex: 1 1 100%; }
.stop-edit-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.leg {
  display: flex; align-items: center; gap: 8px; color: var(--text-faint);
  font-size: 12px; padding: 1px 0 1px 11px;
}
.leg::before { content: ""; width: 2px; height: 16px; background: var(--border); border-radius: 2px; margin-right: 4px; }

/* add stop */
.add-stop { margin-top: 6px; position: relative; }
.add-stop-toggle {
  width: 100%; border: 1.5px dashed var(--border); background: none; color: var(--text-faint);
  border-radius: var(--radius-sm); padding: 8px; font-size: 13px; font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.add-stop-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.search-box { position: relative; }
.search-input {
  width: 100%; background: var(--bg-panel); border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm); padding: 9px 32px 9px 12px; font-size: 14px;
  box-shadow: var(--shadow);
}
.search-close {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--text-faint); font-size: 14px; padding: 6px;
}
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 400;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.search-result {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: none;
  background: none; font-size: 13.5px; color: var(--text); border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--accent-soft); }
.search-result .sr-type { color: var(--text-faint); font-size: 11.5px; display: block; }
.search-status { padding: 9px 12px; color: var(--text-faint); font-size: 13px; }

/* ---------- map panel ---------- */
.map-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--bg-panel);
}
.day-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip {
  border: 1px solid var(--border); background: var(--bg-panel); border-radius: 999px;
  padding: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  transition: all 0.15s ease; display: inline-flex; align-items: center; gap: 6px;
}
.day-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; }
.day-chip:hover { border-color: var(--accent); color: var(--accent); }
.day-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.day-chip.active .chip-dot { background: currentColor !important; }
.map-hint { margin-left: auto; color: var(--text-faint); font-size: 12px; }
#map { flex: 1; min-height: 240px; background: var(--bg-sunken); z-index: 1; }
.map-fallback {
  position: absolute; inset: 48px 0 0 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  color: var(--text-soft); background: var(--bg-sunken); z-index: 2; font-size: 14px;
}

/* dark-mode map tiles */
html[data-theme="dark"] .leaflet-layer .leaflet-tile,
html[data-theme="dark"] .leaflet-control-attribution,
html[data-theme="dark"] .leaflet-control-zoom {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.7);
}
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-lift); }
.leaflet-popup-content { margin: 10px 14px; font-size: 13.5px; }
.pin {
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  width: 28px; height: 28px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  border: 2px solid rgba(255,255,255,0.85); box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.pin > span { transform: rotate(45deg); }
html[data-theme="dark"] .pin { border-color: rgba(0,0,0,0.55); }

/* ---------- budget ---------- */
.panel-budget { background: var(--bg-panel); border-top: 1px solid var(--border); }
.budget-summary {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 11px 20px; border: none; background: none; text-align: left;
}
.budget-label { font-weight: 700; font-size: 14px; flex-shrink: 0; }
.budget-bar-track {
  flex: 1; height: 10px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden;
  min-width: 60px;
}
.budget-bar-fill {
  height: 100%; width: 0%; background: var(--accent); border-radius: 999px;
  transition: width 0.35s ease, background 0.35s ease;
}
.budget-bar-fill.over { background: var(--danger); }
.budget-figures { font-weight: 600; font-size: 13.5px; color: var(--text-soft); flex-shrink: 0; }
.budget-figures .over-label { color: var(--danger); font-weight: 700; }
.budget-chevron { color: var(--text-faint); transition: transform 0.2s; }
.budget-detail { border-top: 1px solid var(--border); padding: 16px 20px 20px; }
.budget-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; max-width: 900px; }
.budget-col h4 { font-size: 13px; margin-bottom: 9px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.budget-col h4 + h4, .budget-col p + h4, .budget-days + h4 { margin-top: 16px; }
.budget-input-row {
  display: flex; align-items: center; gap: 6px; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 10px;
  max-width: 220px; margin-bottom: 8px;
}
.budget-input-row input { border: none; background: none; padding: 7px 0; width: 100%; }
.budget-input-row input:focus { outline: none; }
.currency-sign { color: var(--text-faint); font-weight: 600; }
.budget-status { font-size: 13px; color: var(--text-soft); }
.budget-status.over { color: var(--danger); font-weight: 600; }
.budget-days { margin-top: 4px; display: grid; gap: 4px; }
.budget-days li { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.budget-days .bd-day { color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.budget-days .bd-dot { width: 8px; height: 8px; border-radius: 50%; }
.expense-list { display: grid; gap: 5px; margin-bottom: 10px; }
.expense-list li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.expense-list .ex-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.expense-list .ex-cost { font-weight: 600; }
.expense-empty { color: var(--text-faint); font-size: 13px; padding: 4px 0 10px; }
.expense-form { display: flex; gap: 7px; }
.expense-form input {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 9px; font-size: 13.5px;
}
.expense-form input[type="text"] { flex: 1; min-width: 0; }
.expense-form input[type="number"] { width: 90px; }

/* ---------- modals ---------- */
.modal {
  border: none; border-radius: var(--radius); background: var(--bg-panel); color: var(--text);
  box-shadow: var(--shadow-lift); padding: 26px; width: min(440px, calc(100vw - 32px));
}
.modal::backdrop { background: rgba(10, 18, 26, 0.55); backdrop-filter: blur(2px); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-small { width: min(360px, calc(100vw - 32px)); }
.confirm-text { color: var(--text-soft); margin: 8px 0 18px; font-size: 14px; }
.form-row { margin-bottom: 13px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.form-row input {
  width: 100%; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; font-size: 14px;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.emoji-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-opt {
  font-size: 19px; width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg-sunken); display: grid; place-items: center; transition: all 0.12s;
}
.emoji-opt:hover { transform: scale(1.1); }
.emoji-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- explore / trip ideas ---------- */
.modal-explore { width: min(780px, calc(100vw - 24px)); padding: 20px 22px; }
.explore-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.explore-head h3 { margin: 0; }
.explore-search { display: flex; gap: 8px; margin-bottom: 12px; }
.explore-search input {
  flex: 1; min-width: 0; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px;
}
.explore-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.explore-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.explore-day { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--text-soft); display: flex; gap: 7px; align-items: center; }
.explore-day select {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; font-size: 13px;
}
.explore-status { padding: 30px 10px; text-align: center; color: var(--text-soft); font-size: 14px; }
.idea-scroll { max-height: 52vh; overflow-y: auto; display: grid; gap: 10px; padding: 2px; }
.idea-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
  background: var(--bg-panel); box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.idea-card:hover { box-shadow: var(--shadow-lift); border-color: var(--accent); }
.idea-top { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.idea-icon { font-size: 17px; }
.idea-name { font-weight: 700; flex: 1; min-width: 140px; }
.idea-badge {
  font-size: 11.5px; background: var(--sun-soft); color: #92610a;
  padding: 3px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap;
}
html[data-theme="dark"] .idea-badge { color: #fbd47f; }
.idea-desc {
  color: var(--text-soft); font-size: 13.5px; margin-top: 6px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.idea-meta { display: flex; gap: 16px; color: var(--text-faint); font-size: 12.5px; margin-top: 7px; flex-wrap: wrap; }
.idea-actions { display: flex; justify-content: flex-end; margin-top: 9px; }
.idea-actions .added { color: var(--accent-strong); font-weight: 700; font-size: 13px; padding: 6px 4px; }
html[data-theme="dark"] .idea-actions .added { color: var(--accent); }
.explore-credit { color: var(--text-faint); font-size: 12px; margin-top: 12px; text-align: center; }
.explore-credit a { color: var(--accent-strong); }

/* AI planner */
.explore-mode { display: flex; gap: 6px; margin-bottom: 12px; }
.ai-key {
  width: 100%; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px;
}
.ai-key:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.ai-note { color: var(--text-faint); font-size: 12px; margin: 6px 2px 10px; }
.ai-note a { color: var(--accent-strong); }
.ai-prefs {
  width: 100%; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px;
  resize: vertical; margin-bottom: 10px;
}
.ai-prefs:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
#ai-panel > .btn { width: 100%; }
.ai-plan-actions { display: flex; justify-content: flex-end; padding: 2px; }
.ai-plan-actions .added { color: var(--accent-strong); font-weight: 700; font-size: 13px; }
.ai-day { display: grid; gap: 7px; }
.ai-stop {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 0;
  border-top: 1px dashed var(--border); font-size: 13.5px;
}
.ai-stop-time { color: var(--text-faint); font-size: 12px; flex: 0 0 42px; font-variant-numeric: tabular-nums; }
.ai-stop-body { flex: 1; min-width: 0; }
.ai-stop-note { display: block; color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }
.ai-stop .added { color: var(--accent-strong); font-weight: 700; }
.ai-tips { color: var(--text-soft); font-size: 13px; padding: 4px 6px; }
.ai-optcount {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--text-soft); margin: 0 2px 10px;
}
.ai-optcount select {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 8px; font-size: 13px;
}
.ai-opts { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px; }
.ai-summary { color: var(--text-soft); font-size: 13.5px; padding: 0 4px; }
.ai-meta .idea-desc { -webkit-line-clamp: 4; }

/* destination wizard */
.home-toolbar-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.wiz-q { margin-bottom: 12px; }
.wiz-q > label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-soft); margin-bottom: 6px; }
.wiz-row { display: flex; gap: 8px; }
.wiz-row .ai-key { width: auto; flex: 1; }
.wiz-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.wiz-emoji {
  font-size: 22px; background: var(--accent-soft); border-radius: 10px;
  width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0;
}
.wiz-high { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.wiz-high span {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; color: var(--text-soft);
}
.wiz-card .idea-meta { display: grid; gap: 4px; }
#wizard-results { margin-top: 12px; max-height: 44vh; }
#wizard-form .ai-key { margin-bottom: 2px; }
@media (max-width: 640px) {
  .modal-explore { width: calc(100vw - 12px); padding: 16px 14px; }
  .modal-packing { width: calc(100vw - 12px); padding: 16px 14px; }
  .idea-scroll { max-height: 46vh; }
  .explore-day { margin-left: 0; }
}

/* ---------- day-header weather badge ---------- */
.day-weather-slot { display: inline-flex; align-items: center; }
.day-weather {
  font-size: 12px; font-weight: 600; color: var(--text-soft);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}

/* ---------- packing list ---------- */
.pack-count {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px;
  padding: 0 4px; margin-left: 2px; border-radius: 999px; font-size: 11px;
  font-weight: 700; background: var(--accent); color: var(--accent-contrast);
  vertical-align: middle;
}
.modal-packing { width: min(480px, calc(100vw - 24px)); padding: 20px 22px; }
.pack-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pack-bar-track {
  flex: 1; height: 10px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden;
}
.pack-bar-fill {
  height: 100%; width: 0%; background: var(--accent); border-radius: 999px;
  transition: width 0.35s ease, background 0.35s ease;
}
.pack-bar-fill.full { background: #16a34a; }
.pack-progress { font-size: 13px; font-weight: 600; color: var(--text-soft); flex-shrink: 0; white-space: nowrap; }
.pack-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 4px; }
.pack-suggest-label { font-size: 12px; color: var(--text-faint); margin-right: 2px; }
.pack-chip { font-size: 12px; padding: 4px 9px; }
.pack-list { display: grid; gap: 4px; margin-top: 12px; max-height: 44vh; overflow-y: auto; }
.pack-empty { color: var(--text-faint); font-size: 13.5px; padding: 8px 2px; }
.pack-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  border-bottom: 1px dashed var(--border);
}
.pack-check { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.pack-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.pack-box {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--bg-panel);
  display: grid; place-items: center; font-size: 13px; color: var(--accent-contrast);
  transition: background 0.15s, border-color 0.15s;
}
.pack-item.done .pack-box { background: var(--accent); border-color: var(--accent); }
.pack-text { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-item.done .pack-text { color: var(--text-faint); text-decoration: line-through; }
.pack-foot { margin-top: 14px; display: flex; justify-content: flex-end; }

/* ---------- experience polish ---------- */
/* three-path empty state */
.start-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; width: 100%; max-width: 720px; margin-top: 10px; }
.start-card {
  background: var(--bg-panel); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; text-align: left; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
  cursor: pointer; font-size: 13px; color: var(--text-soft);
}
.start-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--accent); }
.start-card strong { color: var(--text); font-size: 14.5px; }
.start-emoji { font-size: 26px; }

/* AI 3-step setup */
.ai-setup { display: grid; gap: 10px; margin-bottom: 12px; }
.ai-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-soft); }
.ai-step strong { display: block; color: var(--text); font-size: 13.5px; }
.ai-step a { color: var(--accent-strong); }
.ai-step-n {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--grad-accent);
  color: var(--accent-contrast); font-weight: 800; font-size: 13px;
  display: grid; place-items: center; margin-top: 1px;
}

/* saved indicator */
.save-ind {
  color: var(--accent-strong); font-size: 12px; font-weight: 700;
  opacity: 0; transition: opacity 0.3s ease; white-space: nowrap;
}
html[data-theme="dark"] .save-ind { color: var(--accent); }
.save-ind.show { opacity: 1; }

/* undo toasts */
.toast-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-btn {
  border: none; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 12.5px;
  background: var(--accent); color: var(--accent-contrast); cursor: pointer;
}
.toast-btn:hover { filter: brightness(1.1); }

/* loading skeletons */
.skel { pointer-events: none; }
.skel-line {
  height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-hover) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s linear infinite;
}
.skel-line.w40 { width: 40%; }
.skel-line.w70 { width: 70%; }
@keyframes skel-shimmer { to { background-position: -200% 0; } }

/* live AI draft lines */
.ai-live-opt { font-weight: 800; padding: 8px 6px 2px; color: var(--text); }
.ai-live-day { padding: 6px 10px; color: var(--text-soft); font-size: 13.5px; animation: live-in 0.25s ease; }
.ai-live-day .added { color: var(--accent-strong); }
.ai-live-day.writing { color: var(--text-faint); }
@keyframes live-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* new stop pop-in */
.stop-new { animation: stop-in 0.3s ease; }
@keyframes stop-in { from { opacity: 0; transform: scale(0.95) translateY(6px); } to { opacity: 1; transform: none; } }

/* pin/card hover sync */
.pin { transition: transform 0.15s ease; }
.pin-hot .pin { transform: rotate(-45deg) scale(1.3); box-shadow: 0 4px 12px rgba(0,0,0,0.45); }
.pin-hot { z-index: 1000 !important; }
.stop-card.hover-glow { border-color: var(--accent); box-shadow: var(--shadow-lift); }

/* confetti + plane fly-by */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 4000; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: conf-fall 1.8s ease-in forwards;
}
@keyframes conf-fall {
  to { transform: translateY(105vh) translateX(var(--drift, 0)) rotate(var(--spin, 360deg)); opacity: 0.7; }
}
.flyby {
  position: fixed; top: 18vh; left: -60px; font-size: 34px; z-index: 4000;
  pointer-events: none; animation: flyby 2.4s ease-in-out forwards;
}
@keyframes flyby {
  0% { left: -60px; transform: translateY(0) rotate(8deg); }
  50% { transform: translateY(-26px) rotate(-4deg); }
  100% { left: 105vw; transform: translateY(6px) rotate(6deg); }
}

/* relative-date chips */
.trip-when {
  position: absolute; bottom: 14px; right: 14px;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
}
html[data-theme="dark"] .trip-when { color: var(--accent); }
.trip-when.now { background: var(--sun-soft); color: #92610a; }
html[data-theme="dark"] .trip-when.now { color: #fbd47f; }
.trip-when.past { background: var(--bg-sunken); color: var(--text-faint); }
.trip-card { padding-bottom: 40px; }

/* trips pinned on the home world map */
.wb-trippin circle { fill: var(--bg-panel); stroke: var(--accent); stroke-width: 2.5; }
/* opacity only — a transform keyframe would override the pin's SVG positioning */
.wb-trippin { animation: pin-drop 0.5s ease backwards; }
@keyframes pin-drop { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .stop-new, .ai-live-day, .wb-trippin, .confetti i, .flyby { animation: none; }
  .pin { transition: none; }
}

/* ---------- read-only (shared trip) mode ---------- */
body.readonly .hide-ro { display: none !important; }
body.readonly .stop-card { cursor: default; }

/* ---------- toasts ---------- */
.toast-wrap {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 3000; align-items: center;
  pointer-events: none; width: max-content; max-width: calc(100vw - 30px);
}
.toast {
  background: var(--text); color: var(--bg-panel); padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lift);
  animation: toast-in 0.25s ease; max-width: 100%; text-align: center;
}
.toast.warn { background: #b45309; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- mobile ---------- */
.mobile-tabs { display: none; }

@media (max-width: 860px) {
  .trip-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "days";
    padding-bottom: 56px;
  }
  .trip-layout[data-tab="days"]   { grid-template-areas: "days"; }
  .trip-layout[data-tab="map"]    { grid-template-areas: "map"; }
  .trip-layout[data-tab="budget"] { grid-template-areas: "budget"; }
  .trip-layout[data-tab="days"] .panel-map,
  .trip-layout[data-tab="days"] .panel-budget { display: none; }
  .trip-layout[data-tab="map"] .panel-days,
  .trip-layout[data-tab="map"] .panel-budget { display: none; }
  .trip-layout[data-tab="budget"] .panel-days,
  .trip-layout[data-tab="budget"] .panel-map { display: none; }
  .panel-days { border-right: none; }
  .panel-budget { border-top: none; overflow-y: auto; }
  .budget-cols { grid-template-columns: 1fr; }
  .budget-detail[hidden] { display: block !important; }
  .budget-summary { pointer-events: none; }
  .budget-chevron { display: none; }

  .mobile-tabs {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    background: var(--bg-panel); border-top: 1px solid var(--border);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  }
  .tab-btn {
    flex: 1; border: none; background: none; padding: 9px 4px; font-size: 13px;
    font-weight: 600; color: var(--text-faint); border-radius: var(--radius-sm);
  }
  .tab-btn.active { color: var(--accent); background: var(--accent-soft); }

  .trip-header { padding: 10px 12px; gap: 8px; }
  .trip-actions .btn { padding: 7px 9px; font-size: 13px; }
  .home-header, .home-main { padding-left: 16px; padding-right: 16px; }
  .map-hint { display: none; }
}

/* ---------- print ---------- */
.print-sheet { display: none; }

@media print {
  body { background: #fff; color: #111; font-size: 12.5px; }
  .view, .toast-wrap, .mobile-tabs, .modal { display: none !important; }
  .print-sheet { display: block !important; padding: 0; }
  .print-head { margin-bottom: 12px; }
  .print-head h1 { font-size: 22pt; margin: 0; }
  .print-head p { color: #444; margin-top: 2px; }
  .print-day { page-break-after: always; padding-top: 8px; }
  .print-day:last-child { page-break-after: auto; }
  .print-day h2 { font-size: 15pt; border-bottom: 2px solid #0d9488; padding-bottom: 4px; margin: 0 0 10px; }
  .print-stop { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #ddd; page-break-inside: avoid; }
  .print-stop .pn { font-weight: 700; color: #0d9488; width: 20px; flex-shrink: 0; }
  .print-stop .pt { width: 52px; flex-shrink: 0; color: #444; }
  .print-stop .pbody { flex: 1; }
  .print-stop .pname { font-weight: 600; }
  .print-stop .pnote { color: #555; font-size: 11px; margin-top: 1px; }
  .print-stop .pcost { flex-shrink: 0; font-weight: 600; }
  .print-leg { color: #888; font-size: 10.5px; padding: 2px 0 2px 30px; }
  .print-day-total { text-align: right; font-weight: 700; padding-top: 8px; }
  .print-summary { margin-top: 14px; padding-top: 8px; border-top: 2px solid #0d9488; }
  .print-summary table { width: 100%; border-collapse: collapse; }
  .print-summary td { padding: 3px 0; border-bottom: 1px solid #eee; }
  .print-summary td:last-child { text-align: right; font-weight: 600; }
  .print-empty { color: #777; font-style: italic; padding: 6px 0; }
  .print-packing { page-break-before: auto; }
  .print-packing ul { list-style: none; padding: 0; margin: 6px 0 0; columns: 2; }
  .print-packing li { padding: 3px 0; font-size: 12px; break-inside: avoid; }
}
