/* ==========================================================================
   plan.css — 行程規劃器
   只給 /plan* 這幾頁用（layout 的 $extraCss 載入），不要塞進 site.css：
   編輯器有一些「應用程式」才需要的樣式（拖曳、黏性面板、對話框），
   混進全站樣式表會讓其他頁的維護變得更難判斷影響範圍。

   版面原則沿用全站：1px hairline 分組、明體標題、密度優先。
   ========================================================================== */

/* ── 共用小元件 ─────────────────────────────────────────────── */

.plan-eyebrow {
  margin: 0 0 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--brand);
  text-transform: uppercase;
}

.plan-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.plan-field > span {
  font-size: .76rem;
  font-weight: 600;
  color: var(--ink-2);
}
.plan-field input,
.plan-field select,
.plan-field textarea {
  font: inherit;
  font-size: .88rem;
  padding: .4rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.plan-field textarea { resize: vertical; line-height: 1.6; }
.plan-field input:focus,
.plan-field select:focus,
.plan-field textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.plan-field-row { display: flex; gap: 10px; }
.plan-field-row .plan-field { flex: 1; }
.plan-field--days { max-width: 110px; }
.plan-field--spa { max-width: 140px; }

.plan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.plan-toggle input { accent-color: var(--brand); width: 15px; height: 15px; }
.plan-toggle--row { display: flex; margin: 10px 0; }

.plan-notice {
  margin: 10px 0;
  padding: 10px 14px;
  background: #fff8e8;
  border: 1px solid #e8d29a;
  border-radius: var(--radius);
  font-size: .84rem;
}

/* 類型標籤：六種資源用同一組色，全站看得到的地方都一致 */
.plan-kind {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid transparent;
}
.plan-kind--spot  { background: #e8f1ee; color: #0b5048; }
.plan-kind--food  { background: #fdf0e6; color: #8f4b1f; }
.plan-kind--award { background: #fbeee0; color: #93551d; border-color: #e2c39a; }
.plan-kind--hotel { background: #eaeef6; color: #2c4a72; }
.plan-kind--event { background: #f4ebf6; color: #6b3d7a; }
.plan-kind--spa   { background: #e7f3f7; color: #1d5c70; }
.plan-kind--free  { background: #f0f0ec; color: #55605c; border-style: dashed; border-color: #c9cbc4; }
/* 出發與回程是「移動」，不是行程中的一站：用描邊而不是填色，
   視覺上比景點輕，才不會讓一天看起來有 6 站。 */
.plan-kind--start,
.plan-kind--end {
  background: #fff;
  color: var(--ink-3);
  border-color: var(--line);
  border-style: dashed;
}
.plan-stop--start .plan-stop__name,
.plan-stop--end .plan-stop__name { font-weight: 600; color: var(--ink-2); }

/* ── /plan 首頁 ─────────────────────────────────────────────── */

.plan-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 34px;
  align-items: start;
  padding-top: 26px;
  padding-bottom: 18px;
}
.plan-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  line-height: 1.42;
  letter-spacing: -.01em;
}
.plan-lead { color: var(--ink-2); font-size: .92rem; line-height: 1.85; max-width: 34em; }

.plan-points { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 9px; }
.plan-points li {
  position: relative;
  padding-left: 20px;
  font-size: .86rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.plan-points li::before {
  content: "";
  position: absolute; left: 4px; top: .55em;
  width: 6px; height: 6px;
  border: 2px solid var(--brand);
  border-radius: 50%;
}
.plan-points b { display: block; color: var(--ink); font-size: .8rem; letter-spacing: .02em; }

.plan-create {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--nav-h) + 12px);
}
.plan-create h2 { margin: 0 0 14px; font-size: 1rem; }
.plan-create .btn { margin-top: 4px; }
.plan-create__note { margin: 10px 0 0; font-size: .72rem; color: var(--ink-3); line-height: 1.6; }
.plan-create__lead { margin: 0 0 14px; font-size: .84rem; color: var(--ink-2); line-height: 1.75; }
.plan-create__lead + .btn { margin-top: 0; }

/* ── AI 排初稿 ────────────────────────────────────────────────
   刻意做成「另一張卡片」而不是塞進手動建立的那張：
   兩者是不同的心智負擔（自己排 vs 讓機器排），
   放在同一個表單裡會讓人以為必須先選完 AI 的條件才能手動建立。 */
.plan-ai {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
  margin: 8px 0 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f7fbfa 0%, #fff 62%);
  box-shadow: var(--shadow-sm);
}
.plan-ai h2 {
  margin: 0 0 10px;
  font-size: 1.16rem;
  line-height: 1.5;
}
.plan-ai__intro p { margin: 0; color: var(--ink-2); font-size: .88rem; line-height: 1.85; max-width: 38em; }
.plan-ai__points { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.plan-ai__points li {
  position: relative;
  padding-left: 18px;
  font-size: .82rem;
  color: var(--ink-2);
}
.plan-ai__points li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-weight: 700;
}
.plan-ai__form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.plan-ai__chips {
  border: 0;
  margin: 0 0 12px;
  padding: 0;
}
/* 縣市清單比興趣多很多，限制高度避免把表單推得太長；
   勾選中的項目要靠顏色才看得出「已經選了哪幾個」。 */
.plan-ai__cities {
  max-height: 168px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}
.plan-ai__cities .plan-chip { margin: 0 5px 5px 0; }
/* :has() 不支援的舊瀏覽器靠 JS 加上 .is-on，
   樣式刻意跟上面 .plan-chip:has(input:checked) 一致。 */
.plan-ai__cities .plan-chip.is-on {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: rgba(15, 107, 92, .06);
  font-weight: 600;
}
.plan-ai__hint {
  margin: 4px 0 0;
  font-size: .74rem;
  color: var(--ink-3);
  line-height: 1.6;
  flex: 1 0 100%;
}
.plan-ai__chips legend {
  font-size: .78rem;
  color: var(--ink-3);
  padding: 0;
  margin-bottom: 6px;
}
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 6px 6px 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--ink-2);
  cursor: pointer;
  background: #fff;
}
.plan-chip input { margin: 0; accent-color: var(--brand); }
.plan-chip:has(input:checked) {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: rgba(15, 107, 92, .06);
  font-weight: 600;
}
.plan-ai__status {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: .78rem;
  line-height: 1.6;
  color: var(--brand-dark);
}
.plan-ai__status.is-error { color: #a4381f; }
.plan-ai__fine { margin: 8px 0 0; font-size: .7rem; color: var(--ink-3); line-height: 1.65; }
.plan-ai__form .btn[disabled] { opacity: .6; cursor: progress; }

/* 我的行程清單 */
.plan-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plan-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-2);
}
.plan-list__main { min-width: 0; flex: 1; }
.plan-list__title {
  font-weight: 700;
  font-size: .96rem;
  color: var(--ink);
}
.plan-list__title:hover { color: var(--brand-dark); }
.plan-list__meta {
  margin: 3px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: .76rem;
  color: var(--ink-3);
}
.plan-list__pub { color: var(--ink-3); }
.plan-list__pub.is-public { color: var(--brand-dark); }
.plan-list__time { margin: 3px 0 0; font-size: .7rem; color: var(--ink-3); }
.plan-list__actions { display: flex; gap: 6px; flex: none; }

.plan-how__steps {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 10px;
  font-size: .86rem;
  color: var(--ink-2);
  line-height: 1.75;
}
.plan-how__steps b { display: block; color: var(--ink); font-size: .84rem; }

/* ── 編輯器 ─────────────────────────────────────────────────── */

.plan-editor { padding-bottom: 40px; }

.plan-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 18px;
  background: rgba(247, 247, 244, .96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.plan-bar__left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 260px; }
.plan-bar__back {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: .76rem; color: var(--ink-3); white-space: nowrap;
}
.plan-bar__back:hover { color: var(--brand-dark); text-decoration: none; }
.plan-bar__title {
  font: inherit;
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .2rem .4rem;
  width: 100%;
  min-width: 0;
}
.plan-bar__title:hover { border-color: var(--line); background: #fff; }
.plan-bar__title:focus { outline: none; border-color: var(--brand); background: #fff; }

.plan-bar__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-bar__field { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; color: var(--ink-3); }
.plan-bar__field input,
.plan-bar__field select {
  font: inherit;
  font-size: .78rem;
  padding: .22rem .4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.plan-bar__field input[type="text"] { width: 104px; }

.plan-bar__right { display: flex; align-items: center; gap: 6px; flex: none; }
.plan-save { font-size: .72rem; color: var(--ink-3); white-space: nowrap; min-width: 62px; text-align: right; }
.plan-save.is-saving { color: var(--accent); }
.plan-save.is-error { color: #b3261e; font-weight: 700; }

.plan-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
  gap: 18px;
  align-items: start;
  padding: 16px 18px 0;
  max-width: 1320px;
  margin: 0 auto;
}

/* 時間軸 */
.plan-timeline { min-width: 0; }
.plan-timeline__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.plan-timeline__title { margin: 0; font-size: 1rem; }
.plan-timeline__sum { margin: 2px 0 0; font-size: .76rem; color: var(--ink-3); }

.plan-dayblock {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.plan-dayblock__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.plan-dayblock__no {
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.plan-dayblock__date { font-size: .76rem; color: var(--ink-3); }
.plan-dayblock__start {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; color: var(--ink-3);
  margin-left: auto;
}
.plan-dayblock__start input {
  font: inherit; font-size: .76rem;
  padding: .16rem .35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.plan-dayblock__stat { font-size: .72rem; color: var(--ink-3); }
.plan-dayblock__drop { min-height: 12px; padding: 4px 0; }

.plan-dayblock__empty {
  padding: 20px 14px;
  text-align: center;
  font-size: .8rem;
  color: var(--ink-3);
  border-bottom: 1px dashed var(--line-2);
}

/* 單一站 */
.plan-item {
  display: grid;
  grid-template-columns: 22px 62px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  background: #fff;
  position: relative;
}
.plan-item:hover { background: #fcfcfb; }
.plan-item.is-dragging { opacity: .45; }
.plan-item.is-over { box-shadow: inset 0 2px 0 var(--brand); }
.plan-item.is-over-end { box-shadow: inset 0 -2px 0 var(--brand); }

.plan-item__grip {
  cursor: grab;
  color: #b6bbb4;
  padding-top: 2px;
  border: 0;
  background: none;
  line-height: 0;
}
.plan-item__grip:active { cursor: grabbing; }

.plan-item__time {
  font-size: .92rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding-top: 1px;
}
.plan-item__time small { display: block; font-size: .66rem; font-weight: 500; color: var(--ink-3); }

.plan-item__body { min-width: 0; }
.plan-item__top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.plan-item__name {
  font-size: .88rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  color: var(--ink);
}
.plan-item__name a { color: inherit; }
.plan-item__name a:hover { color: var(--brand-dark); }
.plan-item__badge {
  font-size: .66rem;
  padding: 0 5px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  color: var(--brand-dark);
  white-space: nowrap;
}
.plan-item__sub { margin: 1px 0 0; font-size: .72rem; color: var(--ink-3); line-height: 1.5; }
.plan-item__note {
  margin: 4px 0 0;
  font-size: .74rem;
  color: var(--ink-2);
  background: var(--brand-light);
  border-left: 2px solid #bcd9d1;
  padding: 3px 7px;
  border-radius: 0 4px 4px 0;
  white-space: pre-line;
}
.plan-item__facts { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .7rem; color: var(--ink-3); }
.plan-item__facts b { font-weight: 600; color: var(--ink-2); }

.plan-item__ops { display: flex; align-items: center; gap: 2px; }
.plan-item__ops button {
  font: inherit;
  font-size: .72rem;
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  color: var(--ink-3);
  padding: 3px 6px;
  cursor: pointer;
  line-height: 1.2;
}
.plan-item__ops button:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.plan-item__ops button[data-op="del"]:hover { color: #b3261e; border-color: #e8b4b0; background: #fdf2f1; }

/* 站與站之間的移動提示（不可拖）
   編輯器與檢視頁共用同一個 class，靠外層容器決定縮排，
   否則兩邊的 padding 會互相覆蓋（後定義者贏）。 */
.plan-leg {
  font-size: .7rem;
  color: var(--ink-3);
}
.plan-leg::before { content: "↓ "; color: #b6bbb4; }
.plan-timeline .plan-leg {
  padding: 5px 12px 5px 96px;
  background: #fbfbfa;
  border-bottom: 1px solid var(--line-2);
}

.plan-dayblock__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #fcfcfb;
}
.plan-additem {
  font: inherit;
  font-size: .76rem;
  font-weight: 600;
  color: var(--brand-dark);
  background: none;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: .25rem .6rem;
  cursor: pointer;
}
.plan-additem:hover { background: var(--brand-light); border-color: var(--brand); }

.plan-addday {
  width: 100%;
  font: inherit;
  font-size: .84rem;
  padding: .6rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}
.plan-addday:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); }

.plan-desc {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.plan-desc summary {
  padding: 7px 12px;
  font-size: .78rem;
  color: var(--ink-2);
  cursor: pointer;
  background: #fcfcfb;
}
.plan-desc textarea {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line-2);
  padding: 9px 12px;
  font: inherit;
  font-size: .84rem;
  line-height: 1.7;
  resize: vertical;
  min-height: 66px;
}
.plan-desc textarea:focus { outline: 2px solid var(--brand); outline-offset: -2px; }

/* 檢視頁地圖上的編號圖釘 */
.plan-pin span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* 右側挑選面板 */
.plan-picker {
  position: sticky;
  top: calc(var(--nav-h) + 60px);
  max-height: calc(100vh - var(--nav-h) - 74px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.plan-picker__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px 6px;
}
.plan-picker__head h2 { margin: 0; font-size: .9rem; }
.plan-picker__ctx { font-size: .68rem; color: var(--ink-3); text-align: right; }

.plan-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.plan-tabs::-webkit-scrollbar { display: none; }
.plan-tab {
  font: inherit;
  font-size: .76rem;
  padding: .38rem .5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}
.plan-tab:hover { color: var(--ink); }
.plan-tab.is-on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 700; }

.plan-search { display: flex; gap: 6px; padding: 8px 10px; }
.plan-search input {
  font: inherit;
  font-size: .82rem;
  flex: 1;
  min-width: 0;
  padding: .32rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.plan-search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.plan-city {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 8px;
  font-size: .72rem;
  color: var(--ink-3);
}
.plan-city select {
  font: inherit;
  font-size: .76rem;
  flex: 1;
  min-width: 0;
  padding: .22rem .4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}

.plan-custom { padding: 4px 10px 10px; border-bottom: 1px solid var(--line-2); }
.plan-picker__hint {
  margin: 0;
  padding: 6px 12px;
  font-size: .7rem;
  color: var(--ink-3);
  background: #fcfcfb;
  border-bottom: 1px solid var(--line-2);
}
.plan-picker__hint:empty { display: none; }

.plan-results {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
}
.plan-res {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-2);
}
.plan-res:hover { background: #fcfcfb; }
.plan-res__thumb {
  width: 52px; height: 42px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  flex: none;
}
.plan-res__thumb img { width: 100%; height: 100%; object-fit: cover; }
.plan-res__thumb--none {
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; color: var(--ink-3); text-align: center; line-height: 1.3;
  border: 1px dashed var(--line);
  background: #fbfbfa;
}
.plan-res__main { min-width: 0; }
.plan-res__name { font-size: .82rem; font-weight: 700; line-height: 1.4; margin: 0; }
.plan-res__sub { margin: 1px 0 0; font-size: .68rem; color: var(--ink-3); line-height: 1.45; }
.plan-res__badge {
  display: inline-block;
  margin-top: 2px;
  font-size: .62rem;
  padding: 0 4px;
  border: 1px solid var(--brand);
  border-radius: 3px;
  color: var(--brand-dark);
}
.plan-res__add {
  font: inherit;
  font-size: .74rem;
  font-weight: 700;
  padding: .22rem .5rem;
  border: 1px solid var(--brand);
  border-radius: 5px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  white-space: nowrap;
}
.plan-res__add:hover { background: var(--brand); color: #fff; }
.plan-res__add[disabled] { opacity: .45; cursor: default; }

.plan-empty {
  padding: 22px 14px;
  text-align: center;
  font-size: .78rem;
  color: var(--ink-3);
  line-height: 1.7;
}

/* 對話框 */
.plan-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.plan-dialog::backdrop { background: rgba(20, 24, 29, .38); }
.plan-dialog__body { padding: 16px 18px 14px; }
.plan-dialog__body h2 { margin: 0 0 12px; font-size: 1rem; }
.plan-dialog__note { font-size: .78rem; color: var(--ink-2); line-height: 1.7; }
.plan-dialog__hint { min-height: 1em; margin: 6px 0 0; font-size: .72rem; color: var(--brand-dark); }
.plan-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.plan-share-url { display: flex; gap: 6px; }
.plan-share-url input {
  font: inherit;
  font-size: .78rem;
  flex: 1;
  min-width: 0;
  padding: .35rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* ── 檢視頁 ─────────────────────────────────────────────────── */

.plan-view { padding-bottom: 30px; }
.plan-view__hero {
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line);
}
.plan-view__hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.35;
}
.plan-view__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: .8rem;
  color: var(--ink-3);
}
.plan-view__private { color: var(--accent); }
.plan-view__route { color: var(--brand-dark); font-weight: 600; }
.plan-view__summary {
  margin: 12px 0 0;
  font-size: .88rem;
  color: var(--ink-2);
  line-height: 1.8;
  max-width: 46em;
  white-space: pre-line;
}
.plan-view__actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.plan-view__saved { margin: 8px 0 0; font-size: .7rem; color: var(--ink-3); }

.plan-view__map { margin: 16px 0 6px; }
.plan-map {
  height: 340px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  z-index: 0;
}
.plan-map__note { margin: 4px 0 0; font-size: .7rem; color: var(--ink-3); }

.plan-day {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.plan-day__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.plan-day__no {
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 600;
}
.plan-day__date { display: flex; align-items: baseline; gap: 5px; font-size: .82rem; color: var(--ink-2); }
.plan-day__date b { font-size: .95rem; }
.plan-day__stat { margin-left: auto; font-size: .74rem; color: var(--ink-3); }
.plan-day__empty { font-size: .82rem; color: var(--ink-3); }

.plan-stops { list-style: none; margin: 0; padding: 0; }
.plan-stop {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.plan-stop__time { font-variant-numeric: tabular-nums; }
.plan-stop__time b { display: block; font-size: 1rem; font-weight: 750; }
.plan-stop__time span { font-size: .68rem; color: var(--ink-3); }

.plan-stop__body { min-width: 0; }
.plan-stop__top { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.plan-stop__name { margin: 0; font-size: .96rem; font-weight: 700; line-height: 1.45; }
.plan-stop__name a { color: var(--ink); }
.plan-stop__name a:hover { color: var(--brand-dark); }
.plan-stop__badge {
  font-size: .66rem;
  padding: 0 5px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  color: var(--brand-dark);
}
.plan-stop__sub { margin: 2px 0 0; font-size: .74rem; color: var(--ink-3); }
.plan-stop__facts {
  margin: 5px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  font-size: .74rem;
  color: var(--ink-2);
}
.plan-stop__facts b { font-weight: 600; color: var(--ink-3); margin-right: 4px; }
.plan-stop__note {
  margin: 6px 0 0;
  font-size: .78rem;
  color: var(--ink-2);
  background: var(--brand-light);
  border-left: 3px solid #bcd9d1;
  padding: 5px 9px;
  border-radius: 0 4px 4px 0;
  white-space: pre-line;
}

.plan-stops .plan-leg {
  margin: 0;
  padding: 5px 0 5px 82px;
  font-size: .72rem;
  color: var(--ink-3);
  list-style: none;
}

.plan-view__foot {
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  font-size: .72rem;
  color: var(--ink-3);
  line-height: 1.7;
}
.plan-view__foot p { margin: 0; }
.plan-view__qr { display: flex; align-items: center; gap: 8px; flex: none; }
.plan-view__qr canvas,
.plan-view__qr img { display: block; width: 72px; height: 72px; }

/* ── 響應式 ─────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .plan-workspace { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 900px) {
  .plan-hero { grid-template-columns: 1fr; gap: 20px; }
  .plan-create { position: static; }
  .plan-ai { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .plan-workspace { grid-template-columns: 1fr; padding: 12px 14px 0; }
  .plan-picker {
    position: static;
    max-height: none;
    order: 2;
  }
  .plan-results { max-height: 420px; }
  .plan-bar { position: static; }
  .plan-bar__title { font-size: .96rem; }
}

@media (max-width: 620px) {
  .plan-item { grid-template-columns: 18px 54px minmax(0, 1fr); }
  .plan-item__ops { grid-column: 2 / -1; justify-content: flex-end; margin-top: -2px; }
  .plan-timeline .plan-leg { padding-left: 72px; }
  .plan-dayblock__start { margin-left: 0; }
  .plan-list__item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .plan-list__actions { width: 100%; }
  .plan-stop { grid-template-columns: 62px minmax(0, 1fr); gap: 8px; }
  .plan-timeline .plan-leg { padding-left: 62px; }
  .plan-view__foot { flex-direction: column; }
  .plan-field-row { flex-wrap: wrap; }
  .plan-map { height: 260px; }
}
