:root {
  color-scheme: light;
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --line: #e3e1db;
  --ink: #1c1b19;
  --ink-2: #55534e;
  --muted: #8a877f;
  --primary: #1c1b19;
  --on-primary: #ffffff;
  --focus: #2a78d6;
  --bar: #2a78d6;
  --critical: #d03b3b;
  --good: #0ca30c;
  --wish: #d55181;
  --flash: #fff6d6;
  --radius: 10px;
  --panel-w: 440px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #151513;
    --surface: #1d1d1b;
    --surface-2: #262624;
    --line: #34332f;
    --ink: #f1f0ec;
    --ink-2: #c3c2b7;
    --muted: #8f8d86;
    --primary: #f1f0ec;
    --on-primary: #1a1a19;
    --focus: #3987e5;
    --bar: #3987e5;
    --critical: #e66767;
    --flash: #3a3420;
  }
}

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

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }

/* ---------- 전체 배치 ---------- */

.app {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.head { padding: 20px 20px 12px; }
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 16px; border-bottom: 1px solid var(--line); }
.tabs-row .tabs { border-bottom: 0; }
.save { display: flex; align-items: center; gap: 8px; flex: none; }
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.save-status[data-kind="saved"]::before { background: var(--good); }
.save-status[data-kind="saving"]::before, .save-status[data-kind="dirty"]::before { background: var(--muted); }
.save-status[data-kind="error"] { color: var(--critical); }
.save-status[data-kind="error"]::before { background: var(--critical); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.card code { font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.head h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.head p { color: var(--ink-2); margin-top: 2px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  border: 0;
  background: none;
  padding: 10px 8px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.view { flex: 1; min-height: 0; }
#view-plan { display: flex; flex-direction: column; }
.view-scroll { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- 날짜 탭 ---------- */

.days {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 14px 16px 0;
}
.day-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  min-width: 0;
}
.day-tab[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.day-tab.drop-target { background: var(--surface-2); border-style: dashed; }
.day-tab-top { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.day-tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.day-tab-date { color: var(--ink-2); font-size: 12px; }
.day-tab-sub { color: var(--muted); font-size: 12px; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.day-head { padding: 14px 20px 10px; }
.day-title { display: flex; align-items: baseline; gap: 8px; }
.day-title .share-copy { margin-left: auto; align-self: center; }
.day-title h2 { font-size: 17px; font-weight: 700; }
.day-title span { color: var(--ink-2); }
.day-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; color: var(--muted); font-size: 13px; margin-top: 2px; }
#travel-total { color: var(--ink-2); }

/* ---------- 검색 ---------- */

.search { position: relative; }
#plan-search { padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--focus); background: var(--surface); }
.search-box input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); min-width: 0; }
.suggest {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 320px;
  overflow-y: auto;
}
#plan-search .suggest { left: 16px; right: 16px; top: 46px; }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.suggest li.on, .suggest li[role="option"]:hover { background: var(--surface-2); }
.suggest strong { font-weight: 600; }
.suggest span { color: var(--muted); font-size: 12px; }
.suggest .suggest-msg { cursor: default; color: var(--ink-2); }

/* ---------- 일정 목록 ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 8px 16px 40px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.empty {
  margin: 8px 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.node {
  display: grid;
  grid-template-columns: 14px 30px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 8px 10px 0;
  border-radius: var(--radius);
  position: relative;
}
.node.anchor { grid-template-columns: 30px 1fr; padding-left: 22px; }
.node:hover { background: var(--surface-2); }
.node.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }

.grip {
  border: 0;
  background: none;
  padding: 6px 2px;
  color: var(--muted);
  cursor: grab;
  opacity: 0;
}
.node:hover .grip, .grip:focus-visible { opacity: 1; }
.item.dragging { opacity: 0.4; }
.item.drop-before { box-shadow: inset 0 2px 0 var(--focus); }
.item.drop-after { box-shadow: inset 0 -2px 0 var(--focus); }

.badge {
  display: grid;
  place-items: center;
  height: 26px;
  min-width: 26px;
  margin-top: 2px;
  padding: 0 6px;
  border-radius: 13px;
  background: var(--c);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.badge-anchor { background: var(--ink); color: var(--surface); border-radius: 6px; font-size: 11px; padding: 0 4px; }

.item-body { min-width: 0; }
.item-row { display: flex; gap: 8px; align-items: center; }
.item-name {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: none;
  font-weight: 600;
  font-size: 15px;
  padding: 2px 4px;
  margin-left: -5px;
  border-radius: 6px;
}
.item-name:hover { border-color: var(--line); }
.item-name:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.item-time {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 2px 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.cost-wrap { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 12px; color: var(--muted); }
.item-amount {
  width: 76px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 2px 6px;
  font-size: 13px;
  color: var(--ink-2);
  text-align: right;
}
.item-amount:placeholder-shown { border-style: dashed; background: none; }
.item-amount:focus { border-style: solid; border-color: var(--focus); outline: none; }
.item-addr { color: var(--muted); font-size: 12px; margin-top: 1px; overflow-wrap: anywhere; }
.time-set {
  flex: none;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: none;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
}
.time-set:hover { border-color: var(--ink-2); color: var(--ink); }
.time-wrap { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.time-clear { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 14px; line-height: 1; }
.time-clear:hover { color: var(--critical); }
.anchor-name { font-weight: 600; padding-top: 3px; }
.item-memo {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 5px 8px;
  resize: none;
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
}
.item-memo:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.item-memo:placeholder-shown { background: transparent; border-color: transparent; padding-left: 4px; }
.item-memo:placeholder-shown:focus { border-color: var(--focus); background: var(--surface); padding-left: 8px; }
.item-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.item-actions a { color: var(--ink-2); text-decoration: none; }
.item-actions a:hover { text-decoration: underline; }
.item-move { border: 0; background: none; color: var(--ink-2); padding: 0; font-size: 12px; cursor: pointer; width: auto; }
.item-actions a, .item-del { white-space: nowrap; }
.item-del { border: 0; background: none; padding: 0; color: var(--muted); margin-left: auto; }
.stay { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.item-stay, .arr-buffer { border: 0; background: none; color: var(--ink-2); padding: 0; font-size: 12px; cursor: pointer; }

/* 배지 밑 도착 시각 */
.badge-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.node-time { font-size: 11px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.node-time.fixed { color: var(--ink); font-weight: 700; }
.node-time.late { color: var(--critical); font-weight: 700; }
.node-note { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.node-note:empty { display: none; }
.node-note.late { color: var(--critical); }
.anchor-ctl { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.anchor-ctl input { width: auto !important; padding: 1px 6px !important; font-size: 12px; }
.anchor-ctl .arr-buffer { border: 1px solid var(--line); border-radius: 6px; padding: 1px 4px; background: var(--surface); }
.item-del:hover { color: var(--critical); }

/* 장소 사이 이동 구간 */
.seg {
  padding: 4px 0 4px 52px;
  position: relative;
  font-size: 12px;
  color: var(--ink-2);
}
.seg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.seg-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 2px 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.seg-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.seg-steps-toggle[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.seg-route { margin-left: auto; }
.seg-mylink { display: flex; align-items: center; gap: 10px; margin-top: 4px; min-height: 22px; }
.seg-mylink a { color: var(--focus); font-weight: 600; text-decoration: none; }
.seg-mylink a:hover { text-decoration: underline; }
.seg-mylink button { border: 0; background: none; padding: 0; font-size: 12px; color: var(--muted); }
.seg-mylink button:hover { color: var(--ink); }
.seg-mylink .seg-link-del:hover { color: var(--critical); }
.seg-mylink .seg-link-input { font-size: 12px; padding: 4px 8px !important; }
.seg-steps {
  list-style: none;
  counter-reset: step;
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seg-steps li { counter-increment: step; display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: baseline; }
.seg-steps li::before { content: counter(step); color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-steps li.muted { display: block; }
.seg-steps li.muted::before { content: none; }
.seg-steps span { color: var(--ink); overflow-wrap: anywhere; }
.seg-steps small { display: block; color: var(--muted); font-size: 11px; }
.seg-steps em { font-style: normal; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg::before {
  content: "";
  position: absolute;
  left: 36px;
  top: -6px;
  bottom: -6px;
  border-left: 2px dotted var(--line);
}
.seg-modes { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-modes button { border: 0; background: var(--surface); padding: 2px 8px; font-size: 12px; color: var(--muted); }
.seg-modes button + button { border-left: 1px solid var(--line); }
.seg-modes button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.seg-info { font-variant-numeric: tabular-nums; }
.seg-min { display: inline-flex; align-items: center; gap: 4px; }
.seg-min input { width: 52px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.seg-link { color: var(--muted); text-decoration: none; margin-left: auto; }

/* 전철 경로 (구글 지도 임베드) */
.route-panel { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; background: var(--surface); }
.route-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.route-head > div { flex: 1; min-width: 0; }
.route-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-head p { font-size: 12px; color: var(--muted); }
.route-panel iframe { flex: 1; width: 100%; border: 0; }
.seg-link:hover { color: var(--ink); text-decoration: underline; }

/* ---------- 지도 ---------- */

.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.map-toggle, .map-legend {
  position: absolute;
  left: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-size: 12px;
}
.map-toggles { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.map-toggle { position: static; display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; }
.lg-wish { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--wish); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.15); }
.lg-friend { display: inline-block; width: 8px; height: 8px; background: #e0a100; transform: rotate(45deg); margin: 0 3px; box-shadow: 0 0 0 1.5px #fff; }
.lg-yt { display: inline-block; width: 12px; height: 9px; border-radius: 2px; background: #e34948; position: relative; margin-right: 2px; }
.lg-yt::after { content: ""; position: absolute; left: 4px; top: 2px; border-left: 4px solid #fff; border-top: 2.5px solid transparent; border-bottom: 2.5px solid transparent; }
.map-legend { bottom: 24px; display: flex; gap: 12px; padding: 6px 10px; color: var(--ink-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--ink-2); }
.lg-walk { border-top-style: dotted; }
.lg-transit { border-top-style: dashed; }
.map-notice {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--surface-2);
}
.map-notice > div {
  width: min(440px, 100%);
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  line-height: 1.6;
}
.map-notice code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

/* 지도 핀 (지도 안에 그려지므로 지도 색과 상관없이 고정색) */
.pin {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 13px;
  background: var(--c);
  color: #fff;
  font: 700 13px/26px "Pretendard Variable", Pretendard, sans-serif;
  text-align: center;
  box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0, 0, 0, 0.35);
  transform: translateY(50%);
  transition: transform 0.12s;
}
.pin.active { transform: translateY(50%) scale(1.3); }
.pin-hotel, .pin-airport { background: #1c1b19; border-radius: 6px; font-size: 11px; padding: 0 6px; }
.pin-wish {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d55181;
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateY(50%);
  cursor: pointer;
}
.pin-wish:hover { transform: translateY(50%) scale(1.4); }
.pin-wish.added, .pin-yt.added { background: #9b9890; opacity: 0.7; }
/* 유튜브 맛집 핀: 빨간 네모 + 흰 재생 삼각형 */
.pin-yt {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  background: #e34948;
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateY(50%);
  cursor: pointer;
  position: relative;
}
.pin-yt::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  border-left: 5px solid #fff;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.pin-yt:hover { transform: translateY(50%) scale(1.4); }
/* 지인 추천 핀: 노란 마름모 */
.pin-friend {
  width: 12px;
  height: 12px;
  background: #e0a100;
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.45);
  transform: translateY(50%) rotate(45deg);
  cursor: pointer;
}
.pin-friend:hover { transform: translateY(50%) rotate(45deg) scale(1.4); }
.pin-friend.added { background: #9b9890; opacity: 0.7; }
.poi-sub { font-size: 12px; color: #6b6862; margin: -6px 0 8px; }
.poi-videos { display: inline-flex; gap: 6px; align-self: center; font-size: 12px; }
.poi-videos a { color: #c0392b; }
.poi-note { font-size: 12px; color: #55534e; align-self: center; }
.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font: 700 10px/18px "Pretendard Variable", Pretendard, sans-serif;
  text-align: center;
  opacity: 0.8;
  box-shadow: 0 0 0 2px #fff;
  transform: translateY(50%);
}

.poi { font-family: "Pretendard Variable", Pretendard, sans-serif; max-width: 260px; color: #1c1b19; }
.poi strong { font-size: 15px; }
.poi p { color: #6b6862; font-size: 12px; margin: 2px 0 10px; }
.poi-actions { display: flex; gap: 6px; }
.poi .btn { color: #1c1b19; background: #fff; border-color: #e3e1db; }
.poi .btn-primary { background: #1c1b19; color: #fff; border-color: #1c1b19; }

/* ---------- 공통 카드·폼 ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  margin: 0;
  min-width: 0;
}
.card h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
fieldset.card legend { font-weight: 700; padding: 0 4px; margin-left: -4px; }
fieldset.card legend .muted { font-weight: 400; font-size: 12px; margin-left: 4px; }

.form-row { display: flex; gap: 8px; }
.form-row > * { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
input:not([type="checkbox"]):not([type="radio"]):not(.item-name):not(.item-time):not(.item-amount):not([type="file"]),
select:not(.item-move):not(.item-stay):not(.arr-buffer),
textarea:not(.item-memo) {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 10px;
  width: 100%;
}
.search-box input { padding: 0 !important; border: 0 !important; background: none !important; }
.seg-min input { width: 52px !important; padding: 1px 6px !important; }
.item-time { width: auto; }
.card .field + .field, .card .field { margin-top: 0; }
#view-trip .card > .field { margin-top: 10px; }
#hotel-search { margin-top: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); opacity: 0.9; }
.btn-danger { color: var(--critical); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.link { border: 0; background: none; padding: 0; color: var(--ink-2); text-decoration: underline; font-size: 12px; }
.check { display: flex; gap: 8px; align-items: baseline; }
.check .muted { font-size: 12px; }

.hotel { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hotel p { font-size: 12px; margin-top: 2px; }

/* ---------- 경비 ---------- */

.summary { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.stat { display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.budget { display: flex; flex-direction: column; gap: 8px; }
.budget-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.input-unit { display: inline-flex; align-items: center; gap: 4px; flex: 1; color: var(--ink-2); }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--bar); }
.meter.over span { background: var(--critical); }
.meter-text { font-size: 12px; color: var(--ink-2); }
.status-critical { color: var(--critical); font-weight: 700; }

.fx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.fx-row label { display: flex; align-items: center; gap: 6px; }
.fx-row .input-unit input { width: 84px; }
.fx-row .muted { font-size: 12px; }

.expense-form { display: flex; flex-direction: column; gap: 8px; }
.expense-form h3 { margin-bottom: 2px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none !important; }
.toggle label { position: relative; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.toggle span { display: block; padding: 7px 14px; color: var(--muted); }
.toggle label + label span { border-left: 1px solid var(--line); }
.toggle input:checked + span { background: var(--ink); color: var(--surface); }
.toggle input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.form-foot { display: flex; align-items: center; gap: 8px; }
.form-foot .form-preview { flex: 1; font-variant-numeric: tabular-nums; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { color: var(--ink-2); }
.bar-track { height: 10px; }
.bar { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; background: var(--bar); }
.bars li:hover .bar { filter: brightness(1.1); }
.bar-value { font-variant-numeric: tabular-nums; text-align: right; }
.bar-value small { color: var(--muted); margin-left: 6px; display: inline-block; min-width: 30px; }

.ex-group + .ex-group { margin-top: 12px; }
.ex-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 0 0 4px; border-bottom: 1px solid var(--line); }
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-row {
  display: grid;
  grid-template-columns: auto 1fr auto 24px;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ex-row:hover, .ex-row.editing { background: var(--surface-2); }
.tag { font-size: 11px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.ex-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ex-amt small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.ex-del { border: 0; background: none; color: var(--muted); padding: 4px; display: grid; place-items: center; border-radius: 4px; }
.ex-del:hover { color: var(--critical); }

/* ---------- 가고 싶은 곳 ---------- */

.wish-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wish-head > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.wish-head .muted { font-size: 12px; }
.wish-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.wish-tools .wish-day { flex: 1 1 100%; }
.wish-tools .wish-q { flex: 1; }
.wish-tools .wish-sort { width: auto !important; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink-2); }
.chip span { color: var(--muted); margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip[aria-pressed="true"] span { color: inherit; opacity: 0.7; }
.wish-hint { font-size: 12px; }
.wish-list ul { list-style: none; margin: 0; padding: 0; }
.wish-group + .wish-group { margin-top: 12px; }
.wish-group-head { font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 0 2px 4px; border-bottom: 1px solid var(--line); }
.wish-group-head span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.wish-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.wish-row:hover { background: var(--surface-2); }
.wish-row.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--ink-2); }
.wish-main { display: flex; flex-direction: column; min-width: 0; }
.wish-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wish-main span { font-size: 12px; color: var(--muted); }
.wish-side { display: flex; align-items: center; gap: 10px; flex: none; }
.wish-added { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 4px; padding: 2px 6px; }
.wish-srcs { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wish-src { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wish-src .check { align-items: center; }
.wish-src .muted { font-size: 12px; }
.wish-map { flex: none; align-self: flex-start; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wish-map .muted { font-size: 12px; }
.wish-row.wish-hidden .wish-main { opacity: 0.5; }
.wish-hide { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.wish-hide:hover { background: var(--surface-2); color: var(--ink-2); }
.wish-hide[aria-pressed="true"] { color: var(--ink-2); }
.wish-videos { display: flex; gap: 8px; font-size: 12px; }
.wish-videos a { color: var(--critical); text-decoration: none; }
.wish-videos a:hover { text-decoration: underline; }
.wish-check { font-style: normal; color: var(--critical); }
.tag-gf { color: #a3365f; border-color: #e8b4c8; }
.tag-yt { color: #b32d2c; border-color: #f0b0af; }
.tag-friend { color: #8a6200; border-color: #ecd28c; }

/* ---------- 알림 ---------- */

.toast {
  position: fixed;
  left: calc(var(--panel-w) / 2);
  bottom: 24px;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(var(--panel-w) - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  background: #1c1b19;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: #9ec5f4; font-weight: 700; padding: 0; white-space: nowrap; }

/* ---------- 폰 (좁은 화면): 위 지도, 아래 일정 ---------- */

.map-size { display: none; }

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--map-h, 42dvh) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
  }
  :root[data-map="small"] { --map-h: 26dvh; }
  :root[data-map="big"] { --map-h: 72dvh; }
  .map-wrap { order: -1; border-bottom: 1px solid var(--line); }
  .panel { border-right: 0; min-height: 0; }

  .head { display: flex; align-items: baseline; gap: 8px; padding: 10px max(14px, env(safe-area-inset-left)) 6px; }
  .head h1 { font-size: 16px; white-space: nowrap; }
  .head p { font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs-row { padding-right: 10px; }
  .tabs { padding: 0 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 9px 6px; white-space: nowrap; font-size: 13px; }
  #save-now { display: none; }

  .view-scroll { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .timeline { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .item-actions { flex-wrap: wrap; row-gap: 6px; }

  /* 지도 위 버튼: 작게, 범례는 숨김 */
  .map-toggles { top: 8px; left: 8px; right: 8px; gap: 4px; }
  .map-toggle { padding: 5px 8px; font-size: 11px; }
  .map-legend { display: none; }
  .map-size { display: flex; position: absolute; left: 8px; bottom: 30px; top: auto; font-weight: 600; z-index: 4; }

  .route-head { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .route-head p { display: none; }

  .toast { left: 50%; max-width: calc(100% - 32px); bottom: calc(16px + env(safe-area-inset-bottom)); }

  /* iOS는 16px보다 작은 입력칸을 누르면 화면을 확대해버림 */
  input, select, textarea { font-size: 16px !important; }
}
