/* ═══════════════════════════════════════════════════════════════
   不動產管理系統 — Premium Design System v3
   Warm Editorial — Cream + Gold + Serif Brand Aesthetic
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Color System — Warm Neutral Foundation + Gold Accent */
  --primary:     #2b241b;
  --primary-l:   #4a4032;
  --primary-ll:  #6b5f4d;
  --accent:      #b5904a;
  --accent-l:    #d2af6e;
  --accent-d:    #8f6f33;
  --accent-glow: rgba(181, 144, 74, .18);

  /* Surfaces */
  --bg:          #fbf8f2;
  --bg-elevated: #f5ead8;
  --card:        #fffdf8;
  --card-hover:  #ffffff;

  /* Text */
  --text:        #2b241b;
  --text-secondary: #5b5142;
  --text-muted:  #8a7d68;
  --text-inverse:#fffdf9;

  /* Borders & Shadows */
  --border:      #ecdfc4;
  --border-light:#f1e6cf;
  --shadow-sm:   0 1px 3px rgba(60,45,10,.05);
  --shadow:      0 2px 10px rgba(60,45,10,.07);
  --shadow-md:   0 8px 20px rgba(60,45,10,.09);
  --shadow-lg:   0 16px 32px rgba(60,45,10,.1);
  --shadow-xl:   0 24px 40px rgba(60,45,10,.12);

  /* Semantic Colors */
  --success:     #2f9e63;
  --success-bg:  #eaf6ef;
  --success-border: #bfe6cf;
  --warning:     #b54708;
  --warning-bg:  #fef3e8;
  --warning-border: #f5d2ab;
  --danger:      #b3433a;
  --danger-bg:   #fbeeec;
  --danger-border: #ecc6c1;
  --info:        #6b5f4d;
  --info-bg:     #f1ead9;
  --info-border: #e3d7bd;

  /* Layout */
  --radius:      12px;
  --radius-sm:   10px;
  --radius-lg:   14px;
  --sidebar-w:   250px;

  /* Transitions */
  --ease:        cubic-bezier(.4, 0, .2, 1);
  --ease-spring: cubic-bezier(.175, .885, .32, 1.275);
  --duration:    .2s;
  --duration-lg: .35s;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Lucide SVG icons ── */
.lucide {
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
  stroke-width: 1.5;
}
button .lucide, a .lucide { pointer-events: none }

/* ── Typography ── */
body {
  font-family: 'Noto Sans TC', 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .page-title, .prop-name, .prop-price, .sidebar-title {
  font-family: 'Noto Serif TC', 'Inter', system-ui, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE TOP BAR
   ═══════════════════════════════════════════════════════════════ */
.mobile-header {
  display: none;
  background: var(--card);
  color: var(--text);
  padding: 0 20px;
  height: 56px;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(43,36,26,.04);
}
.mobile-header .nav-logo {
  font-size: 16px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif TC', sans-serif;
}
.mobile-header .nav-title {
  font-family: 'Noto Serif TC', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* 登入頁：隱藏導航 */
body.auth-page .sidebar,
body.auth-page .bottom-nav,
body.auth-page .mobile-header {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — Warm Editorial
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

/* Brand Area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 18px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--duration) var(--ease);
  position: relative;
}
.sidebar-brand:hover { background: var(--bg-elevated) }
.sidebar-logo {
  font-size: 15px;
  line-height: 1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif TC', sans-serif;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(60,45,10,.18);
}
.sidebar-brand-text { flex: 1; min-width: 0 }
.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .03em;
  color: var(--text);
}
.sidebar-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: .12em;
}

/* Search + 新增物件（同一排，新增是清單的工具列動作，放這裡比放最上面的收合列更貼近情境） */
.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search {
  flex: 1;
  min-width: 0;
}
.sidebar-search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--duration) var(--ease);
}
.sidebar-search input::placeholder { color: var(--text-muted) }
.sidebar-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Status filter nav */
.sidebar-filters {
  padding: 14px 12px 4px;
}
.sidebar-filter-label {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0 8px 6px;
}
.sidebar-filter-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  margin-bottom: 1px;
}
.sidebar-filter-item:hover { background: var(--bg-elevated) }
.sidebar-filter-item.active {
  background: var(--bg-elevated);
  color: var(--accent-d);
  font-weight: 600;
}
.sidebar-filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-filter-dot.dot-all   { background: var(--accent) }
.sidebar-filter-dot.dot-live  { background: var(--success) }
.sidebar-filter-dot.dot-draft { background: #c9b896 }
.sidebar-filter-dot.dot-others{ background: #a39a8a }
.sidebar-filter-dot.dot-warn  { background: var(--warning) }
.sidebar-filter-label-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.sidebar-filter-count {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
}
.sidebar-filter-item.active .sidebar-filter-count {
  background: var(--accent);
  color: #fff;
}
.sidebar-filter-item.warn-item { color: var(--warning) }
.sidebar-filter-item.warn-item .sidebar-filter-count {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Nav List */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav-label {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 10px 12px 6px;
}
.sidebar-item {
  padding: 10px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  transition: all var(--duration) var(--ease);
}
.sidebar-item:hover {
  background: var(--bg-elevated);
}
.sidebar-item.active {
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}
.sidebar-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.sidebar-item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.sidebar-empty, .sidebar-loading {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-agent-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all var(--duration) var(--ease);
}
.sidebar-agent-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent-d);
}

/* 「更多」選單：代理人設定／帳號管理／登出收進這個下拉，避免側邊欄塞滿次要按鈕。
   觸發鈕做成使用者資訊列（頭像＋姓名＋角色），參考一般 SaaS 工具左下角帳號選單的慣例。 */
.sidebar-more {
  position: relative;
}
.sidebar-profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all var(--duration) var(--ease);
}
.sidebar-profile-trigger:hover,
.sidebar-more.open .sidebar-profile-trigger {
  background: var(--bg-elevated);
  border-color: var(--accent);
}
.sidebar-profile-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(60,45,10,.18);
}
.sidebar-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.sidebar-profile-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-profile-role {
  font-size: 10.5px;
  color: var(--text-muted);
}
.sidebar-profile-caret {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--duration) var(--ease);
}
.sidebar-more.open .sidebar-profile-caret {
  transform: rotate(180deg);
}
.sidebar-more-menu {
  display: none;
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  overflow: hidden;
  z-index: 200;
  padding: 4px;
}
.sidebar-more.open .sidebar-more-menu {
  display: block;
}
.sidebar-more-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.sidebar-more-menu button .mi {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-more-menu button:hover {
  background: var(--bg-elevated);
  color: var(--accent-d);
}

/* Collapse toggle — lives inside .sidebar-brand's own row now (right-aligned
   via .sidebar-brand-text's flex:1), so it never needs to bleed past the
   sidebar's border (sidebar has overflow:hidden). */
.sidebar-collapse-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.sidebar-collapse-btn:hover { background: var(--bg-elevated); color: var(--accent-d) }

body.sidebar-collapsed .sidebar { width: 64px }
body.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg) }
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 14px 0 10px;
}
body.sidebar-collapsed .sidebar-logo,
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-search,
body.sidebar-collapsed .sidebar-filters,
body.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar-footer .lbl {
  display: none;
}
body.sidebar-collapsed .sidebar-search-row { display: none }
body.sidebar-collapsed .sidebar-footer { padding: 14px 10px; margin-top: auto }
body.sidebar-collapsed .sidebar-agent-btn {
  padding: 8px 0;
}
body.sidebar-collapsed .sidebar-profile-trigger {
  justify-content: center;
  padding: 6px;
  gap: 0;
}
body.sidebar-collapsed .main-wrap { margin-left: 64px }

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}
.app-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 28px;
}
@media (min-width: 1200px) {
  .app-body { max-width: 1100px }
}
@media (min-width: 1600px) {
  .app-body { max-width: 1320px }
}
@media (min-width: 1920px) {
  .app-body { max-width: 1480px }
}

/* ═══════════════════════════════════════════════════════════════
   BOTTOM NAV (Mobile)
   ═══════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(255,253,249,.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 12px rgba(43,36,26,.06);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 28px;
  color: var(--text-muted);
  font-family: inherit;
  transition: color var(--duration) var(--ease);
}
.bottom-nav-item.active { color: var(--accent-d) }
.bnav-icon { display: flex; align-items: center; justify-content: center; height: 24px }
.bnav-label { font-size: 10px; font-weight: 700; letter-spacing: .02em }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none }
  .main-wrap { margin-left: 0 }
  .mobile-header { display: flex }
  .bottom-nav { display: flex }
  .app-body { padding: 20px 16px 80px }
  .toast { bottom: 74px }
  .prop-grid { grid-template-columns: 1fr }
  .data-grid { grid-template-columns: 1fr 1fr }
  .tabs { overflow-x: auto; scrollbar-width: none }
  .tabs::-webkit-scrollbar { display: none }
  .edit-grid { grid-template-columns: 1fr }
}

/* ═══════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  border: 1px solid var(--border);
  transition: box-shadow var(--duration-lg) var(--ease),
              transform var(--duration-lg) var(--ease);
}
.card + .card { margin-top: 16px }

/* ═══════════════════════════════════════════════════════════════
   PROPERTY GRID — Landing Cards
   ═══════════════════════════════════════════════════════════════ */
.prop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.prop-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--duration-lg) var(--ease);
  position: relative;
  overflow: hidden;
}
.prop-cover {
  height: 140px;
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
}
.prop-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.prop-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 28px;
}
.prop-body { padding: 18px 20px 20px }
.prop-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--accent-l);
}

/* ── 物件總覽（首頁）：統計列 + 緊湊清單，取代原本的卡片牆 ── */
.home-head { display:flex; justify-content:space-between; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:22px }
.home-sub { font-size:13px; color:var(--text-muted); margin-top:4px }
.home-stats { display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:24px }
.home-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.home-stat:hover { border-color: var(--accent-l); box-shadow: var(--shadow) }
.home-stat.active { border-color: var(--accent); background: var(--accent-glow) }
.home-stat-n { font-family:'Noto Serif TC',serif; font-size:26px; font-weight:700; color:var(--text) }
.home-stat.active .home-stat-n { color: var(--accent-d) }
.home-stat-l { font-size:12px; color:var(--text-muted); margin-top:2px }
.home-rows {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.home-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.home-row:last-child { border-bottom: none }
.home-row:hover { background: var(--bg-elevated) }
.home-row-thumb {
  width: 46px; height: 46px; border-radius: 10px; background: var(--bg-elevated);
  flex-shrink: 0; overflow: hidden;
}
.home-row-thumb img { width:100%; height:100%; object-fit:cover; display:block }
.home-row-info { flex:1; min-width:0 }
.home-row-name { font-size:14px; font-weight:700; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.home-row-sub { font-size:12px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.home-row-price { font-family:'Noto Serif TC',serif; font-size:14.5px; font-weight:700; color:var(--accent-d); width:90px; text-align:right; flex-shrink:0 }
.home-row-status { width:80px; text-align:center; flex-shrink:0 }
.home-row-dots { display:flex; gap:5px; width:50px; justify-content:flex-end; flex-shrink:0 }
.home-row-dot { width:7px; height:7px; border-radius:50%; background:var(--border) }
.home-row-dot.ok { background: var(--success) }
.home-row-dot.bad { background: var(--danger) }
@media (max-width: 768px) {
  .home-stats { grid-template-columns: repeat(2,1fr) }
  .home-row-sub, .home-row-dots { display:none }
  .home-head .btn { width: 100% }
}

.prop-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.35;
  letter-spacing: .01em;
}
.prop-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.prop-price {
  font-family: 'Noto Serif TC', sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--accent-d);
  margin: 10px 0 2px;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: .01em;
  border: 1px solid transparent;
}
.badge-ok {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.badge-miss {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}
.badge-warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.badge-sold {
  background: #efebe3;
  color: var(--text-secondary);
  border-color: var(--border);
}

/* Status ribbon badges (property lifecycle) */
.badge-draft  { background: #fff; color: var(--text-muted); border-color: var(--border) }
.badge-live   { background: var(--accent); color: #fff; border-color: var(--accent) }
.badge-archived { background: #efebe3; color: var(--text-muted); border-color: var(--border) }

/* ═══════════════════════════════════════════════════════════════
   BACK BUTTON
   ═══════════════════════════════════════════════════════════════ */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 20px;
  padding: 6px 2px;
  background: none;
  border: none;
  font-family: inherit;
  transition: color var(--duration) var(--ease);
}
.back-btn:hover { color: var(--accent-d) }

/* ═══════════════════════════════════════════════════════════════
   DETAIL HEAD
   ═══════════════════════════════════════════════════════════════ */
.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.detail-head-thumb {
  width: 64px; height: 64px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); flex-shrink: 0; overflow: hidden;
}
.detail-head-thumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.detail-head-info { flex: 1; min-width: 0 }
.detail-head-info .page-title { margin: 0; line-height: 1.3 }
.detail-head-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px }
.detail-head-id { font-size: 12.5px; color: var(--text-muted) }
.detail-head-addr { font-size: 12.5px; color: var(--text-secondary); text-decoration: none }
a.detail-head-addr:hover { color: var(--accent-d); text-decoration: underline }
.detail-head-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0 }
.status-wrap { position: relative }
.status-pill {
  display: flex; align-items: center; gap: 6px;
  border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12.5px; font-weight: 600; padding: 6px 12px;
  cursor: pointer; white-space: nowrap; color: var(--text-secondary);
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}
.status-pill:hover { border-color: var(--accent); color: var(--accent) }
.status-pill--上架中 { border-color: var(--success-border); color: var(--success); background: var(--success-bg) }
.status-pill--已售出 { border-color: var(--border); color: var(--text-muted) }
.status-pill--封存  { border-color: var(--danger-border); color: var(--danger); background: var(--danger-bg) }
.status-dropdown {
  display: none; position: absolute; left: 0; top: calc(100% + 4px); z-index: 200;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 110px; padding: 4px 0;
}
.status-wrap.open .status-dropdown { display: block }
.status-opt {
  display: block; width: 100%; padding: 9px 14px; text-align: left;
  font-size: 13px; font-weight: 500; background: none; border: none;
  cursor: pointer; color: var(--text);
}
.status-opt:hover { background: var(--accent-glow) }
.status-opt.active { color: var(--accent); font-weight: 600 }
@media (max-width: 640px) {
  .detail-head { flex-wrap: wrap }
  .detail-head-actions { width: 100%; justify-content: space-between }
}

/* ═══════════════════════════════════════════════════════════════
   SECTION & PAGE TITLES
   ═══════════════════════════════════════════════════════════════ */
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 18px;
  height: 2px;
  background: var(--accent);
  flex-shrink: 0;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: .02em;
}

/* ═══════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}
.tab:hover { color: var(--text-secondary) }
.tab.active {
  color: var(--accent-d);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none }
.tab-panel.active { display: block }

/* 小型分段切換鈕（例如謄本來源：PDF上傳／貼上連結），之後加新來源只加一顆按鈕，
   不用再疊一整組輸入框＋分隔線 */
.deed-source-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.deed-source-toggle button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--duration) var(--ease);
}
.deed-source-toggle button:hover { color: var(--text-secondary) }
.deed-source-toggle button.active {
  background: var(--card-hover);
  color: var(--accent-d);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════════
   PROPERTY DETAIL — Gallery + Sticky Spec Aside
   ═══════════════════════════════════════════════════════════════ */
.detail-gallery-wrap {
  position: relative;
  margin-bottom: 20px;
}
.detail-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.detail-gallery::-webkit-scrollbar { display: none }
.detail-gallery > div {
  flex: 0 0 200px;
  height: 150px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
}
.detail-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 2;
}
.gallery-nav.prev { left: -14px }
.gallery-nav.next { right: -14px }
.gallery-nav[disabled] { opacity: 0; pointer-events: none }
.detail-gallery-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  height: 160px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.detail-aside {
  position: sticky;
  top: 20px;
}
.aside-price {
  font-family: 'Noto Serif TC', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-d);
  margin-bottom: 4px;
}
.aside-price small {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  font-family: 'Noto Sans TC', sans-serif;
  margin-left: 4px;
}
.aside-addr {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.aside-quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.aside-quick .k {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.aside-quick .v {
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .detail-gallery > div { flex: 0 0 140px; height: 105px }
  .detail-grid { grid-template-columns: 1fr }
  .detail-aside { position: static }
  .gallery-nav { display: none }
}

.g-more {
  position: absolute;
  inset: 0;
  background: rgba(20,16,10,.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Noto Serif TC', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════════════ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,16,10,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.lightbox.show { display: flex }
.lightbox-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20,16,10,.92);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: var(--shadow-xl);
  width: min(900px, 94vw);
  height: min(680px, 88vh);
}
.lightbox-row {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lightbox-stage {
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox img.loading { opacity: .6; filter: blur(1px) }
.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: var(--bg-elevated) }
.lightbox-download {
  position: absolute; top: -16px; right: 26px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border);
  width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; z-index: 1;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-download:hover { background: var(--bg-elevated) }
.lightbox-copy-btn {
  position: absolute;
  top: -16px;
  right: 26px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  cursor: pointer;
  z-index: 1;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.lightbox-copy-btn:hover { background: var(--bg-elevated) }
.lightbox-nav {
  flex: 0 0 auto;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover { background: var(--bg-elevated) }
.lightbox-counter {
  flex: 0 0 auto;
  align-self: flex-start;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  font-size: 12.5px;
  letter-spacing: .04em;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.lightbox-strip {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  margin-top: 16px;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px;
}
.lightbox-strip img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  opacity: .5;
  border: 2px solid transparent;
  flex-shrink: 0;
  box-shadow: none;
}
.lightbox-strip img.active {
  opacity: 1;
  border-color: var(--accent-l);
}
@media (max-width: 768px) {
  .lightbox { padding: 12px }
  .lightbox-panel { padding: 16px 14px }
  .lightbox-row { gap: 6px }
  .lightbox-nav { width: 32px; height: 32px; font-size: 18px }
  .lightbox img { max-height: 60vh }
  .lightbox-strip { display: none }
}

/* ═══════════════════════════════════════════════════════════════
   MODAL（表單內快速查詢用，不離開當前頁面/不丟未存檔內容）
   ═══════════════════════════════════════════════════════════════ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,16,10,.45);
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show { display: flex }
.modal-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-xl);
  width: min(640px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   DEED PDF SPLIT VIEW
   ═══════════════════════════════════════════════════════════════ */
.deed-split {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.deed-main { flex: 1; min-width: 0 }
.deed-pdf-pane { display: none }
.deed-split.open .deed-pdf-pane {
  display: flex;
  flex-direction: column;
  flex: 0 0 44%;
  margin-left: 20px;
  position: sticky;
  top: 20px;
  height: calc(100vh - 100px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.deed-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  flex: 0 0 auto;
}
.deed-pdf-frame {
  flex: 1 1 auto;
  width: 100%;
  border: none;
}
@media (max-width: 1199px) {
  .deed-split.open .deed-pdf-pane { display: none }
}

/* ═══════════════════════════════════════════════════════════════
   DATA ROWS
   ═══════════════════════════════════════════════════════════════ */
.data-grid {
  display: grid;
  grid-template-columns: max-content 1fr max-content 1fr;
  gap: 11px 18px;
  font-size: 13.5px;
}
.data-grid dt {
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 1px;
  white-space: nowrap;
}
.data-grid dd {
  color: var(--text);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   MORTGAGE TABLE
   ═══════════════════════════════════════════════════════════════ */
.mortgage-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 10px;
  transition: border-color var(--duration) var(--ease);
}
.mortgage-item:hover { border-color: var(--accent) }
.mortgage-item dt { color: var(--text-secondary); font-size: 12px; margin-top: 6px }
.mortgage-item dd { font-weight: 600 }

/* ═══════════════════════════════════════════════════════════════
   FEATURES LIST
   ═══════════════════════════════════════════════════════════════ */
.features { list-style: none; margin: 0; padding: 0 }
.features li {
  padding: 9px 0;
  border-top: 1px solid var(--border-light);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
}
.features li:first-child { border-top: none }
.features li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SCHOOL TAGS
   ═══════════════════════════════════════════════════════════════ */
.school-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px }
.school-tag {
  background: var(--bg-elevated);
  color: var(--accent-d);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.edit-form-wrap {
  max-width: 720px;
}

.edit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}
.form-group textarea {
  resize: vertical;
  line-height: 1.65;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── 謄本預設 / 手動覆寫 badge ── */
.ov-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: .01em;
}
.ov-badge.deed {
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.ov-badge.manual {
  background: var(--accent-glow);
  color: var(--accent-d);
}

/* ── Edit grid (2-col form layout) ── */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

/* ═══════════════════════════════════════════════════════════════
   FILE DROP ZONE
   ═══════════════════════════════════════════════════════════════ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-lg) var(--ease);
  color: var(--text-muted);
  background: var(--bg);
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-d);
}
.dropzone.drag-over {
  box-shadow: inset 0 0 0 2px var(--accent-glow);
}
.dropzone input { display: none }
.dropzone-icon { margin-bottom: 10px; display: flex; justify-content: center; color: var(--text-muted) }
.dropzone-label { font-size: 15px; font-weight: 600; color: var(--text-secondary) }
.dropzone-hint { font-size: 12.5px; margin-top: 6px; color: var(--text-muted) }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(.97) }
.btn:disabled { opacity: .45; cursor: not-allowed }

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(176,141,79,.3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-d);
  box-shadow: 0 4px 12px rgba(176,141,79,.35);
}

/* Accent */
.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(176,141,79,.3);
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-d);
  box-shadow: 0 4px 12px rgba(176,141,79,.35);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-d);
  background: var(--accent-glow);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 3px rgba(179,67,58,.25);
}
.btn-danger:hover:not(:disabled) {
  background: #98352d;
  box-shadow: 0 4px 12px rgba(179,67,58,.3);
}

.btn-sm { padding: 7px 14px; font-size: 12.5px }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 12px;
  border-left: 3px solid;
  font-weight: 500;
}
.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-left-color: var(--danger);
}
.alert-warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-left-color: var(--warning);
}
.alert-ok {
  background: var(--success-bg);
  color: var(--success);
  border-left-color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: #fffdf9;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  transition: transform var(--duration-lg) var(--ease-spring);
  z-index: 1100;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0) }

/* 帶「復原」按鈕的 toast（例如刪除照片）——一般 toast 是 pointer-events:none
   純顯示用，這種要能被點擊，所以另外開一個修飾類別蓋掉 */
.toast-with-action {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.toast-undo-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.4);
  color: #fffdf9;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.toast-undo-btn:hover { background: rgba(255,255,255,.15) }

/* ═══════════════════════════════════════════════════════════════
   LOADING — Skeleton + Spinner
   ═══════════════════════════════════════════════════════════════ */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* Skeleton Loader */
.skeleton {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,.7) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0%   { transform: translateX(-100%) }
  100% { transform: translateX(100%) }
}
.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 6px;
}
.skeleton-line:last-child { margin-bottom: 0 }
.skeleton-line.w-60 { width: 60% }
.skeleton-line.w-80 { width: 80% }
.skeleton-line.w-40 { width: 40% }
.skeleton-card {
  height: 160px;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 52px; margin-bottom: 16px; opacity: .6 }
.empty-text {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  font-family: 'Noto Serif TC', sans-serif;
}
.empty-sub { font-size: 14px; color: var(--text-muted) }

/* ═══════════════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════════════ */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 24px 0;
}

/* ═══════════════════════════════════════════════════════════════
   PHOTO GRID
   ═══════════════════════════════════════════════════════════════ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.photo-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border-light);
  cursor: grab;
  transition: all var(--duration-lg) var(--ease);
}
.photo-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.photo-item.dragging { opacity: .4 }
.photo-item.drag-over { box-shadow: 0 0 0 2px var(--accent) inset }
.photo-order {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(43,36,26,.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.photo-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-lg) var(--ease);
}
.photo-item:hover img {
  transform: scale(1.03);
}
.photo-name {
  font-size: 10px;
  color: var(--text-muted);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(43,36,26,.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--duration) var(--ease);
}
.photo-del:hover { background: var(--danger) }
.photo-item:hover .photo-del { opacity: 1 }
.photo-cover {
  position: absolute;
  top: 6px;
  right: 36px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(43,36,26,.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--duration) var(--ease);
}
.photo-cover:hover { background: var(--accent) }
.photo-item:hover .photo-cover { opacity: 1 }

/* 觸控裝置沒有 hover 這個手勢，操作鈕不能靠 hover 才現身，否則手機上根本點不到 */
@media (hover: none) {
  .photo-del, .photo-cover { opacity: 1 }
}

/* ═══════════════════════════════════════════════════════════════
   COMPLIANCE PANEL
   ═══════════════════════════════════════════════════════════════ */
.compliance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}
.compliance-row:last-child { border-bottom: none }
.compliance-key { color: var(--text-secondary); font-weight: 500 }
.compliance-val { font-weight: 600; color: var(--text) }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */
body.auth-page {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(176,141,79,.10), transparent 38%),
    radial-gradient(circle at 88% 82%, rgba(176,141,79,.08), transparent 42%);
}
.login-panel {
  max-width: 380px;
  margin: 100px auto;
  padding: 40px 36px;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-family: 'Noto Serif TC', sans-serif;
  margin-bottom: 14px;
}
.login-brand-name {
  font-family: 'Noto Serif TC', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.login-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .16em;
  margin-top: 4px;
}
.login-divider {
  width: 30px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 26px;
}
.login-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .03em;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES & ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════ */

/* Smooth scrollbar for the whole page */
::-webkit-scrollbar { width: 6px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted) }

/* Focus-visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: rgba(176,141,79,.3);
  color: #2b241b;
}

/* ════════════════════════════════════
   側邊欄微調（搜尋框 icon、篩選徽章、清單項目選中狀態）
   ════════════════════════════════════ */
.sidebar-search { position: relative; }
.sidebar-search::before {
  content: '\1F50D'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: .45; pointer-events: none;
}
.sidebar-search input { padding-left: 32px; border-radius: 999px; background: var(--bg-elevated); border-color: transparent; }

.sidebar-filters { padding: 16px 12px 8px; }
.sidebar-filter-count {
  background: transparent; color: var(--text-muted);
  font-weight: 600;
}
.sidebar-filter-item.active .sidebar-filter-count { background: transparent; color: var(--accent-d) }
.sidebar-filter-item.warn-item .sidebar-filter-count { background: transparent; color: var(--warning) }
.sidebar-nav { padding: 8px 10px 10px; }
.sidebar-item { border-left-width: 3px; padding: 11px 13px; }
.sidebar-item:hover { background: var(--accent-glow); }
.sidebar-item.active { background: var(--accent-glow); border-left-color: var(--accent); }


/* ── 物件總覽：內部資料分隔線 ── */
.section-separator {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 0 20px;
  color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}
.section-separator::before,
.section-separator::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── 頁首「⋯」更多選單 ── */
.detail-more-wrap { position: relative; }
.detail-more-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 200;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 140px; padding: 4px 0;
}
.detail-more-wrap.open .detail-more-dropdown { display: block; }
.dropdown-item {
  display: block; width: 100%; padding: 9px 16px; text-align: left;
  font-size: 14px; background: none; border: none; cursor: pointer; color: var(--text);
}
.dropdown-item:hover { background: var(--accent-glow); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-bg); }

/* ── 文案 tab ── */
.copy-panel {
  display: flex; flex-direction: column; gap: 16px; padding: 4px 0 24px;
  max-width: 860px;
}
.copy-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.copy-card.card-collapsible { padding-left: 0; }
.copy-card.card-collapsible.collapsed { padding-left: 0; }
.copy-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.copy-card.card-collapsible .copy-card-header { padding-left: 17px; }
.copy-card.card-collapsible.collapsed .copy-card-header { padding-left: 16px; }
.copy-card .card-body { margin-top: 0 !important; }
.copy-card-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
  transition: color 0.22s var(--ease);
}
.copy-card-label::before {
  content: ''; width: 18px; height: 2px;
  background: var(--accent); flex-shrink: 0;
  transition: background 0.22s var(--ease);
}
.copy-card.card-collapsible.collapsed .copy-card-label {
  color: var(--text-muted);
}
.btn-xs {
  padding: 3px 10px; font-size: 12px; border-radius: var(--radius-sm);
}
.copy-textarea {
  display: block; width: 100%; min-height: 240px;
  padding: 12px 14px; border: none; resize: vertical;
  font-size: 14px; line-height: 1.6; color: var(--text);
  background: var(--card); font-family: inherit;
  box-sizing: border-box;
}
.copy-textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── 備忘多頁 tab ── */
.memo-tabs {
  display: flex; align-items: flex-end; gap: 2px;
  padding: 8px 14px 0; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.memo-tabs::-webkit-scrollbar { display: none; }
.memo-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none;
  border: 1px solid transparent; border-bottom: none;
  transition: background .15s, color .15s; white-space: nowrap;
}
.memo-tab:hover { background: var(--bg-elevated); color: var(--text); }
.memo-tab.active {
  background: var(--card); color: var(--accent); font-weight: 600;
  border-color: var(--border); position: relative;
}
.memo-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: var(--card);
}
.memo-tab-close {
  background: none; border: none; cursor: pointer; padding: 0 1px; line-height: 1;
  font-size: 14px; color: var(--text-muted); opacity: .5; transition: opacity .15s;
}
.memo-tab-close:hover { opacity: 1; color: #c0392b; }
.memo-tab-add {
  background: none; border: none; cursor: pointer; padding: 4px 8px; margin-bottom: 1px;
  font-size: 16px; line-height: 1; color: var(--text-muted); border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.memo-tab-add:hover { background: var(--bg-elevated); color: var(--accent); }

/* ── 文案 tab：照片格 ── */
.copy-photo-grid {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px;
}
.copy-photo-item {
  position: relative; width: 88px; height: 66px; border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; border: 2px solid transparent;
  transition: border-color .15s, box-shadow .15s;
}
.copy-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.copy-photo-item:hover { box-shadow: 0 0 0 2px var(--accent-light, #d4b483) inset; }
.copy-photo-check {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.copy-photo-item.selected { border-color: var(--accent); }
.copy-photo-item.selected .copy-photo-check { opacity: 1; }
.copy-photo-item:hover .copy-photo-check { opacity: .35; }
.copy-photo-item.selected:hover .copy-photo-check { opacity: 1; }

/* ── 封存物件列表 ── */
.archive-list { display: flex; flex-direction: column; gap: 8px; }
.archive-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.archive-row-info { min-width: 0; }
.archive-row-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.archive-row-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.archive-row-date { font-size: 12px; color: var(--text-muted); }

/* ── 周邊設施提醒 ── */
.nearby-warning {
  font-size: 12px; color: #92600a; background: #fef9ec;
  border: 1px solid #f5d87a; border-radius: 6px;
  padding: 8px 12px; margin-bottom: 10px; line-height: 1.6;
}
.nearby-warning a { color: #92600a; text-decoration: underline; }
.nearby-ok {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 10px;
}
.nearby-ok a { color: var(--accent-d); text-decoration: underline; }

/* ── 內部資訊備註區塊 ── */
.internal-note-block {
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; line-height: 1.8; white-space: pre-wrap;
}
.internal-note-label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-muted);
  letter-spacing: .05em; margin-bottom: 4px;
}

/* ── Collapsible cards ── */
.card-collapsible {
  border-left: 3px solid var(--accent);
  padding-left: 26px;
  transition: border-color 0.22s var(--ease), border-left-width 0.22s var(--ease),
              padding-left 0.22s var(--ease);
}
.card-collapsible.collapsed {
  border-left: 2px solid var(--border);
  padding-left: 27px;
}
.card-collapsible .card-header {
  display: flex;
  align-items: center;
}
.card-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  min-width: 0;
}
.card-toggle-btn .section-title {
  flex: 1;
  margin-bottom: 0;
  user-select: none;
  transition: color 0.22s var(--ease);
}
.card-collapsible.collapsed .card-toggle-btn .section-title {
  color: var(--text-muted);
}
.card-body {
  overflow: hidden;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-collapsible .card-body { margin-top: 16px; }
.card-collapsible.collapsed .card-body { margin-top: 0; }
