/* 色板喺 theme.css，呢度只寫版面。舖位檔案頁專用 */

.unit-nav-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.nav-arrow-btn {
  font-size: 13px; font-weight: 700; color: var(--text); text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  white-space: nowrap;
}
.nav-arrow-btn.back-to-map { color: var(--accent); }
.nav-arrow-btn.disabled { opacity: .4; pointer-events: none; }

.unit-header { margin-bottom: 14px; }
.unit-header-code { font-size: 13px; font-weight: 800; color: var(--accent); }
.unit-header-street { font-size: 13px; color: var(--muted); }
.unit-header h1 { margin: 4px 0 8px; font-size: 22px; }
.unit-header-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.u-tag {
  background: var(--tag-bg); border: var(--tag-border); border-radius: var(--tag-radius);
  color: var(--tag-fg); box-shadow: var(--tag-shadow);
  padding: 4px 11px; font-size: 12px; font-weight: var(--tag-weight);
}
.u-tag.status-vacant { background: var(--red); color: var(--on-solid); border-color: var(--red); }

.mini-map { width: 100%; height: 180px; border-radius: 12px; margin-bottom: 18px; }
.mini-map.no-coords {
  display: flex; align-items: center; justify-content: center; background: var(--panel);
  color: var(--muted); font-size: 13px;
}

.history-item {
  background: var(--panel); border: var(--card-border); border-left: var(--card-edge);
  border-radius: var(--card-radius); box-shadow: var(--card-shadow);
  padding: var(--card-pad); margin-bottom: 12px;
}
.history-item-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.history-date {
  font-weight: 800; font-size: var(--code-size);
  letter-spacing: var(--code-spacing); color: var(--code-color);
}
.history-campaign-tag {
  font-weight: 500; font-size: 12px; margin-left: 6px; padding: 2px 8px;
  color: var(--muted); vertical-align: middle;
}
.history-changetype { font-size: 12px; color: var(--muted); }
.history-name { font-size: var(--name-size); font-weight: var(--name-weight); margin: 3px 0 8px; }
.history-row { font-size: 13px; color: var(--muted); margin: 2px 0; }
/* 資料來源（2026-08-21）：可以有長連結，要斷得到行唔好撐爆卡片 */
.history-source { overflow-wrap: anywhere; }
.history-source a { color: var(--accent); text-decoration: underline; }
.history-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.history-photos { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.history-photo { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; background: var(--card); cursor: pointer; }
.history-photo[data-failed] { display: none; }

/* ---------- 相片 lightbox（撳縮圖放大）：版面跟 changes.css 嗰份一致，兩頁各自維護一份 CSS。
   舖位檔案頁專有：左右揭掣 + 張數計數（2026-08-11 加，一筆觀察可以有多張相） ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 4000; background: rgba(58,46,32,.85);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: pointer;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.4); }
.lightbox-nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 4001;
  width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(58,46,32,.55); color: #fff; font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-nav-btn:active { background: rgba(58,46,32,.8); }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-counter {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 4001;
  background: rgba(58,46,32,.6); color: #fff; font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; pointer-events: none;
}
@media (min-width: 720px) {
  .lightbox-nav-btn { width: 56px; height: 56px; font-size: 30px; }
  .lightbox-prev { left: 24px; }
  .lightbox-next { right: 24px; }
}

.empty-state {
  background: var(--panel); border-radius: 14px; padding: 20px; margin: 14px 0;
  border: 1px dashed var(--line); text-align: center;
}

/* ---------- 經營階段（Phase 5，2026-08-02） ---------- */
.stage-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.stage-card {
  background: var(--panel); border: var(--card-border); border-left: var(--card-edge);
  border-radius: var(--card-radius); box-shadow: var(--card-shadow);
  padding: var(--card-pad); margin-bottom: 14px;
}
.stage-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stage-title { font-size: var(--name-size); font-weight: var(--name-weight); }
.stage-badge-now {
  flex: 0 0 auto; background: var(--green); color: var(--on-solid); border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 3px 10px;
}
.stage-daterange { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }

.stage-intro { background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.stage-intro-text { font-size: 14px; line-height: 1.6; margin-bottom: 8px; white-space: pre-wrap; }
.stage-intro-empty { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stage-intro-edit-btn {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: var(--accent); font-size: 12px; font-weight: 700; padding: 6px 12px; cursor: pointer;
}
.stage-intro-textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; color: var(--text); font-size: 14px; font-family: inherit; resize: vertical;
  box-sizing: border-box; margin-bottom: 8px;
}
.stage-intro-actions { display: flex; gap: 8px; }

/* ---------- 社群標籤（Phase 7，2026-08-03） ---------- */
.stage-community { background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.community-tags-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.community-tags-current { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.community-tags-empty { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.u-tag.tag-community {
  background: var(--panel); border: 1px solid var(--accent); color: var(--accent); font-weight: 700;
}
.stage-community-edit-btn {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: var(--accent); font-size: 12px; font-weight: 700; padding: 6px 12px; cursor: pointer;
}
.community-edit-hint { font-size: 12px; line-height: 1.6; color: var(--muted); margin-bottom: 10px; }
.community-tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag-toggle-btn {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: 13px; font-weight: 600; padding: 8px 14px; cursor: pointer;
}
.tag-toggle-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-solid); }

.stage-obs-list { display: flex; flex-direction: column; gap: 8px; }
.stage-obs-row { background: var(--bg); border-radius: 10px; padding: 10px 12px; }

.stage-comments { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.stage-comments-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* ---------- 街坊留言 ---------- */
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.comment-item { background: var(--panel); border-radius: 10px; padding: 10px 12px; }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.comment-empty { margin: 0 0 14px; }

.comment-form { background: var(--panel); border-radius: 14px; padding: 16px; border: 1px solid var(--line); }
.cf-turnstile-wrap { margin-top: 14px; }
.comment-form .field-label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.comment-form .field-label:first-child { margin-top: 0; }
.comment-form .text-input {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px; color: var(--text); font-size: 16px; font-family: inherit; box-sizing: border-box;
}
.comment-form textarea.text-input { resize: vertical; }
.comment-form-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 蜜罐欄：移出畫面同輔助工具讀取範圍，但唔用 display:none（部分機械人會跳過 display:none 欄位） */
.hp-field { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-block; border: none; border-radius: 999px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; color: var(--text);
  background: var(--card); cursor: pointer; margin-top: 6px;
}
.btn-primary { background: var(--accent); color: var(--on-solid); }
.btn-small { padding: 8px 12px; font-size: 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.btn-small.btn-save { background: var(--accent); color: var(--on-solid); border-color: var(--accent); }

.u-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 3000; max-width: 90vw; text-align: center;
}
.u-toast.show { opacity: 1; transform: translate(-50%, 0); }
.u-toast.err { background: var(--red); color: var(--on-solid); }

/* ---------- 桌面：維持單欄但收窄（歷史記錄係時序卡片，唔勉強做左右分欄） ---------- */
@media (min-width: 1024px) {
  .doc-wrap { max-width: 640px; }
  .mini-map { height: 260px; }
  .history-photo { width: 104px; height: 104px; }
}

/* F3+（2026-08-13）：舖位頁嘅「幫手更新呢間」入口 */
.unit-record-btn {
  display: inline-block; margin-top: 12px;
  background: var(--accent); color: var(--on-solid);
  border-radius: 10px; padding: 12px 18px; min-height: 44px; box-sizing: border-box;
  font-weight: 800; font-size: 15px; text-decoration: none;
}
