:root {
  color-scheme: light;
  --blue: #326bff;
  --sky: #53a8ff;
  --coral: #ff765f;
  --ink: #12213d;
  --muted: #65738c;
  --mist: #f5f8ff;
  --line: #e3eaf8;
  --white: #ffffff;
  --danger: #d74646;
  --shadow: 0 18px 55px rgba(37, 77, 157, 0.12);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--mist); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 3%, rgba(83, 168, 255, 0.16), transparent 30rem),
    linear-gradient(180deg, #fbfdff 0%, var(--mist) 48%, #f8faff 100%);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(1px); pointer-events: none; opacity: .55; }
.ambient-one { width: 220px; height: 220px; background: rgba(83,168,255,.12); top: 180px; right: -120px; }
.ambient-two { width: 180px; height: 180px; background: rgba(255,118,95,.07); bottom: 15%; left: -100px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  width: min(100%, 760px); margin: 0 auto; padding: 15px 20px;
  background: rgba(251,253,255,.86); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(227,234,248,.72);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; }
.brand span { display: grid; line-height: 1; }
.brand strong { font-size: 17px; letter-spacing: -.3px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: 2px; }
.secure-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.72); font-size: 12px; font-weight: 650; }
.secure-pill i, .trip-status i { width: 7px; height: 7px; background: #27b36a; border-radius: 50%; box-shadow: 0 0 0 4px rgba(39,179,106,.12); }

.app-shell { position: relative; width: min(100%, 760px); min-height: calc(100vh - 67px); margin: 0 auto; padding: 24px 18px max(44px, env(safe-area-inset-bottom)); }
.state-card { max-width: 520px; margin: 9vh auto 0; padding: 42px 26px; text-align: center; background: rgba(255,255,255,.9); border: 1px solid rgba(227,234,248,.9); border-radius: 28px; box-shadow: var(--shadow); }
.state-card h1 { margin: 10px 0 10px; font-size: clamp(25px, 7vw, 34px); letter-spacing: -.8px; }
.state-card > p:not(.eyebrow) { max-width: 390px; margin: 0 auto; color: var(--muted); line-height: 1.65; }
.state-icon { font-size: 44px; }
.tip-box { margin-top: 24px; padding: 14px; border-radius: 14px; background: var(--mist); color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 1.3px; }
.route-loader { position: relative; width: 72px; height: 52px; margin: 0 auto 18px; border-bottom: 4px solid var(--blue); border-radius: 0 0 60% 45%; transform: rotate(-7deg); }
.route-loader::after { content: ""; position: absolute; right: -5px; bottom: -7px; width: 12px; height: 12px; border-radius: 50%; background: var(--coral); }
.route-loader span { position: absolute; width: 11px; height: 11px; left: 3px; bottom: -7px; border-radius: 50%; background: var(--sky); animation: travel 1.35s ease-in-out infinite; }
@keyframes travel { 50% { transform: translate(58px, -19px); } }

.trip-view { display: grid; gap: 16px; }
.trip-hero { position: relative; overflow: hidden; min-height: 230px; padding: 25px 23px; border-radius: 28px; color: white; background: linear-gradient(135deg, #2359e8 0%, #326bff 50%, #55a7ff 100%); box-shadow: 0 22px 55px rgba(50,107,255,.24); }
.trip-hero::before { content: ""; position: absolute; width: 260px; height: 260px; top: -150px; right: -70px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 34px rgba(255,255,255,.035), 0 0 0 74px rgba(255,255,255,.025); }
.hero-topline { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.trip-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.trip-status i { background: #7ef1b5; box-shadow: 0 0 0 4px rgba(126,241,181,.16); }
.updated-at { color: rgba(255,255,255,.72); font-size: 11px; }
.trip-hero h1 { position: relative; z-index: 2; max-width: 82%; margin: 29px 0 9px; font-size: clamp(30px, 9vw, 44px); line-height: 1.08; letter-spacing: -1.4px; }
.destination { position: relative; z-index: 2; margin: 0; color: rgba(255,255,255,.84); font-size: 15px; }
.destination::before { content: "⌖"; margin-right: 6px; }
.hero-meta { position: absolute; z-index: 2; left: 23px; bottom: 23px; display: flex; gap: 10px; }
.hero-meta span { padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.12); backdrop-filter: blur(8px); font-size: 12px; font-weight: 650; }
.route-art { position: absolute; right: -35px; bottom: -53px; width: 190px; height: 140px; border: 2px dashed rgba(255,255,255,.22); border-radius: 50%; transform: rotate(-18deg); }
.route-dot { position: absolute; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--coral); }
.dot-one { left: 13px; top: 42px; }.dot-two { left: 80px; top: 0; }.dot-three { right: 17px; top: 47px; }

.app-choice-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 18px; border: 1px solid rgba(50,107,255,.18); border-radius: 20px; background: linear-gradient(135deg, rgba(234,240,255,.98), rgba(255,255,255,.96)); box-shadow: 0 8px 28px rgba(28,61,125,.07); }
.app-choice-card strong { display: block; margin-bottom: 4px; font-size: 16px; }
.app-choice-card p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.open-app-button { flex: 0 0 auto; display: inline-grid; place-items: center; min-height: 42px; padding: 0 16px; border-radius: 13px; color: white; background: var(--blue); box-shadow: 0 9px 20px rgba(50,107,255,.2); font-size: 13px; font-weight: 750; text-decoration: none; }

.toolbar-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 4px 4px; }
.toolbar-card h2 { margin: 0; font-size: 23px; letter-spacing: -.5px; }
.module-tabs { position: sticky; top: 70px; z-index: 15; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 7px; border: 1px solid rgba(227,234,248,.95); border-radius: 18px; background: rgba(255,255,255,.88); box-shadow: 0 8px 28px rgba(28,61,125,.07); backdrop-filter: blur(16px); }
.module-tab { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 750; cursor: pointer; }
.module-tab span { font-size: 16px; }
.module-tab.active { color: white; background: var(--blue); box-shadow: 0 8px 18px rgba(50,107,255,.2); }
.content-module { display: grid; gap: 13px; }
.primary-button, .secondary-button, .danger-button { min-height: 46px; border: 0; border-radius: 14px; padding: 0 18px; font-weight: 750; cursor: pointer; transition: transform .16s ease, opacity .16s ease; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 10px 22px rgba(50,107,255,.2); }
.primary-button.compact { min-height: 42px; padding: 0 15px; font-size: 13px; }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: scale(.98); }
.primary-button:disabled { opacity: .55; }
.secondary-button { margin-top: 22px; color: var(--blue); background: #eaf0ff; }
.danger-button { margin-right: auto; color: var(--danger); background: #fff0f0; }

.day-tabs { display: flex; gap: 9px; margin: 2px -18px 0; padding: 6px 18px 8px; overflow-x: auto; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { flex: 0 0 auto; display: grid; gap: 2px; min-width: 68px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background: rgba(255,255,255,.82); text-align: left; cursor: pointer; }
.day-tab strong { color: var(--ink); font-size: 14px; }
.day-tab span { font-size: 11px; }
.day-tab.active { border-color: var(--blue); color: rgba(255,255,255,.72); background: var(--blue); box-shadow: 0 9px 20px rgba(50,107,255,.18); }
.day-tab.active strong { color: white; }

.itinerary-list { display: grid; gap: 11px; }
.itinerary-card { position: relative; display: grid; grid-template-columns: 54px 38px 1fr 18px; align-items: start; gap: 9px; padding: 17px 15px; border: 1px solid rgba(227,234,248,.9); border-radius: 20px; color: inherit; background: rgba(255,255,255,.92); box-shadow: 0 8px 26px rgba(28,61,125,.055); text-align: left; cursor: pointer; }
.item-time { padding-top: 7px; color: var(--blue); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.type-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #edf3ff; font-size: 17px; }
.item-content { min-width: 0; }
.item-content h3 { overflow: hidden; margin: 0 0 5px; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.item-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.item-notes { display: -webkit-box; overflow: hidden; margin-top: 6px !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-chevron { padding-top: 7px; color: #acb7c8; font-size: 20px; }
.empty-day { padding: 34px 20px; border: 1px dashed #cad6ec; border-radius: 22px; color: var(--muted); background: rgba(255,255,255,.55); text-align: center; }
.empty-day span { display: block; margin-bottom: 9px; font-size: 31px; }
.empty-day strong { display: block; margin-bottom: 5px; color: var(--ink); }
.privacy-note { display: flex; gap: 12px; margin-top: 8px; padding: 16px; border-radius: 18px; color: var(--muted); background: #eef4ff; font-size: 12px; line-height: 1.5; }
.privacy-note > span { font-size: 20px; }.privacy-note strong { color: var(--ink); }.privacy-note p { margin: 2px 0 0; }

.summary-card { overflow: hidden; padding: 17px 18px; border: 1px solid rgba(227,234,248,.95); border-radius: 20px; background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(237,243,255,.92)); box-shadow: 0 8px 28px rgba(28,61,125,.06); }
.summary-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.summary-content > div:first-child { display: grid; gap: 3px; }
.summary-content span { color: var(--muted); font-size: 11px; font-weight: 750; }
.summary-content strong { color: var(--ink); font-size: 24px; letter-spacing: -.6px; }
.summary-content small { color: var(--muted); font-size: 11px; }
.progress-ring { --progress: 0deg; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--blue); background: radial-gradient(circle closest-side, white 76%, transparent 77% 99%), conic-gradient(var(--blue) var(--progress), #dfe8fa 0); font-size: 11px; font-weight: 800; }
.collaboration-list { display: grid; gap: 10px; }
.collaboration-card { display: grid; align-items: center; gap: 10px; width: 100%; padding: 15px; border: 1px solid rgba(227,234,248,.9); border-radius: 19px; color: inherit; background: rgba(255,255,255,.94); box-shadow: 0 7px 24px rgba(28,61,125,.05); text-align: left; cursor: pointer; }
.packing-card { grid-template-columns: 27px 38px 1fr 18px; }
.expense-card { grid-template-columns: 38px minmax(0,1fr) auto; }
.completion-icon { display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid #bdc9dc; border-radius: 50%; color: white; font-size: 13px; font-weight: 900; }
.packing-card.completed .completion-icon { border-color: #27b36a; background: #27b36a; }
.packing-card.completed .item-content h3 { color: var(--muted); text-decoration: line-through; }
.expense-amount { align-self: start; padding-top: 7px; color: var(--blue); font-size: 15px; white-space: nowrap; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(9,21,44,.4); backdrop-filter: blur(3px); }
.editor-sheet { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; max-height: 92vh; overflow-y: auto; padding: 9px 20px max(22px, env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: white; box-shadow: 0 -20px 60px rgba(18,33,61,.17); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 16px; border-radius: 99px; background: #d8deea; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; max-width: 580px; margin: 0 auto 18px; }
.sheet-header h2 { margin: 0; font-size: 23px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: var(--mist); font-size: 27px; line-height: 1; cursor: pointer; }
#itineraryForm, .editor-form { display: grid; gap: 15px; max-width: 580px; margin: 0 auto; }
#itineraryForm label, .editor-form label { display: grid; gap: 7px; color: #4f5e76; font-size: 12px; font-weight: 700; }
#itineraryForm input, #itineraryForm textarea, #itineraryForm select, .editor-form input, .editor-form textarea, .editor-form select { width: 100%; border: 1px solid var(--line); border-radius: 13px; outline: none; padding: 12px 13px; color: var(--ink); background: #fbfcff; font-size: 15px; font-weight: 500; transition: border-color .15s, box-shadow .15s; }
#itineraryForm textarea, .editor-form textarea { resize: vertical; }
#itineraryForm input:focus, #itineraryForm textarea:focus, #itineraryForm select:focus, .editor-form input:focus, .editor-form textarea:focus, .editor-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(50,107,255,.1); }
.editor-form .toggle-row { display: flex; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcff; font-size: 14px; }
.editor-form .toggle-row input { width: 20px; height: 20px; padding: 0; accent-color: var(--blue); }
.member-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.member-picker legend { margin-bottom: 8px; color: #4f5e76; font-size: 12px; font-weight: 700; }
.member-picker > p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.member-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.editor-form .member-choice { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfcff; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.editor-form .member-choice.selected { border-color: var(--blue); background: #edf3ff; box-shadow: 0 0 0 2px rgba(50,107,255,.08); }
.editor-form .member-choice input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; padding: 0; accent-color: var(--blue); }
.editor-form .member-choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-choice-empty { padding: 14px; border: 1px dashed #cad6ec; border-radius: 13px; color: var(--muted); background: #fbfcff; font-size: 12px; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 4px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; color: var(--danger); background: #fff2f2; font-size: 12px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 34px); padding: 11px 16px; border-radius: 999px; color: white; background: rgba(18,33,61,.94); box-shadow: 0 8px 24px rgba(18,33,61,.22); font-size: 13px; font-weight: 650; white-space: nowrap; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(100%, 760px); margin: 0 auto; padding: 8px 20px max(28px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: var(--blue); font-weight: 650; text-decoration: none; }

@media (min-width: 700px) {
  .topbar { padding-right: 8px; padding-left: 8px; }
  .app-shell { padding-right: 8px; padding-left: 8px; }
  .trip-view { grid-template-columns: 1fr 1.2fr; align-items: start; }
  .trip-hero { position: sticky; top: 88px; grid-row: 1 / span 5; min-height: 420px; }
  .hero-meta { flex-direction: column; align-items: flex-start; }
  .day-tabs { margin-right: 0; margin-left: 0; padding-right: 0; padding-left: 0; }
  .editor-sheet { top: 50%; bottom: auto; left: 50%; width: min(620px, calc(100% - 40px)); max-height: 90vh; border-radius: 25px; transform: translate(-50%, -50%); }
}

@media (max-width: 440px) {
  .app-choice-card { align-items: stretch; flex-direction: column; }
  .open-app-button { width: 100%; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
