:root {
  --paper: #f6f2ea;
  --paper-deep: #ebe4d7;
  --card: #fffdf9;
  --ink: #202b2a;
  --muted: #78817e;
  --line: #e6dfd3;
  --accent: #e87558;
  --accent-deep: #c85e47;
  --teal: #6d9891;
  --teal-deep: #385e5a;
  --yellow: #eecf77;
  --shadow: 0 16px 40px rgba(50, 48, 37, 0.09);
  --soft-shadow: 0 5px 16px rgba(50, 48, 37, 0.07);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #d9d4ca;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #d9d4ca; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #d9d4ca;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(232, 117, 88, 0.35);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 640px;
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px;
  background: var(--paper);
}

.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
  font-weight: 800;
  font-family: Georgia, serif;
  transform: rotate(-8deg);
}
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.04em; }
.app-bar-actions { display: flex; gap: 8px; }
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}
.icon-button.filled { border: 0; background: var(--ink); color: var(--paper); font-size: 22px; line-height: 0; padding-bottom: 9px; }

.trip-hero {
  position: relative;
  margin: 8px 16px 0;
  min-height: 192px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 82% 17%, rgba(255,255,255,.68) 0 4%, transparent 4.5%),
    radial-gradient(circle at 72% 42%, rgba(255,255,255,.48) 0 11%, transparent 11.5%),
    linear-gradient(148deg, #9fc3bd 0%, #6f9c94 49%, #3f6d69 100%);
  color: #fffdf8;
  box-shadow: var(--soft-shadow);
}
.trip-hero::after {
  position: absolute;
  right: -36px;
  bottom: -64px;
  width: 250px;
  height: 150px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  box-shadow: 0 -18px 0 rgba(255,255,255,.12), 0 -36px 0 rgba(255,255,255,.08);
  content: "";
  transform: rotate(-16deg);
}
.hero-content { position: relative; z-index: 1; display: flex; min-height: 192px; flex-direction: column; justify-content: space-between; padding: 20px 20px 18px; }
.hero-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(255,255,255,.8); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.trip-select-button { display: inline-flex; align-items: center; gap: 5px; max-width: 70%; overflow: hidden; border: 0; background: transparent; color: inherit; font-size: 12px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.trip-select-button .chevron { font-size: 15px; opacity: .75; }
.hero-kicker { padding: 5px 9px; border: 1px solid rgba(255,255,255,.32); border-radius: 99px; background: rgba(255,255,255,.12); white-space: nowrap; }
.hero-title { max-width: 88%; margin: 6px 0 0; font-size: clamp(25px, 7vw, 37px); font-weight: 800; letter-spacing: -.07em; line-height: 1.12; }
.hero-meta { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.hero-date { color: rgba(255,255,255,.86); font-size: 12px; font-weight: 600; }
.hero-stat { display: flex; align-items: center; gap: 8px; }
.hero-stat strong { font-size: 25px; line-height: 1; }
.hero-stat span { max-width: 54px; color: rgba(255,255,255,.75); font-size: 10px; line-height: 1.2; }
.hero-edit { border: 0; border-bottom: 1px solid rgba(255,255,255,.52); background: transparent; color: inherit; font-size: 11px; font-weight: 700; }

.view-tabs { display: flex; gap: 20px; padding: 25px 22px 0; border-bottom: 1px solid var(--line); }
.view-tab { position: relative; padding: 0 1px 13px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; letter-spacing: -.03em; }
.view-tab.active { color: var(--ink); }
.view-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); content: ""; }
.tab-count { display: inline-grid; min-width: 17px; height: 17px; margin-left: 2px; padding: 0 4px; place-items: center; border-radius: 99px; background: var(--paper-deep); color: var(--muted); font-size: 10px; vertical-align: 1px; }

.date-strip { display: flex; gap: 9px; overflow-x: auto; padding: 16px 20px 4px; scrollbar-width: none; }
.date-strip::-webkit-scrollbar { display: none; }
.date-chip { flex: 0 0 auto; min-width: 57px; padding: 9px 8px 10px; border: 1px solid transparent; border-radius: 15px; background: transparent; text-align: center; }
.date-chip .weekday { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.date-chip .day { display: block; font-size: 17px; font-weight: 800; }
.date-chip .month { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.date-chip.active { border-color: var(--ink); background: var(--ink); color: white; box-shadow: var(--soft-shadow); }
.date-chip.active .weekday, .date-chip.active .month { color: rgba(255,255,255,.66); }

.view-panel { padding: 16px 16px 122px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 4px 4px 12px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.055em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.subtle-link { border: 0; background: transparent; color: var(--accent-deep); font-size: 11px; font-weight: 800; }

.map-card { position: relative; overflow: hidden; min-height: 305px; border-radius: 22px; background: #bfd0c4; box-shadow: var(--soft-shadow); }
.map-card svg { display: block; width: 100%; height: 305px; }
.map-label { position: absolute; top: 14px; left: 14px; padding: 6px 9px; border-radius: 9px; background: rgba(255,253,249,.84); color: var(--teal-deep); font-size: 10px; font-weight: 800; box-shadow: 0 3px 12px rgba(36,60,53,.09); }
.map-legend { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 9px; background: rgba(255,253,249,.88); color: var(--muted); font-size: 10px; font-weight: 700; }
.legend-line { width: 16px; border-top: 2px dashed var(--accent); }
.map-empty { display: grid; min-height: 305px; padding: 28px; place-items: center; align-content: center; gap: 8px; background: linear-gradient(145deg, #dfe7dd, #c7d8cd); color: var(--teal-deep); text-align: center; }
.map-empty strong { font-size: 15px; }
.map-empty p { max-width: 220px; margin: 0; color: #5f7771; font-size: 12px; line-height: 1.5; }
.route-path { fill: none; stroke: var(--accent); stroke-dasharray: 5 5; stroke-linecap: round; stroke-width: 2.5; }
.route-path.done { stroke: var(--teal-deep); opacity: .45; }
.map-road { fill: none; stroke: rgba(255,255,255,.55); stroke-linecap: round; }
.map-water { fill: #a7c8ca; opacity: .72; }
.map-land { fill: #cedbc9; }
.map-park { fill: #aec9ae; opacity: .76; }
.pin-group { cursor: pointer; }
.pin-dot { fill: var(--accent); stroke: #fffdf9; stroke-width: 3; }
.pin-number { fill: #fffdf9; font-size: 9px; font-weight: 900; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pin-group.current .pin-dot { fill: var(--ink); }
.pin-pulse { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .45; }
.map-caption { display: flex; align-items: center; gap: 7px; margin: 10px 3px 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.caption-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.overview-list { display: grid; gap: 8px; margin-top: 20px; }
.mini-route { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,249,.62); }
.mini-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 10px; font-weight: 900; }
.mini-route strong { display: block; overflow: hidden; font-size: 13px; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.mini-route span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { color: var(--accent-deep); font-size: 11px; font-weight: 800; }

.schedule-summary { display: flex; align-items: center; justify-content: space-between; margin: 1px 3px 15px; }
.schedule-summary strong { font-size: 22px; letter-spacing: -.07em; }
.schedule-summary span { color: var(--muted); font-size: 11px; font-weight: 600; }
.item-list { display: grid; gap: 10px; }
.item-card { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 15px 14px; border: 1px solid var(--line); border-radius: 19px; background: var(--card); box-shadow: 0 2px 0 rgba(32,43,42,.01); }
.item-card::before { position: absolute; top: 18px; bottom: 18px; left: -1px; width: 3px; border-radius: 0 3px 3px 0; background: var(--item-color, var(--accent)); content: ""; }
.item-time { padding-top: 1px; color: var(--ink); font-size: 13px; font-weight: 900; }
.item-time small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.item-main { min-width: 0; }
.item-topline { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.item-name { margin: 0; overflow: hidden; font-size: 15px; font-weight: 850; letter-spacing: -.045em; text-overflow: ellipsis; white-space: nowrap; }
.category-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 99px; background: var(--category-bg, #f6e4dc); color: var(--category-color, var(--accent-deep)); font-size: 9px; font-weight: 800; }
.item-place { display: flex; align-items: center; gap: 4px; margin: 7px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.item-place::before { content: "⌖"; color: var(--accent); font-size: 13px; }
.item-memo { margin: 8px 0 0; color: #65706d; font-size: 11px; line-height: 1.45; }
.flight-line { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:10px; padding:10px; border-radius:11px; background:#e7f0f5; color:#3f6d8a; }
.flight-line span { font-size:9px; font-weight:700; text-align:center; }
.flight-line strong { font-size:13px; }
.item-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 11px; }
.transport-tag, .coordinate-tag { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 7px; background: var(--paper); color: var(--muted); font-size: 9px; font-weight: 700; }
.coordinate-tag { color: var(--teal-deep); }
.item-actions { display: flex; gap: 5px; margin-left: auto; }
.text-action { padding: 4px 2px; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; }
.text-action.delete { color: #ba6a5a; }
.empty-state { display: grid; min-height: 250px; padding: 30px 22px; place-items: center; align-content: center; border: 1px dashed #d8cfc0; border-radius: 21px; background: rgba(255,253,249,.44); text-align: center; }
.empty-icon { display: grid; width: 46px; height: 46px; margin-bottom: 12px; place-items: center; border-radius: 15px; background: #f4dfd4; color: var(--accent-deep); font-size: 25px; font-weight: 300; }
.empty-state strong { font-size: 15px; }
.empty-state p { max-width: 240px; margin: 8px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.small-action { padding: 9px 13px; border: 0; border-radius: 10px; background: var(--ink); color: white; font-size: 11px; font-weight: 800; }

.bottom-action-wrap { position: fixed; z-index: 5; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; padding: 12px 17px max(16px, env(safe-area-inset-bottom)); pointer-events: none; background: linear-gradient(transparent, rgba(246,242,234,.93) 42%); }
.primary-action { display: flex; width: min(100%, 608px); align-items: center; justify-content: center; gap: 9px; padding: 16px 18px; border: 0; border-radius: 17px; background: var(--accent); color: #fffdf9; box-shadow: 0 10px 22px rgba(200, 94, 71, .24); font-size: 14px; font-weight: 850; letter-spacing: -.03em; pointer-events: auto; }
.primary-action:active { transform: translateY(1px); }
.plus-icon { font-size: 22px; font-weight: 300; line-height: 12px; }

.modal-root { position: fixed; z-index: 20; inset: 0; display: flex; align-items: end; background: rgba(24,34,33,.4); }
.modal-root[hidden] { display: none; }
.sheet { width: 100%; max-width: 640px; max-height: min(88svh, 760px); overflow-y: auto; margin: 0 auto; padding: 9px 18px max(22px, env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: var(--paper); box-shadow: 0 -18px 50px rgba(26,36,34,.18); animation: sheet-up .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(16px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 38px; height: 4px; margin: 3px auto 17px; border-radius: 4px; background: #d0c8ba; }
.sheet-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sheet-head h2 { margin: 0; font-size: 20px; letter-spacing: -.06em; }
.sheet-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.close-button { display: grid; width: 28px; height: 28px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: var(--paper-deep); color: var(--muted); font-size: 18px; }
.sheet-actions { display: grid; gap: 8px; }
.sheet-action { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; }
.sheet-action .action-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--paper-deep); color: var(--teal-deep); font-size: 16px; font-weight: 800; }
.sheet-action strong { display: block; font-size: 13px; }
.sheet-action span:not(.action-icon) { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.sheet-action.danger .action-icon { background: #f4dfd8; color: #b65e4c; }
.trip-list { display: grid; gap: 9px; margin-bottom: 14px; }
.trip-row { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); text-align: left; }
.trip-row.active { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(109,152,145,.12); }
.trip-avatar { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: #dbe8df; color: var(--teal-deep); font-size: 15px; font-weight: 900; }
.trip-row-copy { min-width: 0; flex: 1; }
.trip-row-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.trip-row-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.trip-row-check { color: var(--teal-deep); font-size: 16px; font-weight: 900; }
.secondary-action { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 800; }
.form-grid { display: grid; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 10px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 12px 12px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--card); color: var(--ink); font-size: 13px; }
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: #adb2ac; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(109,152,145,.12); }
.form-note { margin: -3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.form-submit { width: 100%; margin-top: 4px; padding: 14px; border: 0; border-radius: 14px; background: var(--ink); color: white; font-size: 13px; font-weight: 850; }
.form-submit.accent { background: var(--accent); }
.danger-button { width: 100%; margin-top: 6px; padding: 11px; border: 0; background: transparent; color: #b95d4a; font-size: 11px; font-weight: 800; }
.checkbox-line { display: flex; align-items: start; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.checkbox-line input { margin-top: 2px; accent-color: var(--accent); }

.help-copy { display: grid; gap: 12px; }
.document-list { display: grid; gap: 9px; }
.document-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto auto; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.document-row .action-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--paper-deep); color: var(--teal-deep); font-size: 9px; font-weight: 900; }
.document-row strong, .document-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-row strong { font-size: 12px; }
.document-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.help-card { padding: 13px; border-radius: 14px; background: var(--card); }
.help-card strong { display: block; font-size: 12px; }
.help-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.warning-box { padding: 12px; border-radius: 13px; background: #f9e9cb; color: #876539; font-size: 10px; line-height: 1.5; }
.app-version { margin-top: 18px; color: #a8a194; font-size: 10px; text-align: center; }

.toast-region { position: fixed; z-index: 30; right: 15px; bottom: max(92px, calc(env(safe-area-inset-bottom) + 78px)); left: 15px; display: grid; justify-items: center; gap: 7px; pointer-events: none; }
.toast { max-width: min(92vw, 440px); padding: 11px 14px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 11px; font-weight: 700; line-height: 1.4; animation: toast-in .2s ease-out; }
.toast.error { background: #a95143; }
@keyframes toast-in { from { transform: translateY(7px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (min-width: 641px) {
  .app-shell { min-height: 100vh; }
  .bottom-action-wrap { right: auto; left: 50%; width: 640px; transform: translateX(-50%); }
}

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