:root {
  --deep: #0f302b;
  --deep-d1: #0a221e;
  --deep-t1: #274540;
  --deep-t3: #cfd6d5;
  --deep-t4: #f3f5f4;
  --gold: #b08a58;
  --gold-t3: #e7dccd;
  --gold-t4: #f9f7f3;
  --cream: #faf8f5;
  --ink: #1c1c1a;
  --red: #b8433a;
  --green: #2f7d5c;
  --amber: #b8862f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--deep); }
/* ===== 側欄式版面（比照 GolfPrint 營運後台的結構）=====
   240px 深色側欄 + 淺色內容區。選中項目刻意「不」整塊反白——
   側欄本來就是深色，整塊反白會比內容區還搶眼；改用淡底＋品牌色左標。 */
body.has-sidebar { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  background: var(--deep);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 12px 18px;
}
.sidebar-brand {
  padding: 0 12px;
  margin-bottom: 26px;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.5px;
}
.sidebar-brand span { color: var(--gold); }
.sidebar-sub {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.38);
}

.sidebar nav { display: flex; flex-direction: column; gap: 22px; }
.nav-group-title {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.34);
}
.sidebar nav a {
  position: relative;
  display: block;
  padding: 8px 12px 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar nav a::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 16px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background .12s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar nav a.active {
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-weight: 600;
}
.sidebar nav a.active::before { background: var(--gold); }

.sidebar-logout { margin-top: auto; padding-top: 22px; }
.logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.7);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.logout-btn:hover { background: rgba(255,255,255,0.09); color: #fff; }

.content { flex: 1; min-width: 0; padding: 30px 32px 60px; }
.content-inner { max-width: 1100px; margin: 0 auto; }
/* 滿版高度頁面（LINE 客服工作台）：內容區固定成一個視窗高，
   捲動交給裡面的欄位處理，整頁不會跟著上下捲。 */
.content-inner.wide { max-width: 1560px; }
body.fullheight .content { height: 100vh; overflow: hidden; padding-bottom: 22px; }
body.fullheight .content-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }

h1.page-title { font-size: 22px; color: var(--deep); margin: 0 0 20px; }
.card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(15,48,43,0.08); margin-bottom: 20px;
}
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
/* grid 項目預設 min-width:auto，裡面若有寬表格會把欄位撐開、1fr 也壓不住，
   導致整頁出現橫向捲動。設成 0 才能讓內容乖乖縮回欄寬內。 */
.grid > * { min-width: 0; }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
.stat { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px rgba(15,48,43,0.08); }
.stat .label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 800; color: var(--deep); }
.stat .value.gold { color: var(--gold); }
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; text-decoration: none; border: none;
}
.btn-primary { background: var(--deep); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--gold); color: var(--gold); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--deep-t4); }
th { color: #888; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--gold-t4); }
.tag {
  display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 20px;
  font-weight: 600; background: var(--deep-t4); color: var(--deep);
}
.tag.status-空櫃 { background: #e5f3ec; color: var(--green); }
.tag.status-已租 { background: var(--gold-t3); color: #7b613e; }
.tag.status-待清空 { background: #fbe9e7; color: var(--red); }
.tag.status-維修中 { background: #eee; color: #666; }
.tag.status-active { background: #e5f3ec; color: var(--green); }
.tag.status-ended, .tag.status-terminated { background: #eee; color: #777; }
.tag.status-paid { background: #e5f3ec; color: var(--green); }
.tag.status-unpaid { background: var(--gold-t3); color: #7b613e; }
.tag.status-overdue { background: #fbe9e7; color: var(--red); }
form.inline-form { display: inline; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--deep); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px;
  font-family: inherit;
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fbe9e7; color: var(--red); }
.alert-info { background: var(--deep-t4); color: var(--deep); }
.cabinet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.cabinet-cell {
  border-radius: 10px; padding: 12px 10px; text-align: center; text-decoration: none;
  border: 1px solid #eee; transition: transform .1s;
}
.cabinet-cell:hover { transform: translateY(-2px); }
.cabinet-cell .code { font-weight: 800; color: var(--deep); font-size: 15px; }
.cabinet-cell .rent { font-size: 12px; color: #888; margin-top: 4px; }
.cabinet-cell.status-空櫃 { background: #e5f3ec; }
.cabinet-cell.status-已租 { background: var(--gold-t3); }
.cabinet-cell.status-待清空 { background: #fbe9e7; }
.cabinet-cell.status-維修中 { background: #eee; }
.login-wrap { max-width: 380px; margin: 90px auto; }
.login-wrap .card { text-align: center; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--deep); margin: 0 0 12px; }
small.hint { color: #999; }

/* ===== 手機／平板（原本整份 CSS 只有一條 900px 的 grid 規則，
   導覽列、表格、表單在手機上都會爆版）===== */
@media (max-width: 720px) {
  /* 側欄在窄螢幕收合成頂部橫向捲動列：分組標題隱藏、項目攤平成一排 */
  body.has-sidebar { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex: none;
    width: auto;
    height: auto;
    padding: 12px 14px 10px;
  }
  .sidebar-brand { margin-bottom: 10px; font-size: 15px; padding: 0; }
  .sidebar-sub { display: none; }
  .sidebar nav {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-group { display: contents; }
  .nav-group-title { display: none; }
  .sidebar nav a { flex: 0 0 auto; font-size: 13px; padding: 7px 12px; }
  .sidebar nav a::before { display: none; }
  .sidebar nav a.active { background: rgba(255,255,255,0.18); }
  /* 登出移到品牌名右側，不佔掉一整列 */
  .sidebar-logout { position: absolute; top: 10px; right: 14px; margin: 0; padding: 0; }
  .logout-btn { width: auto; padding: 6px 12px; font-size: 12px; }

  .content { padding: 18px 14px 48px; }
  h1.page-title { font-size: 19px; margin-bottom: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }

  /* 表格改為可橫向捲動，避免整個頁面被寬表格撐開 */
  .content table { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; }

  .form-row { flex-direction: column; gap: 0; }
  .cabinet-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .login-wrap { margin: 40px auto; }
  .btn { padding: 8px 14px; }
  .toolbar .btn, .toolbar form { margin-top: 2px; }
}

@media (max-width: 420px) {
  .cabinet-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .sidebar-brand { font-size: 14px; }
}

/* ===== 合約文件：畫面上像一張 A4，列印時去掉所有後台介面 ===== */
.contract-doc {
  background: #fff;
  padding: 48px 56px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15,48,43,0.08);
  font-size: 14px;
  line-height: 2;
  color: #222;
}
.contract-doc h1 { font-size: 21px; text-align: center; margin: 0 0 6px; color: var(--deep); }
.contract-doc h2 { font-size: 15px; margin: 26px 0 10px; color: var(--deep); }
.contract-doc p { margin: 8px 0; text-align: justify; }
.contract-doc .doc-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.contract-doc .doc-table td { border: 1px solid #bbb; padding: 8px 10px; vertical-align: top; line-height: 1.8; }
.contract-doc .filled { font-weight: 700; color: var(--deep); border-bottom: 1px solid var(--gold); padding: 0 4px; }
.contract-doc .blank {
  display: inline-block; border-bottom: 1px solid #666; height: 1.15em;
  vertical-align: bottom; margin: 0 2px;
}

@media print {
  .sidebar, .no-print, .alert { display: none !important; }
  body.has-sidebar { display: block; }
  .content { padding: 0; }
  .content-inner { max-width: none; }
  .contract-doc { box-shadow: none; border-radius: 0; padding: 0; font-size: 12px; line-height: 1.9; }
  .contract-doc h2 { page-break-after: avoid; }
  .contract-doc .doc-table { page-break-inside: avoid; }
  @page { margin: 18mm 16mm; }
}

/* ===== LINE 客服三欄工作台 =====
   排版比照通訊軟體後台：左清單（頭像＋預覽＋搜尋）、中對話（日期分隔＋泡泡）、
   右客人資料（可折疊區塊）。三欄各自捲動，頁面本身不捲，
   才不會為了看最新訊息把整個後台往下拉。 */
.chat-topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.chat-topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.chat-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.chat-workspace > .card {
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-blank { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; text-align: center; }

/* 頭像：有 LINE 圖就蓋在色塊上，載入失敗會自己移除、露出底下的首字 */
.avatar {
  position: relative;
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1;
  overflow: hidden;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 46px; height: 46px; font-size: 19px; }

/* ---- 左欄 ---- */
.cl-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 14px 8px; font-size: 13px; color: #777;
}
.cl-head b { color: var(--deep); font-size: 15px; }
.cl-search { padding: 0 14px 10px; }
.cl-search input {
  width: 100%; padding: 8px 12px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--deep-t3); border-radius: 20px; background: var(--deep-t4);
}
.cl-search input:focus { outline: none; border-color: var(--gold); background: #fff; }
.cl-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px 12px; border-bottom: 1px solid var(--deep-t4);
}
.chat-filter {
  padding: 5px 12px; border-radius: 20px; font-size: 12px;
  background: var(--deep-t4); color: #666; text-decoration: none; white-space: nowrap;
}
.chat-filter:hover { background: var(--gold-t3); color: #7b613e; }
.chat-filter.on { background: var(--deep); color: #fff; font-weight: 700; }

.chat-items { flex: 1; overflow-y: auto; min-height: 0; }
.cl-empty { padding: 18px 14px; margin: 0; }
.chat-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-bottom: 1px solid var(--deep-t4);
  text-decoration: none; color: var(--ink); border-left: 3px solid transparent;
}
/* 搜尋過濾靠 hidden 屬性；.chat-item 自己有 display:flex，
   會蓋掉瀏覽器預設的 [hidden]{display:none}，所以要明寫一條 */
.chat-item[hidden] { display: none; }
.chat-item:hover { background: var(--gold-t4); }
.chat-item.on { background: var(--gold-t4); border-left-color: var(--gold); }
.chat-item .ci-body { flex: 1; min-width: 0; display: block; }
.chat-item .ci-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-item .nm { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .tm { font-size: 11px; color: #aaa; flex: 0 0 auto; }
.chat-item .pv {
  display: block; font-size: 12px; color: #999; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item .ci-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chat-item .ci-tags .tag { font-size: 11px; padding: 2px 8px; }

/* ---- 中欄 ---- */
.chat-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--deep-t4);
}
.chat-head .ch-title { flex: 1; min-width: 120px; line-height: 1.35; }
.chat-head .ch-sub { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.chat-head .ch-sub .tag { font-size: 11px; padding: 2px 8px; }
.chat-head .ch-actions { display: flex; gap: 6px; align-items: center; }

.chat-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 18px; }
.day-sep { text-align: center; margin: 16px 0 12px; }
.day-sep span {
  background: var(--deep-t4); color: #8b8b8b; font-size: 11px;
  padding: 3px 12px; border-radius: 20px;
}
.msg-row { display: flex; align-items: flex-end; gap: 8px; margin: 8px 0; }
.msg-row.out { flex-direction: row-reverse; }
.msg {
  max-width: min(62%, 540px); padding: 9px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.msg.in { background: var(--deep-t4); border-bottom-left-radius: 5px; }
.msg.out { color: #fff; border-bottom-right-radius: 5px; }
.msg.out.bot { background: var(--gold); }
.msg.out.staff { background: var(--deep); }
.msg-meta { font-size: 10.5px; color: #b0b0b0; white-space: nowrap; padding-bottom: 3px; }

.chat-compose { border-top: 1px solid var(--deep-t4); padding: 10px 16px 14px; }
.qr-panel { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qr-panel.open { display: flex; }
.qr {
  border: 1px solid var(--deep-t3); background: #fff; border-radius: 20px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; color: #555;
}
.qr:hover { border-color: var(--gold); color: var(--deep); }
.compose-box {
  border: 1px solid var(--deep-t3); border-radius: 12px; padding: 9px 12px;
  transition: border-color .12s;
}
.compose-box:focus-within { border-color: var(--gold); }
.compose-box textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  font-family: inherit; font-size: 14px; line-height: 1.6; max-height: 160px;
}
.compose-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.compose-bar .btn { white-space: nowrap; }
.compose-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.compose-tools .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-btn {
  border: 1px solid var(--deep-t3); background: #fff; border-radius: 8px;
  padding: 5px 11px; font-size: 12px; cursor: pointer; font-family: inherit;
  color: #555; white-space: nowrap;
}
.tool-btn:hover { border-color: var(--gold); color: var(--deep); }

/* ---- 右欄 ---- */
.cs-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; }
.chat-side p { font-size: 13px; margin: 5px 0; }
.cs-alert {
  background: var(--gold-t4); border: 1px solid var(--gold-t3); color: #7b613e;
  border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.6;
}
.cs-alert-red { background: #fbe9e7; border-color: #f0cdc8; color: var(--red); }
.cs-profile { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.cs-profile b { font-size: 15px; color: var(--deep); }
.cs-id {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  background: var(--deep-t4); border-radius: 8px; padding: 6px 10px; margin-bottom: 12px;
}
.cs-id span { font-size: 11px; color: #888; word-break: break-all; }
.cs-copy {
  flex: 0 0 auto; border: none; background: none; color: var(--gold);
  font-size: 12px; font-family: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.cs-block { border: 1px solid var(--deep-t4); border-radius: 10px; padding: 11px 12px; margin-bottom: 10px; }
.cs-block .section-title { margin-bottom: 8px; }
details.cs-block > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: var(--deep);
}
details.cs-block > summary::-webkit-details-marker { display: none; }
details.cs-block > summary::after { content: '▾'; margin-left: auto; color: #bbb; font-size: 11px; }
details.cs-block[open] > summary::after { content: '▴'; }
details.cs-block[open] > summary { margin-bottom: 8px; }
.cs-block .cnt {
  background: var(--deep-t4); color: #777; border-radius: 20px;
  font-size: 11px; font-weight: 600; padding: 1px 8px;
}
.cs-block textarea, .cs-bind select, .tag-add input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--deep-t3);
  border-radius: 8px; font-family: inherit; font-size: 13px;
}
.cs-block textarea { resize: vertical; margin-bottom: 8px; }
.cs-bind select { margin-bottom: 8px; }
.cs-contract { border-top: 1px solid var(--deep-t4); padding-top: 8px; margin-top: 8px; }
.cs-contract:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.cs-contract p { margin: 2px 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.tag-x {
  /* 負 margin 讓可點範圍比看到的 × 大一圈，chip 外觀維持不變 */
  border: none; background: none; cursor: pointer; font-family: inherit;
  color: #999; font-size: 14px; line-height: 1;
  padding: 5px 6px 5px 6px; margin: -5px -6px -5px -1px;
}
.tag-x:hover { color: var(--red); }
.tag-add { display: flex; gap: 6px; }
.tag-add input { flex: 1; }
.tag-picker { margin-top: 10px; }
.tag-picker > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tag-pick {
  border: 1px dashed var(--deep-t3); background: #fff; border-radius: 20px;
  padding: 3px 10px; font-size: 12px; color: #777; cursor: pointer; font-family: inherit;
}
.tag-pick:hover { border-style: solid; border-color: var(--gold); color: var(--deep); }

/* 右欄先收到底下（雙欄），再收成單欄；單欄時各區塊改用自然高度 */
/* 放不下三欄時，客人資料改排到下面，整頁也改回一般捲動——
   欄位疊起來之後再硬塞進一個視窗高，每一塊都只剩幾行看得到。 */
@media (max-width: 1240px) {
  body.fullheight .content { height: auto; overflow: visible; padding-bottom: 48px; }
  body.fullheight .content-inner { display: block; height: auto; }
  .chat-workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .chat-list { max-height: 72vh; }
  .chat-main { min-height: 62vh; }
  .chat-side { grid-column: 1 / -1; max-height: none; }
}
@media (max-width: 860px) {
  /* 手機的組字列會壓縮輸入區，說明文字讓位給按鈕 */
  .compose-tools .hint { display: none; }
  .chat-workspace { grid-template-columns: 1fr; }
  .chat-list { max-height: 380px; }
  .chat-main { min-height: 460px; }
  .msg { max-width: 84%; }
  .chat-head .ch-actions { width: 100%; }
}

/* ---- 櫃位管理：櫃型摘要與色帶 ---- */
.type-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.type-card { border: 1px solid var(--line, #e3ded5); border-radius: 8px; padding: 12px 14px; background: #fff; }
.type-head { display: flex; align-items: center; gap: 8px; }
.type-name { font-weight: 800; font-size: 18px; color: var(--deep); }
.type-rent { margin-left: auto; font-weight: 700; color: var(--deep); }
.type-meta { font-size: 12px; color: #888; margin-top: 4px; }
.type-nums { display: flex; gap: 14px; font-size: 13px; color: #555; margin-top: 8px; }
.type-chip { display: inline-block; width: 10px; height: 18px; border-radius: 2px; vertical-align: middle; }
.note-cell { max-width: 280px; font-size: 12px; color: #666; }

/* ---- 櫃位管理：滿版兩欄（左平面圖／右明細，各自捲動）---- */
.cab-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 12px; flex: none; }
.cab-topbar-left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cab-topbar-actions { display: flex; gap: 8px; align-items: center; }
.type-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.type-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line, #e3ded5); border-radius: 999px; background: #fff; font-size: 12px; color: #555; white-space: nowrap; }
.type-pill b { color: var(--deep); }
.type-pill-nums { color: #888; }
.cab-layout { display: flex; gap: 16px; flex: 1; min-height: 0; }
.cab-pane { background: #fff; border: 1px solid var(--line, #e3ded5); border-radius: 10px; min-height: 0; overflow: auto; }
.cab-pane-map { flex: 1 1 0; display: flex; flex-direction: column; padding: 14px; }
.cab-pane-list { flex: 0 0 580px; }
.cab-map { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cab-map-svg { flex: 1; min-height: 0; display: flex; justify-content: center; }
.cab-map-svg svg { width: 100%; height: 100%; max-height: 100%; }
.cab-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding-top: 10px; flex: none; }
.cab-pane-map .cabinet-grid { overflow: auto; }
.cab-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cab-table thead th { position: sticky; top: 0; background: #faf8f5; z-index: 1; font-size: 12px; color: #888; font-weight: 600; text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line, #e3ded5); }
.cab-table td { padding: 8px 8px; border-bottom: 1px solid #f0ece5; vertical-align: middle; white-space: nowrap; }
.cab-table td.dim { color: #777; font-size: 12px; }
.cab-table .cab-actions { display: flex; gap: 6px; }
.cab-table .cab-note-row td { padding: 0 10px 8px; white-space: normal; border-top: none; }
.cab-table .cab-note-row small { display: block; margin-top: -4px; }
@media (max-width: 1240px) {
  .cab-layout { flex-direction: column; }
  .cab-pane { overflow: visible; }
  .cab-pane-list { flex: none; }
  .cab-pane-map, .cab-map, .cab-map-svg { flex: none; display: block; }
  .cab-map-svg svg { display: block; width: 100%; height: auto; max-width: 640px; margin: 0 auto; }
  .cab-table thead th { position: static; }
}

/* ---- 報價單／費用明細確認書 ---- */
.contract-doc .doc-sub { text-align: center; color: #555; font-size: 12px; margin: 0 0 4px; }
.contract-doc .doc-meta { text-align: center; color: #555; font-size: 12px; margin: 0 0 18px; }
.contract-doc .doc-table th { border: 1px solid #bbb; padding: 8px 10px; background: #f3f5f4; text-align: left; font-weight: 700; white-space: nowrap; }
.contract-doc .doc-kv th { width: 16%; }
.contract-doc .doc-table .num { text-align: right; white-space: nowrap; }
.contract-doc .doc-lines tr.total td { font-weight: 700; background: #fdf3e7; border-top: 2px solid var(--gold); }
.contract-doc .doc-sign td { width: 50%; padding: 18px 14px; line-height: 2.2; }
.contract-doc ul { margin: 6px 0 0 18px; padding: 0; }
.contract-doc li { margin: 4px 0; text-align: justify; }

/* ---- 新增合約：費用試算摘要 ---- */
.quote-box { background: #fdf3e7; border: 1px solid var(--gold); border-radius: 10px; padding: 14px 16px; margin: 6px 0 16px; }
.quote-box table { width: 100%; font-size: 13px; }
.quote-box td { padding: 3px 0; }
.quote-box td.num { text-align: right; white-space: nowrap; }
.quote-box tr.total td { font-weight: 700; border-top: 1px solid var(--gold); padding-top: 6px; }
.quote-box .promo-text { color: #555; font-size: 12px; margin-top: 6px; }
.quote-box .quote-error { color: #b3261e; font-size: 13px; }

/* 收款列表的「標記已收」內嵌小表單：收款方式、匯款人、末五碼、實收日 */
.pay-form { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pay-form .pay-in { padding: 4px 6px; font-size: 12px; height: 28px; border: 1px solid #ccc; border-radius: 6px; }
