/* ============================================================
   寓所 YUSO — Premium Warm White 設計系統（PHASE 2 · 2026-09-26）
   暖白底／白卡片／近黑文字與主要按鈕／古銅金只做點綴。
   所有顏色只從 :root 取用；後台（admin）區塊沿用同一組 token，
   樣式規則本身維持原樣（見下方「後台」區段）。
   ============================================================ */
:root {
  /* ---- 色票（唯一色彩來源） ---- */
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --surface-secondary: #F4F1EC;
  --surface-tint: #F8F5EF;
  --text-primary: #1D1C1A;
  --text-secondary: #6E6860;
  --text-tertiary: #9A938A;
  --ink: #1D1C1A;
  --ink-hover: #3A3833;
  --accent: #B09360;          /* 古銅金：只用在點綴（徽章、數字、焦點框） */
  --accent-strong: #8C7142;
  --accent-soft: rgba(176, 147, 96, 0.12);
  --border: #E9E4DC;
  --border-strong: #D9D2C6;
  --danger: #B4483B;

  /* ---- 形狀／陰影／動態 ---- */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-soft: 0 1px 2px rgba(29, 28, 26, 0.04), 0 2px 8px rgba(29, 28, 26, 0.04);
  --shadow-mid: 0 2px 6px rgba(29, 28, 26, 0.05), 0 12px 32px rgba(29, 28, 26, 0.08);
  --shadow-strong: 0 8px 24px rgba(29, 28, 26, 0.10), 0 24px 56px rgba(29, 28, 26, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --tap: 44px;

  /* ---- 版面 ---- */
  --container: 1240px;
  --gutter: 24px;
  --header-h: 64px;
  --agent-bar-h: 72px;
  --fab-size: 52px;
  /* 頁面最底部預留給 AI 懸浮按鈕的一條空間（按鈕高度＋與業務欄的間距），
     讓最後一張卡片／分頁／空狀態不會被按鈕蓋住 */
  --fab-lane: 48px;

  /* 向下相容別名——後台頁面與舊樣式仍使用這些名稱 */
  --glass: var(--surface);
  --blue: var(--accent);
  --blue-light: var(--accent-strong);
  --yellow: var(--accent-strong);
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 底部固定業務欄的空間（含手機安全區域）；AI 懸浮按鈕的空間由各頁主要
     內容區塊的 padding-bottom: var(--fab-lane) 預留，不是一整塊空白 */
  padding-bottom: calc(var(--agent-bar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; }

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 10px max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
  background: rgba(250, 248, 244, 0.96);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 0;
  color: var(--text-primary);
}
/* 後台頁面的品牌列仍是 emoji＋分隔線寫法 */
.brand .emoji { font-size: 20px; }
.brand .divider { color: var(--accent); font-weight: 400; margin: 0 2px; }

/* 品牌標誌：/brand/yuso-mark.png（官方 YUSO logo 的網頁版：274×90，約 3.04:1，
   為 30px 顯示高度的 3 倍解析度）。固定高度、寬度自動，維持原始比例不變形。 */
.brand-logo {
  display: block;
  height: 30px;
  width: auto;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.1em; } /* 官方 logo 已含 YUSO 字樣，文字只留「寓所」 */
.brand-sub { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.12em; margin-top: 2px; }

.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.header-nav a:hover { color: var(--text-primary); background: var(--surface-secondary); }
.header-nav a.is-current { color: var(--text-primary); }
.header-nav .nav-fav { border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); }
.header-nav .nav-fav .icon { width: 16px; height: 16px; }

/* ---------------- Hero + 搜尋 ---------------- */
.hero {
  padding: 56px var(--gutter) 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.hero-inner { max-width: calc(var(--container) - 2 * var(--gutter)); margin: 0 auto; }
.hero-inner .search-bar { max-width: 1040px; }
.hero-eyebrow {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--accent-strong);
}
.hero-title {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 28px;
  font-size: 14px;
  color: var(--text-secondary);
}
.hero-meta strong { color: var(--text-primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* 通用 hero（收藏頁等）也可只放標題 */
.hero h1 { margin: 0; }

.search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-mid);
  padding: 10px;
  width: 100%;
}
.search-main { display: flex; gap: 8px; align-items: stretch; }
.search-keyword {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 16px;
  min-height: 52px;
  border-radius: var(--radius);
  background: var(--surface-tint);
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: border-color .2s var(--ease), background .2s var(--ease);
  cursor: text;
}
.search-keyword:focus-within { border-color: var(--border-strong); background: var(--surface); }
.search-keyword input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
  font-size: 15px;
  padding: 0;
  height: 50px;
}
.search-keyword input::placeholder { color: var(--text-tertiary); }
.search-submit { min-width: 108px; min-height: 52px; font-size: 15px; }

.filter-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.filter-toggle-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11.5px;
  line-height: 20px;
  text-align: center;
}
.filter-toggle-count[hidden] { display: none; }

.filter-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 12px 6px;
  border-radius: var(--radius-sm);
  transition: background .2s var(--ease);
}
.field:hover { background: var(--surface-tint); }
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.field select,
.tag-filter-btn {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 4px 22px 4px 0;
  border: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236E6860' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 2px center / 12px;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.field select:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.field:has(select:disabled):hover { background: transparent; }
.field select:focus-visible, .tag-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ---------------- 按鈕 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--surface); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.btn-primary { background: var(--ink); color: var(--surface); }
.btn.outline {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn.outline:hover { border-color: var(--ink); background: var(--surface); color: var(--text-primary); }
.btn.btn-gold { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn .icon { width: 17px; height: 17px; }
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 4px;
}
.btn-text:hover { color: var(--text-primary); text-decoration-color: currentColor; }

/* ---------------- 特色篩選 dropdown ---------------- */
.tag-filter-wrap { position: relative; }
#tagFilterCount { color: var(--accent-strong); font-weight: 700; margin-left: 2px; }
.tag-filter-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 440px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-strong);
  animation: fade-drop .18s var(--ease);
}
.tag-filter-panel[hidden] { display: none; }
.feature-group { margin-bottom: 14px; }
.feature-group:last-of-type { margin-bottom: 0; }
.feature-group-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.feature-check-row { display: flex; flex-wrap: wrap; gap: 6px; }
.feature-check-row label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.feature-check-row label:hover { border-color: var(--border-strong); color: var(--text-primary); }
/* 原生 checkbox 隱藏；勾選狀態靠 JS 幫 label 加 is-checked class */
.feature-check-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.feature-check-row label.is-checked { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.feature-group.cat-promo label.is-checked { background: var(--accent); border-color: var(--accent); }
.tag-filter-clear {
  display: block;
  margin-top: 14px;
  min-height: 36px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* ---------------- 物件列表 ---------------- */
.listing-section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px var(--gutter) var(--fab-lane);
}
.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px 24px;
  width: 100%;
  min-width: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-secondary);
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface-secondary);
  transition: transform .6s var(--ease);
}
.card-badge {
  position: absolute;
  top: 12px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}
.card-badge-gold { left: 12px; background: var(--accent); color: var(--surface); }
.card-badge-units { right: 12px; background: rgba(255, 255, 255, 0.94); color: var(--text-primary); }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 16px 18px 18px;
}
.card-location {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-matched-rooms { font-size: 12.5px; color: var(--text-secondary); }
.card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
}
.price-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.price-unit { font-size: 13px; color: var(--text-secondary); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-width: 0; }
.card-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* 只在真的有滑鼠 hover 的裝置上有效果：照片極輕微放大＋陰影，不浮起卡片
   （觸控裝置點一下會殘留 :hover 狀態）。 */
@media (hover: hover) and (pointer: fine) {
  .card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-mid); }
  .card:hover .card-img { transform: scale(1.03); }
}

/* 骨架卡片 */
.card-skeleton { pointer-events: none; }
.sk { background: var(--surface-secondary); border-radius: 6px; animation: sk-pulse 1.4s ease-in-out infinite; }
.sk-img { width: 100%; height: 100%; border-radius: 0; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-price { height: 18px; margin-top: 12px; }
.sk-w30 { width: 30%; } .sk-w40 { width: 40%; } .sk-w60 { width: 60%; } .sk-w90 { width: 90%; }
@keyframes sk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------------- 空狀態 ---------------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 72px 20px;
  color: var(--text-secondary);
}
.empty-title { font-size: 17px; font-weight: 600; color: var(--text-primary); }
.empty-sub { margin-top: 6px; font-size: 14px; color: var(--text-secondary); }
.empty-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.empty-mark {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent-strong);
}
.empty-mark .icon { width: 24px; height: 24px; }

/* ---------------- 分頁 ---------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 40px 0 8px;
  flex-wrap: wrap;
  padding: 0 12px;
}
.pager button {
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .2s var(--ease);
}
.pager button:disabled { opacity: 0.35; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--ink); }
.pager .pager-info { font-size: 13.5px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 首頁物件分頁（.listing-pager）：頁碼資訊與按鈕分開兩塊。桌機排成
   「‹ 上一頁｜第 X / Y 頁・共 N 筆｜下一頁 ›」一列；手機版見響應式區段。
   後台 dashboard 的 .pager 不受影響。 */
.listing-pager { gap: 20px; }
.listing-pager .pager-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-align: center;
  line-height: 1.35;
}
.listing-pager .pager-page { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.listing-pager .pager-total { font-size: 13px; color: var(--text-secondary); }
.listing-pager .pager-buttons { display: contents; }
.listing-pager #pagerPrev { order: -1; }
.listing-pager #pagerNext { order: 1; }
.listing-pager button { min-width: 128px; }
.listing-pager button:disabled { opacity: 0.35; }
.listing-pager button:disabled:active { transform: none; }

/* ---------------- 收藏頁標題 ---------------- */
.page-head {
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px var(--gutter) 8px;
}
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-size: 14px;
  color: var(--text-secondary);
}
.page-back:hover { color: var(--text-primary); }
.page-title { margin: 6px 0 4px; font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: 0.02em; }
.page-sub { margin: 0; color: var(--text-secondary); font-size: 14.5px; }

/* ---------------- 物件詳情頁 ---------------- */
.detail-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px var(--gutter) var(--fab-lane);
  width: 100%;
}
.detail-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-secondary);
  width: 100%;
  height: clamp(280px, 40vw, 560px);
}
.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 56px;
  margin-top: 36px;
  align-items: start;
}
.detail-main { min-width: 0; }
.detail-location {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}
.detail-title {
  margin: 8px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.detail-address { margin-top: 8px; font-size: 14.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.detail-head-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.detail-price-inline { display: none; margin-top: 16px; align-items: baseline; gap: 8px; }
.detail-price-inline .price-num { font-size: 26px; }

.detail-facts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin-top: 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.fact { padding: 18px 16px 18px 0; min-width: 0; }
.fact + .fact { padding-left: 16px; border-left: 1px solid var(--border); }
.fact-label { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-tertiary); }
.fact-value { margin-top: 4px; font-size: 16px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.detail-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.detail-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
}
.detail-chip.is-promo { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.detail-chip.is-location { color: var(--text-secondary); }

.detail-section { margin-top: 44px; }
.section-title {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.section-title small { font-size: 13.5px; font-weight: 500; color: var(--text-secondary); margin-left: 8px; letter-spacing: 0; }
.detail-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 房號卡片 */
.unit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.unit-body { padding: 18px 20px 20px; }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.unit-name { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.unit-price { display: flex; align-items: baseline; gap: 4px; }
.unit-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13.5px; color: var(--text-secondary); }
.unit-facts span + span::before { content: "·"; margin-right: 16px; color: var(--border-strong); }
.unit-note { margin-top: 12px; font-size: 14px; line-height: 1.8; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------- 房號照片：左右滑動 carousel ---------------- */
.unit-gallery-wrap { position: relative; }
.unit-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--surface-secondary);
}
.unit-gallery::-webkit-scrollbar { display: none; }
.unit-gallery img {
  flex: 0 0 100%;
  width: 100%;
  /* 圖片還沒載入前就先佔好 4:3 的位置，避免載入後版面跳動 */
  aspect-ratio: 4 / 3;
  height: auto;
  max-height: 460px;
  scroll-snap-align: start;
  background: var(--surface-secondary);
  object-fit: cover;
  margin: 0;
  display: block;
}
.unit-gallery-empty {
  aspect-ratio: 16 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-secondary);
  color: var(--text-tertiary);
  font-size: 13.5px;
  letter-spacing: 0.08em;
}
.unit-gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(29, 28, 26, 0.62);
  color: var(--surface);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.unit-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  z-index: 2;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.unit-gallery-wrap:hover .unit-gallery-arrow:not(:disabled),
.unit-gallery-arrow:focus-visible { opacity: 1; }
.unit-gallery-arrow.prev { left: 12px; }
.unit-gallery-arrow.next { right: 12px; }
.unit-gallery-arrow:disabled { opacity: 0 !important; pointer-events: none; }
/* 觸控裝置：用滑的，不顯示箭頭 */
@media (hover: none) { .unit-gallery-arrow { display: none; } }

/* 右側聯絡卡（桌機） */
.detail-aside { position: sticky; top: calc(var(--header-h) + 24px); }
.aside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-mid);
  padding: 24px;
}
.aside-label { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; color: var(--text-tertiary); }
.aside-price { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.aside-price .price-num { font-size: 30px; }
.aside-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-secondary); }
.aside-actions { display: grid; gap: 10px; margin-top: 20px; }
.aside-actions .btn { width: 100%; min-height: 48px; font-size: 15px; }
.aside-agent {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-secondary);
}
.aside-agent strong { color: var(--text-primary); font-weight: 600; }
.aside-ai { margin-top: 14px; width: 100%; justify-content: center; }
/* 桌機詳情頁：AI 管家入口放進右側聯絡卡，懸浮按鈕隱藏，避免蓋住預約按鈕 */
@media (min-width: 1100px) {
  .page-detail .ai-concierge-fab { display: none !important; }
}

/* 舊版標籤 chip（後台或其他頁面若仍使用 TagDict.renderTagChips） */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; min-width: 0; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
}
.tag-chip.cat-promo { border-color: var(--accent); color: var(--accent-strong); }

/* ---------------- 底部固定業務欄 ---------------- */
.agent-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--agent-bar-h);
  padding: 12px max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter))) calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(29, 28, 26, 0.04);
}
.agent-info { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface-secondary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 15px;
}
.agent-text { min-width: 0; line-height: 1.35; }
.agent-name { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.agent-role { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.agent-phone { font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.agent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.agent-actions .btn { min-height: var(--tap); padding: 0 20px; }
.fav-btn .icon { width: 17px; height: 17px; }
.fav-btn.is-active { border-color: var(--accent); color: var(--accent-strong); }
.fav-btn.is-active .icon { fill: var(--accent); stroke: var(--accent); }
.fav-btn.is-error { border-color: var(--danger); color: var(--danger); }

/* ---------------- AI 懸浮按鈕（首頁小工具／詳情頁 AI 管家共用） ---------------- */
.ai-concierge-fab {
  position: fixed;
  right: max(20px, calc((100% - var(--container)) / 2 + var(--gutter)));
  bottom: calc(var(--agent-bar-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px 0 8px;
  max-width: calc(100vw - 32px);
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-strong);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: background .2s var(--ease), transform .12s var(--ease);
}
.ai-concierge-fab:hover { background: var(--ink-hover); }
.ai-concierge-fab:active { transform: scale(0.97); cursor: grabbing; }
.ai-concierge-fab-emoji {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.ai-concierge-fab-emoji svg { width: 18px; height: 18px; fill: var(--accent); }

.ai-concierge-greeting {
  position: fixed;
  right: max(20px, calc((100% - var(--container)) / 2 + var(--gutter)));
  bottom: calc(var(--agent-bar-h) + 80px + env(safe-area-inset-bottom, 0px));
  z-index: 66;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-strong);
  animation: fade-rise .22s var(--ease);
}
.ai-greeting-eyebrow {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent-strong);
}
.ai-concierge-greeting p { margin: 0 0 14px; font-size: 14px; line-height: 1.65; color: var(--text-primary); padding-right: 24px; }
.ai-concierge-greeting p.ai-greeting-eyebrow { margin-bottom: 6px; font-size: 11.5px; color: var(--accent-strong); }
.ai-concierge-greeting-close {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 15px;
}
.ai-concierge-greeting-close:hover { background: var(--surface-secondary); color: var(--text-primary); }
.ai-concierge-greeting-actions { display: flex; flex-direction: column; gap: 8px; }
.ai-concierge-greeting-actions button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 10px 40px 10px 14px;
  text-align: left;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.ai-concierge-greeting-actions button::after {
  content: "›";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-tertiary);
}
.ai-concierge-greeting-actions button small { font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.ai-concierge-greeting-actions button:hover { border-color: var(--border-strong); background: var(--surface); }

/* 聊天視窗（由 ai-concierge-widget.js 動態插入時使用這些 class） */
.ai-concierge-window {
  position: fixed;
  z-index: 70;
  right: max(20px, calc((100% - var(--container)) / 2 + var(--gutter)));
  bottom: calc(var(--agent-bar-h) + 16px + env(safe-area-inset-bottom, 0px));
  width: 380px;
  max-width: calc(100vw - 24px);
  height: min(72vh, 600px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fade-rise .25s var(--ease);
}
.ai-concierge-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ai-concierge-window-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-concierge-window-title .ai-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  flex-shrink: 0;
}
.ai-avatar svg { width: 17px; height: 17px; fill: var(--accent); }
.ai-concierge-window-title strong { display: block; font-size: 15px; font-weight: 700; }
.ai-concierge-window-title small { display: block; font-size: 12px; color: var(--text-secondary); }
.ai-concierge-window-header strong { font-size: 15px; }
.ai-concierge-window-close {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
}
.ai-concierge-window-close:hover { background: var(--surface-secondary); color: var(--text-primary); }
.ai-concierge-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-tint);
  overscroll-behavior: contain;
}
.ai-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: fade-rise .2s var(--ease);
}
.ai-msg.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--text-primary);
}
.ai-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--surface);
  border-bottom-right-radius: 6px;
}
.ai-msg.typing { color: var(--text-secondary); }
.ai-msg.typing::after {
  content: "";
  display: inline-block;
  width: 18px;
  margin-left: 6px;
  height: 6px;
  vertical-align: middle;
  background:
    radial-gradient(circle, var(--accent) 2.5px, transparent 3px) 0 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--accent) 2.5px, transparent 3px) 6px 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--accent) 2.5px, transparent 3px) 12px 50% / 6px 6px no-repeat;
  animation: typing-fade 1.2s ease-in-out infinite;
}
@keyframes typing-fade { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.ai-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.ai-actions-row button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s var(--ease);
}
.ai-actions-row button:hover { border-color: var(--ink); }
.ai-concierge-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ai-concierge-input-row input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-primary);
  font-size: 14.5px;
  outline: none;
  transition: border-color .2s var(--ease);
}
.ai-concierge-input-row input:focus { border-color: var(--border-strong); background: var(--surface); }
.ai-concierge-input-row button {
  width: var(--tap);
  height: var(--tap);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
  transition: background .2s var(--ease), transform .12s var(--ease);
}
.ai-concierge-input-row button:hover { background: var(--ink-hover); }
.ai-concierge-input-row button:active { transform: scale(0.95); }
.ai-concierge-input-row button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-reco-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s var(--ease);
}
.ai-reco-card:hover { border-color: var(--border-strong); }
.ai-reco-card .pct { font-size: 12px; font-weight: 600; color: var(--accent-strong); letter-spacing: 0.04em; }
.ai-reco-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; display: block; }

/* ---------------- Modal（AI 搜尋、租補試算） ---------------- */
.ai-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(29, 28, 26, 0.36);
  animation: fade-in .2s var(--ease);
}
.ai-modal-overlay[hidden] {
  display: none !important; /* .ai-modal-overlay 寫死 display:flex，一定要明確蓋掉 hidden 屬性才會真的隱藏 */
}
.ai-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-strong);
  animation: fade-rise .25s var(--ease);
}
.ai-modal-close { position: absolute; top: 12px; right: 12px; }
.ai-modal-title { margin: 0 0 8px; font-size: 21px; font-weight: 700; letter-spacing: 0.02em; padding-right: 32px; }
.ai-modal-sub { margin: 0 0 20px; font-size: 14px; line-height: 1.75; color: var(--text-secondary); }
.ai-modal-sub strong { color: var(--text-primary); }
.ai-modal-actions { display: grid; gap: 10px; }
.ai-modal-actions .btn { width: 100%; min-height: 48px; }
.ai-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.ai-search-wrap:focus-within { border-color: var(--border-strong); background: var(--surface); }
.ai-search-wrap input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
  font-size: 15px;
}
.ai-search-wrap input::placeholder { color: var(--text-tertiary); }
.ai-search-wrap .btn { flex-shrink: 0; }
.ai-search-status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--accent-strong);
  white-space: pre-line;
}
.ai-modal-card .ai-actions-row { margin-top: 10px; }

/* ---------------- 動態 ---------------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

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


/* ---------------- 後台 ---------------- */
.admin-shell { max-width: 1100px; margin: 32px auto; padding: 0 24px; }
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.admin-login-box {
  max-width: 380px;
  margin: 100px auto;
  padding: 32px;
}
.admin-login-box input {
  width: 100%;
  padding: 12px;
  margin: 8px 0 16px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
}
.qr-box { text-align: center; margin: 20px 0; }
.qr-box img { background: #fff; padding: 12px; border-radius: 8px; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th, table.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.admin-table th { color: var(--text-muted); font-weight: 600; }

/* ADMIN EDIT UX MOVE-UP：手機版把 <table> 收成堆疊卡片，不強制橫向
   捲動——每個 <td> 用 data-label 屬性當標籤文字（JS 產生 table 時要帶
   data-label，見 frontend/js/admin.js::loadBuildingTable()/
   loadUnitTable()）。用 flex + order 把「操作」欄位視覺上搬到卡片最
   上面（緊接在主要識別欄位之後），不需要真的改 DOM 順序、不影響桌面版
   表格欄位順序。只有 dashboard.html 用到 .admin-table，改這裡不會
   影響 threads.html／line-advisor.html／viewings.html（那幾頁本來就
   是 card grid，不是 table）。 */
@media (max-width: 767.98px) {
  table.admin-table, table.admin-table thead, table.admin-table tbody { display: block; }
  table.admin-table thead { display: none; }
  table.admin-table tr {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--surface);
  }
  table.admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: none;
    text-align: right;
  }
  table.admin-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }
  table.admin-table td[data-label="地址"],
  table.admin-table td[data-label="房號"] { order: 1; }
  table.admin-table td[data-label="操作"] { order: 2; }
  table.admin-table td[data-label="區域"],
  table.admin-table td[data-label="類型"] { order: 3; }
  table.admin-table td[data-label="狀態"] { order: 4; }
  table.admin-table td[data-label="價格區間"],
  table.admin-table td[data-label="租金"] { order: 5; }
  table.admin-table td[data-label="房號數"],
  table.admin-table td[data-label="坪數"] { order: 6; }
  /* 操作欄位：按鈕改成靠左、可換行堆疊，不用 hover、不需要橫向捲動就能
     全部點得到（需求文件第 4 節）。 */
  table.admin-table td[data-label="操作"] {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }
  table.admin-table td[data-label="操作"]::before { content: none; }
  table.admin-table td[data-label="操作"] button,
  table.admin-table td[data-label="操作"] a {
    flex: 1 1 auto;
    min-width: 72px;
    text-align: center;
  }
}
.status-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.status-pill.available { background: rgba(184, 149, 106, 0.16); color: var(--accent-strong); }
.status-pill.rented { background: var(--surface-secondary); color: var(--text-muted); }

/* Threads 排程頁專用狀態 pill（M5.7 後台可視化，沿用同一套奶油配色，不新增風格） */
.status-pill.pj-pending { background: var(--surface-secondary); color: var(--text-muted); }
.status-pill.pj-claimed { background: rgba(184, 149, 106, 0.16); color: var(--accent-strong); }
.status-pill.pj-publishing { background: rgba(184, 149, 106, 0.28); color: var(--accent-strong); }
.status-pill.pj-published { background: rgba(122, 155, 108, 0.18); color: #4C7A3E; }
.status-pill.pj-failed { background: rgba(193, 72, 61, 0.16); color: #C1483D; }
.status-pill.pj-cancelled { background: var(--surface-secondary); color: var(--text-muted); }

/* ============================================================
   響應式（放在最後，才能蓋過上面的預設值）
   ============================================================ */

/* ---- 平板／小筆電：兩欄卡片、詳情頁改單欄 ---- */
@media (max-width: 1099.98px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
  .filter-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .detail-aside { display: none; }
  .detail-price-inline { display: flex; }
}

/* ---- 後台頁面：沿用原本「手機隱藏導覽列」的行為 ---- */
@media (max-width: 640px) {
  .header-nav:not(.public-nav) { display: none; }
}

/* ---- 手機（320–767px）----
   間距只用 4 / 8 / 12 / 16 / 24 / 32；左右留白 16px。
   2026-09-26 mobile polish：header 72px、搜尋區收合高度較前版縮 20–30%、
   卡片兩欄等高對齊、分頁改兩段式、底部預留業務欄＋AI 按鈕空間。 */
@media (max-width: 767.98px) {
  :root {
    --gutter: 16px;
    --header-h: 72px;
    --agent-bar-h: 64px;
    --fab-size: 54px;
  }

  /* iOS Safari 對小於 16px 的輸入框會在點擊時自動放大整頁，手機版統一 16px。
     select 加 :not([multiple]) 讓權重高過 .field select。 */
  input:not([type="checkbox"]):not([type="radio"]),
  select:not([multiple]),
  textarea {
    font-size: 16px;
  }

  /* ---- Header：品牌是第一視覺焦點 ---- */
  .site-header { min-height: var(--header-h); padding-top: 14px; padding-bottom: 14px; gap: 12px; }
  .brand { gap: 11px; }
  .brand-logo { height: 30px; }
  .brand-name { font-size: 18.5px; font-weight: 700; letter-spacing: 0.1em; }
  .brand-sub { font-size: 11.5px; letter-spacing: 0.08em; margin-top: 3px; }
  .header-nav.public-nav .nav-home { display: none; }
  .header-nav.public-nav a { min-height: var(--tap); padding: 0 12px; font-size: 13px; gap: 5px; }
  .header-nav .nav-fav { border-color: var(--border); }
  .header-nav .nav-fav .icon { width: 15px; height: 15px; }

  /* ---- Hero + 搜尋（收合狀態只有一列：關鍵字／篩選／搜尋） ---- */
  .hero { padding: 12px var(--gutter) 12px; border-bottom: none; }
  .hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    column-gap: 12px;
    row-gap: 4px; /* 系統字級放大時空房數會換到標題下一行，保持貼齊不留大空隙 */
  }
  .hero-eyebrow { display: none; }
  .hero-title { font-size: 24px; line-height: 1.2; letter-spacing: 0.01em; }
  .hero-meta { margin: 0; font-size: 12.5px; gap: 6px; white-space: nowrap; }
  .hero-meta-long { display: none; }
  .search-bar {
    flex: 1 0 100%;
    margin-top: 10px;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(29, 28, 26, 0.04);
  }
  .search-main { gap: 6px; }
  .search-keyword {
    height: var(--tap);
    min-height: 0;
    padding: 0 12px;
    gap: 8px;
    border-radius: 12px;
  }
  .search-keyword input { height: 42px; }
  .search-keyword .icon { width: 18px; height: 18px; }
  .filter-toggle {
    display: inline-flex;
    height: var(--tap);
    min-height: 0;
    min-width: 78px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 14px;
  }
  .search-submit {
    height: var(--tap);
    min-height: 0;
    min-width: 64px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14.5px;
  }

  /* ---- 展開的篩選：兩欄、每格固定 64px ---- */
  .filter-fields {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
  }
  .filter-fields.is-open { display: grid; animation: fade-drop .18s var(--ease); }
  .field {
    height: 64px;
    justify-content: center;
    gap: 4px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-tint);
  }
  .field-label { font-size: 11.5px; line-height: 1.2; letter-spacing: 0.06em; }
  .field select,
  .tag-filter-btn {
    height: 26px;
    min-height: 0;
    padding: 0 18px 0 0;
    line-height: 26px;
    font-weight: 500;
    background-size: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%239A938A' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  .tag-filter-wrap { grid-column: 1 / -1; height: auto; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
  .tag-filter-panel {
    position: static;
    width: auto;
    max-width: none;
    max-height: none;
    margin: 10px -14px -10px;
    padding: 12px 14px;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    box-shadow: none;
  }
  .feature-check-row label { min-height: 36px; padding: 0 12px; }

  /* ---- 物件卡片：兩欄等寬、標題固定兩行高，租金位置一致 ---- */
  .listing-section { padding: 12px var(--gutter) var(--fab-lane); }
  .listing-grid { gap: 16px 10px; }
  .card { border-radius: 16px; }
  .card-body { padding: 10px 10px 12px; gap: 0; }
  .card-location {
    font-size: 11.5px;
    letter-spacing: 0.02em;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-title {
    margin-top: 4px;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    min-height: calc(2 * 1.35em);
  }
  .card-matched-rooms { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-price { margin-top: 8px; gap: 3px; }
  .card .price-num { font-size: 18px; }
  .card .price-unit { font-size: 11.5px; }
  .card-tags { margin-top: 8px; gap: 4px; height: 22px; flex-wrap: nowrap; overflow: hidden; }
  .card-tag { height: 22px; padding: 0 7px; font-size: 11px; flex-shrink: 0; }
  .card-tags > .card-tag:nth-child(n+3) { display: none; }
  .card-badge { top: 8px; height: 22px; padding: 0 8px; font-size: 11px; }
  .card-badge-gold { left: 8px; }
  .card-badge-units { right: 8px; }
  .empty-state { padding: 48px 16px; }

  /* ---- 分頁：頁碼資訊一段、按鈕一列（不再三樣擠同一列） ---- */
  .listing-pager {
    flex-direction: column;
    gap: 16px;
    margin: 0;
    padding: 32px 0 8px;
  }
  .listing-pager .pager-info { flex-direction: column; gap: 2px; }
  .listing-pager .pager-buttons { display: flex; justify-content: center; gap: 10px; width: 100%; }
  .listing-pager .pager-buttons button { flex: 0 1 132px; min-width: 0; height: 46px; min-height: 0; padding: 0 12px; }
  .listing-pager #pagerPrev { order: 0; }
  .listing-pager #pagerNext { order: 0; }

  /* ---- 收藏頁 ---- */
  .page-head { padding: 24px var(--gutter) 0; }
  .page-title { font-size: 26px; }

  /* ---- 詳情頁 ---- */
  .detail-wrap { padding-top: 12px; padding-bottom: var(--fab-lane); }
  .detail-hero { border-radius: 16px; height: auto; aspect-ratio: 4 / 3; }
  .detail-layout { margin-top: 24px; }
  .detail-location { font-size: 13px; letter-spacing: 0.08em; }
  .detail-title { font-size: 22px; line-height: 1.35; }
  .detail-address { font-size: 14px; }
  .detail-price-inline { margin-top: 12px; }
  .detail-price-inline .price-num { font-size: 26px; }
  .detail-price-inline .price-unit { font-size: 14px; }
  .detail-facts { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
  .fact { padding: 12px 12px 12px 0; }
  .fact + .fact { padding-left: 0; border-left: none; }
  .fact:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--border); }
  .fact:nth-child(n+3) { border-top: 1px solid var(--border); }
  .fact-value { font-size: 15px; }
  .detail-chips { margin-top: 16px; gap: 6px; }
  .detail-chip { height: 30px; padding: 0 12px; font-size: 13px; }
  .detail-section { margin-top: 32px; }
  .section-title { font-size: 17px; margin-bottom: 12px; }
  .unit-card { border-radius: 16px; margin-bottom: 16px; }
  .unit-body { padding: 12px 16px 16px; }
  .unit-name { font-size: 16px; }

  /* ---- 底部業務欄：單列 ---- */
  .agent-bar { gap: 12px; padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .avatar { width: 36px; height: 36px; font-size: 14px; }
  .agent-phone { display: none; }
  .agent-role { display: block; margin-left: 0; font-size: 11.5px; }
  .agent-actions { gap: 8px; }
  .agent-actions .btn { padding: 0 16px; font-size: 14px; }
  .agent-actions .btn-icon { width: var(--tap); padding: 0; }
  .agent-actions .btn-icon .btn-label { display: none; }

  /* ---- AI 懸浮按鈕：右下角、業務欄正上方，陰影放輕 ---- */
  .ai-concierge-fab {
    right: 16px;
    bottom: calc(var(--agent-bar-h) + 12px + env(safe-area-inset-bottom, 0px));
    width: var(--fab-size);
    height: var(--fab-size);
    min-height: 0;
    padding: 0;
    justify-content: center;
    gap: 0;
    box-shadow: 0 2px 6px rgba(29, 28, 26, 0.12), 0 8px 20px rgba(29, 28, 26, 0.12);
  }
  .ai-concierge-fab-label { display: none; }
  .ai-concierge-fab-emoji { background: none; }
  .ai-concierge-fab-emoji svg { width: 20px; height: 20px; }
  .ai-concierge-greeting {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    bottom: calc(var(--agent-bar-h) + 12px + var(--fab-size) + 12px + env(safe-area-inset-bottom, 0px));
  }
  .ai-concierge-window {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    height: min(80vh, 640px);
  }

  /* ---- Modal 改成底部面板 ---- */
  .ai-modal-overlay { align-items: flex-end; padding: 0; }
  .ai-modal-card {
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 88vh;
  }
  .ai-modal-title { font-size: 19px; }
}

/* ---- 超窄螢幕（≤360px）：標題縮一級，讓「標題＋空房數」維持同一列 ---- */
@media (max-width: 360px) {
  .hero-title { font-size: 21px; }
  .hero-inner { column-gap: 8px; }
  .hero-meta { font-size: 12px; }
  .search-submit { min-width: 56px; padding: 0 12px; }
  .filter-toggle { min-width: 72px; padding: 0 10px; }
  /* 官方 logo 約 91px 寬，窄螢幕讓「我的收藏」只留愛心圖示（仍是 44px 點擊區，
     有 aria-label），品牌維持第一視覺焦點 */
  .header-nav.public-nav .nav-fav { width: var(--tap); padding: 0; justify-content: center; }
  .header-nav.public-nav .nav-fav span { display: none; }
}
