/* 借位坊 全站共用樣式（依設計 1-9 設計與介面規則）
   斷點：手機 < 600px、平板 600–900px、電腦 ≥ 900px
   第一版只做淺色模式。 */

:root {
  --navy: #13283F;      /* 深海軍藍：標題列、主要按鈕 */
  --blue: #12507A;      /* 品牌藍：連結、開關、選取 */
  --gold: #E8B100;      /* 金黃：重點提示、徽章 */
  --paper: #FAF8F3;     /* 米白底：頁面背景 */
  --ink: #1D2733;       /* 內文 */
  --muted: #4F5A66;     /* 輔助說明 */
  --line: #E3DDD0;      /* 框線 */
  --line-soft: #EFEAE0;
  --nav-text: #C9D3DE;
  --danger: #8A1F1B;
  --danger-bg: #FFF4F3;
  --font-sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --font-serif: 'Noto Serif TC', 'PMingLiU', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* 大字模式：全站放大約 25%（客戶可自選，記在帳號） */
html.large { font-size: 20px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.7;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--blue); }
img { max-width: 100%; height: auto; }
h1, .h1 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 1.625rem; color: var(--navy); line-height: 1.35; }
h2, .h2 { margin: 0 0 8px; font-size: 1.2rem; color: var(--navy); }
.lead { margin: 0 0 20px; color: var(--muted); font-size: .875rem; }
.hint { font-size: .8125rem; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 卡片 ── */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 24px; }

/* ── 按鈕：高度至少 44px；一個畫面只有一個主要動作 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 22px; border-radius: 6px; border: 1px solid transparent;
  font-size: .9375rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--navy); color: var(--paper); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); font-weight: 500; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-plain { background: #fff; color: var(--ink); border-color: #9AA5B1; font-weight: 500; }
.btn-sm { min-height: 44px; padding: 0 18px; }
.btn:disabled, .btn[aria-disabled="true"] { background: #EDEFF2; color: #6B7580; border-color: #D9DEE4; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── 狀態標籤（規則不改） ── */
.tag { display: inline-block; padding: 3px 12px; border-radius: 14px; font-size: .8125rem; font-weight: 500; }
.tag-ok { background: #E3F3E8; color: #1E6B3A; }      /* 正常／已付款 */
.tag-warn { background: #FFF6D6; color: #7A4F00; }    /* 注意／即將到期 */
.tag-bad { background: #FBE3E1; color: #8A1F1B; }     /* 異常／逾期 */
.tag-off { background: #EFEAE0; color: #4F5A66; }     /* 停用／已結束 */

/* ── 篩選小膠囊（可多選） ── */
.chip {
  min-height: 40px; padding: 6px 14px; border-radius: 20px; font-size: .8125rem; cursor: pointer;
  border: 1px solid #9AA5B1; background: #fff; color: var(--navy); text-decoration: none; display: inline-flex; align-items: center;
}
.chip[aria-pressed="true"], .chip.is-on { border-color: var(--navy); background: var(--navy); color: var(--paper); }

/* ── 三種畫面狀態：載入中、沒有資料、發生錯誤 ── */
.state { border: 1px dashed #9AA5B1; border-radius: 8px; padding: 22px; text-align: center; background: var(--paper); }
.state-title { font-size: 1.1em; font-weight: 500; margin-bottom: 4px; }
.state-body { font-size: .8125rem; color: var(--muted); }
.state .btn-row { justify-content: center; margin-top: 12px; }
.state-error { border-color: var(--danger); background: var(--danger-bg); }
.skeleton { height: 14px; border-radius: 4px; margin: 8px auto; max-width: 420px;
  background: linear-gradient(90deg, #EFEAE0 25%, #F7F3EA 50%, #EFEAE0 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── 固定在上方的列（有分頁或篩選的長頁面） ── */
.sticky-bar { position: sticky; top: 0; z-index: 30; background: var(--paper); padding: 6px 0 8px; }
.admin-shell .sticky-bar { top: var(--sticky-top, 0px); }

/* ── 危險操作確認框 ── */
.confirm {
  margin-top: 12px; border: 2px solid var(--danger); border-radius: 8px; padding: 12px 14px; background: var(--danger-bg);
}
.confirm-title { font-weight: 700; color: var(--danger); }
.confirm-body { font-size: .8125rem; margin: 4px 0 10px; }
dialog.confirm-dialog { max-width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; background: transparent; }
dialog.confirm-dialog::backdrop { background: rgba(10, 18, 28, .55); }
dialog.confirm-dialog .confirm { margin: 0; }

/* ── 操作回饋訊息：固定在畫面上方中央，很明顯 ── */
.toast-wrap { position: fixed; z-index: 10001; left: 50%; top: 16px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 8px;
  font-size: 1rem; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.22); border-left: 6px solid;
  animation: toast-in .2s ease-out;
}
.toast-ok { background: var(--navy); color: #fff; border-color: var(--gold); }
.toast-error { background: var(--danger); color: #fff; border-color: #FFB4AE; }
.toast-info { background: #fff; color: var(--navy); border-color: var(--blue); }
.toast-text { flex: 1; }
.toast-close { flex: 0 0 auto; min-width: 44px; min-height: 44px; margin: -10px -8px -10px 0; border: 0; background: transparent; color: inherit; font-size: 1.25rem; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ── 回頂部按鈕：往下捲一小段後出現在右下角 ── */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 9999; min-height: 48px; min-width: 48px; padding: 0 16px;
  border: 0; border-radius: 24px; background: var(--navy); color: var(--paper); font-size: .875rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: pointer;
}
.to-top[hidden] { display: none; }

/* ── 表單 ── */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 500; margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #9AA5B1; border-radius: 6px; background: #fff; color: var(--ink);
}
.input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--navy); }
.field-error { color: var(--danger); font-size: .8125rem; margin-top: 4px; }

/* ── 表格：手機改成卡片 ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.table th { background: #F5F1E8; color: var(--navy); font-weight: 700; white-space: nowrap; }

/* ════════ 後台版面 ════════ */
.admin-shell { display: flex; min-height: 100vh; }
.admin-nav { flex: 0 0 230px; background: var(--navy); color: var(--paper); padding: 24px 16px; }
.admin-nav-inner { position: sticky; top: 24px; }
.admin-nav-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.admin-nav-head img { height: 44px; width: auto; display: block; }
.admin-menu { display: flex; flex-direction: column; gap: 4px; font-size: .9375rem; }
.admin-menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border-radius: 6px; color: var(--nav-text); text-decoration: none; }
.admin-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-menu a[aria-current="page"] { background: var(--gold); color: var(--navy); font-weight: 700; }
.admin-menu .menu-icon { flex: 0 0 22px; text-align: center; }
.admin-menu .menu-group { margin: 12px 12px 2px; font-size: .75rem; color: #8FA3B8; letter-spacing: .05em; }
.admin-user { margin-top: 18px; padding-top: 14px; border-top: 1px solid #2B4560; font-size: .8125rem; color: var(--nav-text); }
.admin-user form { margin-top: 6px; }
.who-link { display: block; min-height: 44px; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; color: var(--paper); text-decoration: none; }
.who-link:hover, .who-link:focus-visible { background: #22405E; }
.who-link .who { display: block; font-weight: 500; }
.who-link .who-hint { display: block; margin-top: 2px; color: var(--nav-text); font-size: .75rem; }
.admin-user button { min-height: 44px; padding: 0 14px; border: 1px solid #5B7389; border-radius: 6px; background: transparent; color: var(--paper); cursor: pointer; }
.menu-toggle, .menu-close { display: none; height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid #5B7389; border-radius: 6px; background: transparent; color: var(--paper); font-size: .875rem; cursor: pointer; }
.admin-topbar { display: none; }
.menu-backdrop { display: none; }
.admin-main { flex: 1 1 auto; min-width: 0; }
.admin-content { max-width: 1200px; margin: 0 auto; padding: 28px 4% 96px; }

/* 平板：側邊選單縮成只顯示圖示 */
@media (min-width: 600px) and (max-width: 899.98px) {
  .admin-nav { flex-basis: 76px; padding: 16px 8px; }
  .admin-nav-head { justify-content: center; }
  .admin-nav-head img { height: 32px; }
  .admin-menu a { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: .6875rem; text-align: center; line-height: 1.3; }
  .admin-menu .menu-icon { font-size: 1.25rem; flex-basis: auto; }
  .admin-menu .menu-group { display: none; }
  .admin-user { text-align: center; font-size: .6875rem; }
  .admin-user .who { display: none; }
  .who-link { margin: 0; padding: 6px 2px; }
  .who-link .who-hint { margin-top: 0; }
  .admin-user button { padding: 0 6px; font-size: .75rem; }
}

/* 手機：選單收進左上角按鈕，點開從左側滑出 */
@media (max-width: 599.98px) {
  .admin-shell { display: block; }
  .admin-topbar { display: flex; position: sticky; top: 0; z-index: 50; align-items: center; gap: 12px; padding: 8px 14px; background: var(--navy); }
  .admin-topbar img { height: 36px; width: auto; display: block; }
  .admin-shell { --sticky-top: 60px; }
  .menu-toggle, .menu-close { display: inline-flex; align-items: center; }
  .admin-nav {
    position: fixed; z-index: 1000; top: 0; bottom: 0; left: 0; width: min(280px, 85vw); overflow-y: auto;
    transform: translateX(-105%); visibility: hidden; transition: transform .22s ease-out, visibility 0s linear .22s; padding: 16px;
  }
  .admin-nav-inner { position: static; }
  .admin-shell.menu-open .admin-nav { transform: none; visibility: visible; transition: transform .22s ease-out; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .admin-shell.menu-open .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(10,18,28,.5); }
  .admin-content { padding: 20px 14px 96px; }
  h1, .h1 { font-size: 1.5rem; }
  .btn-row.stack-phone > .btn { flex: 1 1 100%; }
  /* 表格改成一張一張的卡片 */
  .table.cards-phone thead { display: none; }
  .table.cards-phone tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table.cards-phone td { display: flex; gap: 12px; border: 0; padding: 4px 14px; }
  .table.cards-phone td::before { content: attr(data-label); flex: 0 0 6.5em; color: var(--muted); font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .admin-nav, .toast, .skeleton { transition: none; animation: none; }
}

/* ════════ 公開網站版面 ════════ */
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 5%; background: var(--navy); }
.site-header img { height: 40px; width: auto; display: block; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; color: var(--paper); text-decoration: none; font-size: .875rem; }
.site-nav a[aria-current="page"] { color: var(--gold); font-weight: 700; }
.site-main { max-width: 1000px; margin: 0 auto; padding: 32px 5% 120px; }
.site-footer { background: var(--navy); color: var(--nav-text); padding: 28px 5% 100px; font-size: .875rem; }
.site-footer-inner { max-width: 1000px; margin: 0 auto; }
.site-footer a { color: var(--paper); }
.line-fab { position: fixed; right: 16px; bottom: 76px; z-index: 9998; display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 24px; background: #06C755; color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
@media (max-width: 599.98px) {
  .site-header { padding: 8px 14px; }
  .site-header img { height: 34px; }
  .site-nav a { padding: 0 8px; }
  .site-main { padding: 24px 14px 120px; }
}

/* ── 提示框 ── */
.notice { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: .875rem; border: 1px solid; }
.notice-ok { background: #E3F3E8; border-color: #9CCBAA; color: #1E4D2D; }
.notice-bad { background: #FBE3E1; border-color: var(--danger); color: var(--danger); font-weight: 700; }
.notice-warn { background: #FFF6D6; border-color: var(--gold); color: #5C3D00; }
.notice-info { background: #fff; border-color: var(--line); color: var(--muted); }
.note { background: #F3EFE5; border-radius: 6px; padding: 10px 12px; font-size: .8125rem; color: var(--muted); }

/* ── 左清單、右詳細（窄螢幕自動上下排） ── */
.split { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.split-main { flex: 1 1 380px; min-width: 0; }
.split-side { flex: 1 1 300px; min-width: 0; padding: 20px; margin-bottom: 0; scroll-margin-top: 80px; }
.list { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 14px; min-height: 56px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #FFFBEE; }
.list-row.is-on { background: #FFF6D6; }
.list-row-main { flex: 1 1 200px; min-width: 0; }
.list-row-title { font-weight: 500; }
.dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .875rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8125rem; }

/* ── 開關、權限格 ── */
.btn-xs { min-height: 36px; padding: 0 12px; font-size: .8125rem; }
.center { text-align: center !important; }
.switch { flex: none; position: relative; width: 60px; height: 34px; border-radius: 17px; border: 0; cursor: pointer; background: #C9D0D8; padding: 0; }
.switch[aria-checked="true"] { background: var(--blue); }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.switch-knob { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] .switch-knob { left: 30px; }
.perm-cell { width: 44px; height: 44px; border-radius: 8px; font-size: 1.125rem; font-weight: 700; cursor: pointer; border: 1px solid #9AA5B1; background: #fff; color: #fff; }
.perm-cell.is-on { background: var(--blue); }
.perm-cell.is-locked { background: #C9D0D8; color: #5C6670; cursor: not-allowed; }
.perm-cell:disabled:not(.is-locked) { cursor: not-allowed; opacity: .7; }
.perm-never { display: inline-block; width: 44px; line-height: 44px; color: #9AA5B1; }
.perm-table td { vertical-align: middle; }
.is-muted td { color: var(--muted); background: #FBFAF6; }
.menu-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; background: var(--navy); color: var(--paper); font-size: .875rem; }
.sticky-scope { margin-bottom: 24px; }

/* ── 系統設定 ── */
.setting-row { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-input { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 6px; }
.setting-input .input { flex: 0 1 320px; width: auto; }
.setting-def { flex: 1 1 auto; }
.input[readonly], .input:disabled { background: #F3F1EC; color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-bg); }
@media (max-width: 599.98px) { .setting-input .input { flex-basis: 100%; } }

/* ── 管理員登入（設計 1-1a）：電腦左右兩欄，平板手機上下 ── */
.btn-block { width: 100%; min-height: 50px; }
.input-lg { height: 48px; }
.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-panel { background: var(--navy); color: var(--paper); padding: 18px 20px; display: flex; align-items: center; }
.login-logo { width: 170px; display: block; }
.login-panel-text, .login-panel-foot { display: none; }
.login-main { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px 32px; gap: 18px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 24px 18px; }
.login-h1 { font-size: 1.625rem; margin-bottom: 6px; }
.login-step { margin: 0 0 22px; color: var(--muted); font-size: .875rem; }
.login-gap { margin-bottom: 16px; }
.login-note { font-size: .8125rem; color: var(--muted); text-align: center; max-width: 420px; }
.login-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .875rem; margin-top: 16px; }
.login-links-start { justify-content: flex-start; gap: 12px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font-size: inherit; }
.link-btn:disabled { color: #6B7580; text-decoration: none; cursor: not-allowed; }
.pw-row { display: flex; gap: 8px; margin-bottom: 24px; }
.pw-row .input { flex: 1; min-width: 0; }
.pw-toggle { height: 48px; min-height: 48px; padding: 0 14px; font-size: .875rem; }
.otp-input { height: 56px; font-size: 1.75rem; letter-spacing: 10px; text-align: center; margin-bottom: 14px; }
.rc-input { letter-spacing: 4px; text-transform: uppercase; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: .875rem; margin-bottom: 18px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.lock-icon { width: 48px; height: 48px; border-radius: 50%; background: #FDECEA; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.lock-ways { background: #F3EFE5; border-radius: 6px; padding: 14px 16px; margin-bottom: 4px; font-size: .875rem; }
.lock-ways-title { font-weight: 500; }
.lock-ways-body { color: var(--muted); margin-top: 4px; }
@media (min-width: 600px) {
  .login-main { padding: 40px 6%; }
  .login-card { padding: 36px; }
}
@media (min-width: 900px) {
  .login-page { flex-direction: row; }
  .login-panel { flex: 0 0 42%; min-height: 100vh; padding: 56px 6%; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 32px; }
  .login-logo { width: 260px; }
  .login-panel-text, .login-panel-foot { display: block; }
  .login-panel-title { font-family: var(--font-serif); font-size: 2.125rem; font-weight: 700; line-height: 1.3; margin-bottom: 12px; }
  .login-panel-lead { color: var(--nav-text); max-width: 360px; }
  .login-panel-foot { font-size: .8125rem; color: var(--nav-text); }
}

/* ── 首次設定兩步驟驗證（設計 1-1b） ── */
.setup-top { background: var(--navy); color: var(--paper); padding: 18px 6%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.setup-brand { display: flex; align-items: center; gap: 12px; }
.setup-brand img { height: 40px; width: auto; display: block; }
.setup-brand span { font-size: .75rem; letter-spacing: 3px; color: var(--gold); font-weight: 500; }
.setup-top-note { font-size: .875rem; color: var(--nav-text); }
.setup-main { max-width: 1100px; margin: 0 auto; padding: 48px 6% 64px; }
.setup-h1 { font-size: 1.875rem; margin-bottom: 8px; }
.setup-lead { margin: 0 0 32px; color: var(--muted); max-width: 640px; }
.setup-grid { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.setup-col { flex: 1 1 460px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.setup-step { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; gap: 14px; align-items: flex-start; }
.setup-codes { flex: 1 1 360px; display: block; min-width: 0; }
.setup-step-head { display: flex; gap: 14px; align-items: flex-start; }
.step-no { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--paper); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.step-body { flex: 1; min-width: 0; }
.step-title { display: block; font-weight: 700; margin-bottom: 4px; }
.step-text { color: var(--muted); font-size: .875rem; margin-bottom: 14px; }
.qr-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.qr-box { width: 160px; height: 160px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.secret-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem; color: var(--ink); letter-spacing: 1px; word-break: break-all; margin-top: 4px; }
.setup-otp { max-width: 260px; margin-bottom: 0; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9375rem; }
.rc-item { background: #F3EFE5; border-radius: 6px; padding: 8px 10px; text-align: center; letter-spacing: 1px; }
.setup-codes .btn-row { margin-bottom: 16px; }
.setup-codes .btn-block { margin-bottom: 8px; }
@media print {
  .setup-top, .setup-col, .setup-lead, .no-print, .to-top, .toast-wrap { display: none !important; }
  .setup-step { border: 0; padding: 0; }
}

/* ── 用戶管理（設計 1-1g/h/i）、角色權限與登入紀錄（設計 1-1j） ── */
.tag-info { background: #E6EEF6; color: #1B4568; }
.nowrap { white-space: nowrap; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row .input { flex: 1 1 180px; min-width: 0; }
.filter-row .filter-select { flex: 0 1 160px; }
.list-card { padding: 0; overflow: hidden; margin-bottom: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 14px; }
.action-grid .btn { min-height: 46px; padding: 0 8px; font-size: .875rem; }
@media (min-width: 600px) { .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.temp-pw { font-size: .9375rem; }
.temp-pw-code { font-size: 1.5rem; letter-spacing: 3px; background: #fff; border-radius: 6px; padding: 6px 12px; margin: 8px 0; display: inline-block; user-select: all; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.admin-card-name { font-weight: 700; }
.admin-card-role { color: var(--blue); font-size: .875rem; font-weight: 500; margin-bottom: 4px; }
.viewer-form { display: grid; gap: 4px; max-width: 420px; }
.perm-table td { white-space: nowrap; }

/* ── 網站內容後台（設計 3-1a） ── */
.tag-link { background: #E8F0F7; color: var(--blue); }
.inline-form { display: inline; margin: 0; }
.web-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.web-tabs { gap: 6px; }
.web-status { gap: 6px; }
.web-list { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.web-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); border-left: 4px solid transparent; }
.web-row:last-child { border-bottom: 0; }
.web-row-own { border-left-color: #1E6B3A; }
.web-row-link { border-left-color: var(--blue); }
.web-row.is-off .web-row-main { opacity: .5; }
.web-row.is-on { background: #FFF6D6; }
.web-row-main { flex: 1 1 260px; min-width: 0; }
.web-row-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.web-row-acts .btn-xs { min-width: 44px; }
.web-edit { padding: 20px; scroll-margin-top: 140px; }
.web-row { scroll-margin-top: 140px; }
.web-row-edit { padding: 16px 18px 18px; border-bottom: 1px solid var(--line-soft); border-left: 4px solid #1E6B3A; background: #FFFDF5; }
.web-row-edit[hidden] { display: none; }
.web-row-edit h3 { margin-top: 18px; }
.web-row-edit .input { max-width: 640px; }
.web-edit h3 { margin-top: 18px; }
.web-diff { margin: 0; padding-left: 1.2em; font-size: .9375rem; }
.web-diff li { margin-bottom: 4px; }
.chip-field { border: 0; padding: 0; margin: 0 0 14px; }
.chip-radio { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip-radio:has(input:checked) { border-color: var(--navy); background: var(--navy); color: var(--paper); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { font-size: .8125rem; max-width: 220px; }
.date-input { max-width: 220px; }
.web-preview { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 100%; }
.web-preview.is-phone { max-width: 380px; }
.web-preview-head { background: var(--navy); color: var(--paper); padding: 12px 16px; font-weight: 700; }
.web-preview-block { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.web-preview-title { font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.web-preview-text { white-space: pre-line; font-size: .9375rem; color: var(--muted); }
.web-preview-line { margin: 14px 16px; display: inline-block; background: #06C755; color: #fff; border-radius: 20px; padding: 8px 16px; font-weight: 700; font-size: .875rem; }

/* ── 公開網站（設計 3-1b～3-1i）── */
.pub-pre { white-space: pre-line; }
.pub-hero { margin: -32px calc(50% - 50vw) 34px; padding: 56px calc(max(0px, 50vw - 500px) + 5%); background: linear-gradient(135deg, #13283F, #1E4468); color: var(--paper); }
.pub-hero h1 { margin: 0 0 10px; font-family: var(--font-serif); font-size: 2.5rem; line-height: 1.3; color: var(--paper); }
.pub-hero p { margin: 0 0 18px; font-size: 1.0625rem; color: var(--nav-text); max-width: 560px; }
.btn-gold { background: var(--gold); color: var(--navy); font-weight: 700; }
.btn-outline-light { background: transparent; color: var(--paper); border-color: var(--nav-text); }
.btn-line { background: #06C755; color: #fff; font-weight: 700; }
.pub-section { margin-bottom: 34px; }
.pub-section h2 { font-family: var(--font-serif); color: var(--navy); margin: 0 0 12px; scroll-margin-top: 80px; }
.pub-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.pub-card { background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--blue); border-radius: 10px; padding: 16px 18px; }
.pub-card-t { font-weight: 700; font-size: 1.125rem; color: var(--navy); margin-bottom: 6px; }
.pub-card-d { color: var(--muted); }
.pub-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pub-flow-note { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--navy); }
.pub-step { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.pub-step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 6px; }
.pub-step-t { font-weight: 700; color: var(--navy); }
.pub-step-d { font-size: .875rem; color: var(--muted); }
.pub-news { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.pub-news-date { font-size: .8125rem; color: var(--muted); }
.pub-news-title { margin: 0; font-size: 1rem; color: var(--navy); }
.pub-news-body { color: var(--muted); font-size: .9375rem; }
.pub-gos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pub-go { display: block; background: var(--navy); color: var(--paper); border-radius: 10px; padding: 16px 18px; text-decoration: none; }
.pub-go-t { font-weight: 700; font-size: 1.0625rem; color: var(--gold); }
.pub-go-d { font-size: .875rem; color: var(--nav-text); }
.pub-line { background: #fff; border: 1px solid var(--line); border-left: 5px solid #06C755; border-radius: 10px; padding: 18px; }
.pub-line p { margin: 0 0 12px; color: var(--muted); }
.pub-search { margin-top: 8px; }
.pub-faq { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 28px; }
.pub-faq-item { border-bottom: 1px solid var(--line-soft); }
.pub-faq-item:last-child { border-bottom: 0; }
.pub-faq-item summary { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 48px; padding: 10px 16px; cursor: pointer; font-weight: 700; color: var(--navy); list-style: none; }
.pub-faq-item summary::-webkit-details-marker { display: none; }
.pub-faq-sign::before { content: '＋'; color: var(--blue); }
.pub-faq-item[open] .pub-faq-sign::before { content: '－'; }
.pub-faq-cat { font-weight: 400; font-size: .8125rem; color: var(--muted); }
.pub-faq-a { padding: 0 16px 14px; color: var(--ink); }
.pub-empty { background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: 18px; color: var(--muted); }
.pub-form h2 { font-family: var(--font-serif); color: var(--navy); margin: 0 0 12px; }
.pub-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.pub-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 14px; }
.consent { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 6px 0 14px; }
.consent-text { margin: 0 0 8px; font-size: .875rem; color: var(--ink); }
.consent-check { margin-bottom: 0; font-weight: 700; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pub-coming { text-align: center; padding: 10vh 0; }
.pub-coming .btn-row { justify-content: center; }
.pub-preview-bar { margin-bottom: 16px; }
.pub-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 40px; margin-bottom: 18px; }
.pub-contacts { display: contents; }
.pub-contact-k { color: #8FA3B8; }
.pub-icons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; grid-column: 1 / -1; }
.pub-icons-title { letter-spacing: .1em; margin-right: 6px; }
.pub-icons a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 8px; border: 1px solid #5B7389; border-radius: 22px; color: var(--paper); text-decoration: none; font-size: .8125rem; }
.pub-footer-note { margin-top: 14px; font-size: .8125rem; color: #8FA3B8; }
@media (max-width: 599.98px) {
  .pub-hero { margin-top: -24px; padding: 36px 14px; }
  .pub-hero h1 { font-size: 1.875rem; }
}

/* ── 網站收件清單 ── */
.inbox-alert { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 1rem; }
.inbox-item.is-new { border-left: 5px solid var(--gold); }
.inbox-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.inbox-body { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.inbox-msg { background: var(--paper); border-radius: 6px; padding: 8px 10px; margin: 4px 0; }
.inbox-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inbox-note { flex: 1 1 260px; margin-bottom: 0; }

/* 我的帳號（/admin/account） */
.account-card { max-width: 640px; }
.account-card .input { max-width: 360px; }
.account-card .pw-row { max-width: 360px; margin-bottom: 0; }
.account-card .pw-row .input { max-width: none; }
.account-card .pw-toggle { height: auto; min-height: 44px; }
.account-card .account-otp { max-width: 200px; }
.account-card .field-label { margin-top: 14px; }
.account-actions { margin-top: 16px; }
.account-info { display: grid; gap: 8px; margin: 0 0 8px; }
.account-info div { display: flex; gap: 12px; flex-wrap: wrap; }
.account-info dt { min-width: 7em; color: var(--muted, #5B6B7B); }
.account-info dd { margin: 0; font-weight: 500; }

/* 用戶管理：觀察者改名稱、移除 */
.user-subform { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line, #E3DED3); }
.user-subform .btn-row { margin-top: 10px; }
.user-remove h3 { color: var(--danger); }
.web-src-link { color: var(--link, #12507A); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ── 篩選自動搜尋：有 JavaScript 時藏起「搜尋」按鈕（沒有 JavaScript 時照常顯示） ── */
[data-auto-submit-hide][hidden] { display: none; }

/* ── 操作紀錄依帳號篩選、用戶管理面板的操作紀錄 ── */
.audit-account-row { margin-top: 8px; }
.audit-account-row .filter-select { flex: 1 1 260px; max-width: 420px; }
.user-audit .btn-row { margin-top: 10px; }
.user-audit-chips .chip { min-height: 36px; padding: 4px 12px; }
.user-audit .list { margin-top: 12px; }
.user-audit .list-row .tag { margin-right: 4px; }

/* ── 服務與價目表（設計 2-2） ── */
.price-card { margin-bottom: 20px; }
.price-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.price-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(180px, 1.6fr) auto auto; gap: 10px 16px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line, #E3DED3); border-radius: 10px; background: #fff; }
.price-row.is-off { opacity: .6; }
.price-row > .tag { justify-self: start; }
.price-row-title { font-weight: 700; color: var(--navy); }
.price-row-money { font-size: .875rem; }
.price-ref { font-size: .75rem; color: var(--muted); background: #FFF6D6; border-radius: 8px; padding: 6px 10px; }
.price-row-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.btn-text-danger { color: var(--danger); }
.price-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line, #E3DED3); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.price-versions { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.price-ver { border-left: 4px solid #C9D0D8; padding: 6px 12px; background: #fff; border-radius: 6px; }
.price-ver.is-current { border-left-color: var(--blue); }
.price-ver summary { cursor: pointer; min-height: 32px; }
.price-ver-group { margin-top: 8px; }
.price-ver-items { margin: 4px 0 0; padding-left: 20px; font-size: .875rem; }
.price-ver-more { margin: 4px 0 10px; }
.price-ver-more > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); font-weight: 500; }
.price-ver-more > summary::before { content: "▸"; margin-right: 6px; }
.price-ver-more[open] > summary::before { content: "▾"; }
.price-ver-head { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line, #E3DED3); }
@media (max-width: 760px) {
  .price-row { grid-template-columns: 1fr; }
  .price-row-acts { justify-content: flex-start; }
}

/* ── 客戶（階段 2 步驟 2：清單、新增／編輯、客戶頁） ── */
.page-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; }
.crumb { font-size: .875rem; color: var(--muted); margin-bottom: 6px; }
.req { color: #8A1F1B; }
.input.is-bad { border-color: #8A1F1B; }
.cust-list .list-row { grid-template-columns: minmax(160px, 2fr) minmax(110px, 1fr) auto minmax(110px, auto); }
.cust-kind { margin: 8px 0 14px; }
.cust-kind .chip { min-height: 44px; display: inline-flex; align-items: center; padding: 6px 18px; }
.cust-form .card { margin-bottom: 16px; }
.cust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cust-contact { border: 1px solid var(--line, #E3DED3); border-radius: 8px; padding: 10px 14px 6px; margin: 0 0 12px; }
.cust-contact[hidden] { display: none; }
.cust-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1.3fr); gap: 16px; align-items: start; margin-top: 12px; }
.cust-contact-list, .cust-log-list { list-style: none; margin: 6px 0 12px; padding: 0; }
.cust-contact-list li, .cust-log-list li { padding: 8px 0; border-bottom: 1px solid #EFEAE0; font-size: .9375rem; overflow-wrap: anywhere; }
.cust-contact-list .tag { margin-left: 8px; }
.id-reveal { display: inline-flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.id-count { font-size: .8125rem; color: #7A4F00; font-weight: 500; }
.reveal-panel { margin: 10px 0; padding: 12px 14px; border: 2px solid var(--blue); border-radius: 8px; background: #F5F9FC; }
.pager { margin-top: 12px; }
@media (max-width: 900px) {
  .cust-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cust-list .list-row { grid-template-columns: 1fr auto; }
}

/* ── 合約（階段 2 步驟 3：設計 2-1c 電腦、2-1d 手機） ── */
.ct-list .list-row { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) auto; }
.ct-progress { margin-bottom: 14px; }
.ct-steps-wrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 18px; }
.ct-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); flex: 1 1 520px; min-width: 0; }
.ct-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.ct-step::before { content: ""; position: absolute; top: 19px; right: 50%; width: 100%; height: 4px; background: #C9D0D8; }
.ct-step:first-child::before { display: none; }
.ct-step.is-done::before, .ct-step.is-cur::before { background: var(--blue); }
.ct-dot { position: relative; z-index: 1; width: 42px; height: 42px; box-sizing: border-box; border-radius: 50%; border: 3px solid #C9D0D8; background: #fff; color: #7A8591;
  font-size: 1rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ct-step.is-done .ct-dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.ct-step.is-cur .ct-dot { background: var(--navy); border-color: var(--gold); color: #fff; box-shadow: 0 0 0 4px #FFF1C2; }
.ct-step-label { margin-top: 6px; font-size: .8125rem; color: #7A8591; }
.ct-step.is-done .ct-step-label { color: var(--blue); }
.ct-step.is-cur .ct-step-label { color: var(--navy); font-weight: 700; }
.ct-stop { align-self: center; min-height: 40px; display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 20px; font-size: .8125rem;
  border: 1px solid #8A1F1B; color: #8A1F1B; background: #fff; }
.ct-stop.is-on { background: #8A1F1B; color: #fff; }
.ct-status { margin: 12px 0 4px; }
.ct-actions { margin-top: 10px; align-items: flex-start; }
.ct-terminate summary { list-style: none; cursor: pointer; }
.ct-terminate summary::-webkit-details-marker { display: none; }
.ct-terminate-form { margin-top: 10px; padding: 12px; border: 2px solid #8A1F1B; border-radius: 8px; background: #FFF5F4; max-width: 420px; }
.btn-danger-outline { border: 1px solid #8A1F1B; color: #8A1F1B; background: #fff; }
.chip.is-disabled { opacity: .5; cursor: not-allowed; }
.input.is-ro { background: #F3EFE5; }
.ct-form .card { margin-bottom: 14px; }
.ct-form .chip-field { margin-top: 14px; }
.ct-surcharge { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; }
.ct-sc-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 6px 0; border-bottom: 1px solid #EFEAE0; }
.ct-sc-row .check-row { min-width: 90px; font-weight: 500; }
.ct-rate { margin: 0; display: flex; align-items: center; gap: 8px; }
.ct-rate .input { width: 80px; }
.ct-calc { margin-top: 16px; }
.ct-calc ul { margin: 0; padding-left: 1.2em; }
.ct-calc li { margin: 2px 0; }
/* 房屋租賃兩個大字金額：紅色、粗體、兩倍大；下面小字是組成明細 */
.ct-calc li.ct-big { list-style: none; margin: 12px 0 12px -1.2em; padding: 10px 12px; border-left: 4px solid #B42318; background: #FFF5F4; border-radius: 6px; }
.ct-big-line { display: block; color: #B42318; font-weight: 800; font-size: 2em; line-height: 1.25; }
.ct-big-amt { display: inline-block; white-space: nowrap; }
.ct-big-detail { display: block; margin-top: 4px; font-size: .8125rem; color: #5A6470; line-height: 1.6; overflow-wrap: anywhere; }
.ct-deposit { margin: 0; }
.ct-deposit > .field { margin: 0; }
.ct-deposit [data-deposit-reset] { margin-top: 6px; align-self: flex-start; }
.ct-late { margin-top: 14px; }
/* 顧問服務步驟條 5 步（沒有待點交） */
.ct-steps.ct-steps-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ct-save { position: sticky; bottom: 0; z-index: 20; box-shadow: 0 -4px 12px rgba(19, 40, 63, .08); }
.ct-h2 { margin-top: 20px; }
.ct-clauses { margin: 8px 0 14px; padding-left: 1.4em; }
.ct-clauses li { padding: 8px 0; border-bottom: 1px solid #EFEAE0; }
.ct-clauses li.is-latest { font-weight: 500; }
.ct-clause-body { white-space: pre-line; overflow-wrap: anywhere; }
.ct-clause-form textarea { width: 100%; }
.ct-chain { list-style: none; margin: 8px 0 14px; padding: 0; }
.ct-chain li { padding: 10px 12px; border-left: 4px solid #E8B100; margin-bottom: 8px; background: #FFFDF5; overflow-wrap: anywhere; }
.ct-chain li.is-cur { border-left-color: var(--blue); background: #F5F9FC; }
.cust-ct-filter { margin: 12px 0 8px; }
.cust-ct-list { list-style: none; margin: 8px 0; padding: 0; }
.cust-ct-list a { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
  color: var(--ink); text-decoration: none; }
.cust-ct-list li.is-on a { border: 2px solid var(--blue); background: #F5F9FC; }
.cust-ct-title { font-weight: 700; flex: 1 1 180px; }
.cust-ct-detail { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.cust-ct-new { margin-top: 12px; }
@media (max-width: 599.98px) {
  .ct-list .list-row { grid-template-columns: 1fr auto; }
  /* 手機：步驟條繞回兩排（1 2 3 → 6 5 4） */
  .ct-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 24px; flex-basis: 100%; }
  .ct-step:nth-child(4) { order: 6; }
  .ct-step:nth-child(5) { order: 5; }
  .ct-step:nth-child(6) { order: 4; }
  .ct-step:nth-child(6)::before { display: none; }
  /* 5 步：1 2 3 → _ 5 4 */
  .ct-steps.ct-steps-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-steps-5 .ct-step:nth-child(4) { grid-row: 2; grid-column: 3; }
  .ct-steps-5 .ct-step:nth-child(5) { grid-row: 2; grid-column: 2; }
  .ct-steps-5 .ct-step:nth-child(5)::before { display: none; }
  .ct-step:nth-child(4)::before, .ct-step:nth-child(5)::before { background: #C9D0D8; }
  .ct-step:nth-child(4):has(+ .is-done, + .is-cur)::before, .ct-step:nth-child(5):has(+ .is-done, + .is-cur)::before { background: var(--blue); }
  .ct-step:nth-child(4)::after { content: ""; position: absolute; left: calc(50% - 2px); top: -24px; width: 4px; height: 26px; background: #C9D0D8; }
  .ct-step:nth-child(4):is(.is-done, .is-cur)::after { background: var(--blue); }
  .ct-tabs .chip { padding: 6px 12px; }
  /* 手機畫面小：儲存列不固定在下方，免得擋住欄位 */
  .ct-save { position: static; box-shadow: none; }
}

/* ── 合約列印頁（借址範本 v1、暫代合約摘要） ── */
.pt { background: #ECE8DF; min-height: 100vh; padding: 16px 12px 40px; }
.pt-toolbar { max-width: 794px; margin: 0 auto 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pt-page { max-width: 794px; box-sizing: border-box; margin: 0 auto 16px; background: #fff; padding: 48px 56px; color: #000;
  font-family: "Noto Serif TC", "PMingLiU", serif; font-size: 15px; line-height: 2; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.pt-title { text-align: center; font-size: 22px; letter-spacing: 4px; margin: 0 0 16px; font-family: inherit; color: #000; }
.pt-temp { text-align: center; font-size: 13px; color: #555; margin-top: -10px; }
.pt-party { display: flex; flex-wrap: wrap; gap: 0 2em; margin: 0; }
.pt-party span:first-child { min-width: 22em; }
.pt-arts { list-style: none; margin: 0; padding: 0; }
.pt-arts li { display: grid; grid-template-columns: 6.5em 1fr; }
.pt-no { white-space: nowrap; }
.pt-fill { border-bottom: 1px solid #000; padding: 0 .3em; font-weight: 700; }
.pt-blank { display: inline-block; border-bottom: 1px solid #000; }
.pt-clause { margin: 8px 0; }
.pt-sign { margin-top: 18px; }
.pt-sign p { margin: 0; }
.pt-sign-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pt-date { margin-top: 24px; }
.pt-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.pt-table th, .pt-table td { border: 1px solid #555; padding: 6px 10px; text-align: left; vertical-align: top; line-height: 1.7; }
.pt-table th { width: 8em; background: #F6F4EF; font-weight: 600; }
.pt-lines { margin: 0; padding-left: 1.2em; }
.pt-seat h2 { font-family: inherit; color: #000; font-size: 16px; }
.pt-door { width: 220px; margin: 12px auto 0; border: 1px solid #000; text-align: center; padding: 6px 0; }
.pt-room { border: 1.5px solid #2F4E7A; padding: 48px 12%; display: grid; gap: 64px; }
.pt-seats { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pt-seats td { border: 1px solid #000; height: 56px; vertical-align: top; padding: 4px 6px; font-size: 14px; line-height: 1.3; }
.pt-seats td.pt-aisle { border-top: 0; border-bottom: 0; }
.pt-seats td.pt-mine { background: #FFF1C2; border: 3px solid #000; font-weight: 700; }
.pt-mine-tag { display: block; font-size: 12px; margin-top: 4px; }
@media (max-width: 599.98px) {
  .pt-page { padding: 24px 16px; font-size: 14px; }
  .pt-arts li { grid-template-columns: 1fr; }
  .pt-party span:first-child { min-width: 0; }
  .pt-room { padding: 24px 4%; gap: 32px; }
}
@media print {
  @page { size: A4; margin: 16mm 18mm; }
  .pt { background: #fff; padding: 0; min-height: 0; }
  .pt-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .pt-seat { break-before: page; }
  .pt-seats td.pt-mine { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── 公開網站選單的「登入」按鈕（階段 2 步驟 4） ── */
.site-nav a.site-nav-cta { background: var(--gold); color: var(--navy); font-weight: 700; border-radius: 6px; padding: 0 16px; margin-left: 6px; }
.site-nav a.site-nav-cta:hover { filter: brightness(1.05); }

/* ── 客戶登入與簡易客戶中心（設計 1-1c、1-1e） ── */
.cust-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.cust-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 5%; background: #fff; border-bottom: 1px solid var(--line); }
.cust-logo { height: 40px; width: auto; display: block; }
.cust-home { font-size: .875rem; min-height: 44px; display: inline-flex; align-items: center; }
.cust-main { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 40px; gap: 18px; }
.login-card.cust-card-wide { max-width: 760px; }
.cust-contact { background: #F3EFE5; border-radius: 6px; padding: 12px 14px; font-size: .875rem; overflow-wrap: anywhere; }
.cust-rules { margin: -10px 0 20px; padding-left: 20px; }
.consent-terms { border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; margin: 12px 0 18px; background: #FCFBF8; }
.consent-term h2 { font-size: 1rem; margin: 14px 0 4px; }
.consent-term h3 { font-size: 1rem; margin: 14px 0 4px; }
.consent-part { font-size: 1.0625rem; margin: 14px 0 0; color: var(--navy); }
.consent-term p { margin: 0 0 6px; font-size: .875rem; }
.consent-term p.consent-sub { padding-left: 1em; text-indent: -1em; margin-left: 1em; overflow-wrap: anywhere; }
.cust-consent-check { font-size: .9375rem; font-weight: 400; }
/* 同意書捲動框（負責人 2026-11-02）：固定高度約畫面三分之一，框內自己捲動、捲軸明顯；捲到底才能勾下面的項目 */
.consent-scroll { height: 33vh; min-height: 180px; max-height: 560px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; touch-action: pan-y; border: 2px solid #B9B09D; border-radius: 8px; padding: 4px 14px 10px; margin: 12px 0 6px;
  background: #FCFBF8; scrollbar-width: auto; scrollbar-color: #7A7262 #ECE6D8; overflow-wrap: anywhere; }
.consent-scroll::-webkit-scrollbar { width: 12px; }
.consent-scroll::-webkit-scrollbar-track { background: #ECE6D8; border-radius: 6px; }
.consent-scroll::-webkit-scrollbar-thumb { background: #7A7262; border-radius: 6px; border: 2px solid #ECE6D8; }
.consent-scroll:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.consent-scroll.is-read { border-color: #2E7D4F; }
.consent-scroll-hint { font-size: .8125rem; font-weight: 700; color: #8A5A00; margin: 0 0 12px; }
.consent-scroll-hint.is-read { color: #2E7D4F; }
.cust-consent-check:has(input:disabled) { opacity: .55; cursor: not-allowed; }
html.large .consent-scroll { min-height: 220px; }
/* 用戶管理：排序（可多欄，小數字＝優先順序）、「不顯示已移除」 */
.sort-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.sort-chip { position: relative; }
.sort-n { display: inline-block; min-width: 1.3em; margin-left: 3px; padding: 0 3px; border-radius: 8px; background: var(--gold); color: var(--navy);
  font-size: .6875rem; line-height: 1.3em; text-align: center; vertical-align: super; font-weight: 700; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: .875rem; cursor: pointer; white-space: nowrap; }
.check-inline input { width: 20px; height: 20px; }
.cust-consent-check input { width: 24px; height: 24px; }
.consent-req { color: #8A1F1B; }
.consent-opt { color: var(--muted); font-weight: 500; }
.consent-no { margin-top: 12px; }
/* 個資同意書管理（後台） */
.consent-items { padding-left: 1.2em; font-size: .9375rem; }
.consent-full summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 6px 0; }
.consent-body-input { min-height: 320px; font-size: .9375rem; line-height: 1.6; }
.consent-item-rows { border: 0; padding: 0; margin: 0; min-width: 0; }
.consent-item-row { display: grid; grid-template-columns: 4.5em minmax(0, 1fr) 7em; gap: 8px; align-items: start; margin: 8px 0; }
.consent-item-row .field-label { margin: 10px 0 0; }
@media (max-width: 640px) { .consent-item-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } .consent-item-row .field-label { margin: 0; } }
.consent-versions { padding-left: 1.2em; }
.consent-preview { min-height: 100vh; background: #E9E4D8; padding: 0 0 32px; }
.consent-preview-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; background: #13283F; color: #fff; padding: 10px 16px; }
.consent-preview-pc { max-width: 760px; margin: 24px auto 0; padding: 0 16px; }
.consent-preview-phone { width: 390px; max-width: 100%; margin: 24px auto 0; border: 10px solid #13283F; border-radius: 28px; background: #fff; overflow: hidden; }
.consent-preview-phone .login-card { border: 0; box-shadow: none; padding: 16px; max-width: none; }
.cust-soon, .cust-sec { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 16px 0; }
.cust-soon h2, .cust-sec h2 { font-size: 1.0625rem; margin: 0 0 6px; }
.cust-soon ul, .cust-sec ul { margin: 6px 0 0; padding-left: 20px; }
.cust-soon p, .cust-sec p { margin: 0; font-size: .875rem; color: var(--muted); }
@media (min-width: 600px) { .cust-logo { height: 46px; } .cust-top { padding: 18px 8%; } }

/* ── 預設密碼一次性醒目框（客戶頁、合約頁、用戶管理） ── */
.oncepw { border: 3px solid var(--gold); background: #FFF9E3; border-radius: 10px; padding: 16px 18px; margin: 0 0 18px; }
.oncepw-title { font-weight: 700; font-size: 1.0625rem; color: var(--navy); margin-bottom: 8px; }
.oncepw-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.oncepw-pw { font-family: ui-monospace, Consolas, monospace; font-size: 1.75rem; font-weight: 700; letter-spacing: 3px; color: var(--navy); overflow-wrap: anywhere; }
.oncepw-note { font-size: .875rem; color: #5C3D00; margin-top: 10px; }
.oncepw .btn-row { margin-top: 10px; align-items: center; }
.oncepw-hint { font-size: .8125rem; color: #5C3D00; }

/* ── 客戶中心（設計 2-3、1-1f；階段 2 步驟 5） ── */
.hub-page { min-height: 100vh; background: var(--paper); }
.hub-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 5%; background: #fff; border-bottom: 1px solid var(--line); }
.hub-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 700; }
.hub-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-tools form { margin: 0; }
.hub-who { font-weight: 500; color: var(--navy); overflow-wrap: anywhere; }
.hub-tabs { position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 5%; background: var(--navy); }
.hub-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; color: var(--paper); text-decoration: none; font-weight: 500; }
.hub-tabs a.is-on { background: var(--gold); color: var(--navy); font-weight: 700; }
.hub-main { max-width: 960px; margin: 0 auto; padding: 20px 5% 48px; }
.hub-h1 { font-size: 1.625rem; margin: 6px 0 6px; }
.hub-h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.hub-lead { color: var(--muted); margin: 0 0 18px; font-size: .9375rem; }
.hub-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hub-stat { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 10px; padding: 14px 16px; }
.hub-stat-k, .hub-stat-n { font-size: .875rem; color: var(--muted); }
.hub-stat-v { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.hub-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 0 0 16px; }
.hub-card h2 { font-size: 1.125rem; margin: 0 0 10px; }
.hub-list { padding: 0; }
.hub-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #EFEAE0; }
.hub-row:last-child { border-bottom: 0; }
.hub-row-main { flex: 1 1 220px; min-width: 0; }
.hub-row-title { font-weight: 500; }
.hub-empty { padding: 12px 16px; margin: 0; }
.hub-ct-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hub-ct-head h2 { margin: 0; }
.hub-ct-lines { margin: 10px 0 0; padding-left: 20px; }
.hub-ct-lines li { margin-bottom: 4px; overflow-wrap: anywhere; }
.hub-renew { margin-top: 14px; border: 2px solid var(--gold); background: #FFF9E3; border-radius: 8px; padding: 14px 16px; }
.hub-renew-title { font-weight: 700; color: var(--navy); font-size: 1.0625rem; }
.hub-renew p { margin: 6px 0; }
.hub-renew-hint { font-weight: 700; color: #8A1F1B; }
.hub-renew .btn { min-height: 48px; }
.hub-renew form { margin: 0; }
.hub-renew-note { color: var(--blue); font-weight: 500; }
.hub-past { margin-top: 10px; }
.hub-past summary { cursor: pointer; font-weight: 700; color: var(--navy); min-height: 44px; display: flex; align-items: center; }
.hub-form { max-width: 520px; }
.hub-form .field { display: block; margin-bottom: 12px; }
.hub-form .input { width: 100%; }
.hub-dl { margin-top: 16px; }
.hub-change { margin-top: 10px; }
.hub-change > summary { list-style: none; display: inline-flex; margin-bottom: 10px; }
.hub-change > summary::-webkit-details-marker { display: none; }
.hub-devices { list-style: none; padding: 0; margin: 0 0 12px; }
.hub-devices li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #EFEAE0; }
.hub-state { font-weight: 700; color: var(--navy); }
.hub-state.is-on { color: var(--blue); }
.hub-steps { padding-left: 22px; }
.hub-steps li { margin-bottom: 12px; }
.hub-steps .otp-input { max-width: 240px; margin-top: 8px; }
.hub-contact { margin-top: 26px; }
.hub-contact p { margin: 4px 0 10px; }
@media (max-width: 599px) {
  .hub-tabs a { padding: 0 12px; }
  .hub-who { display: none; }
}

/* 後台：客戶續約通知、資料變更申請 */
.ct-renew-notice { margin-top: 10px; }
.cust-req-list { list-style: none; padding: 0; margin: 0 0 12px; }
.cust-req-list li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; overflow-wrap: anywhere; }
.cust-req-list li.is-pending { border-color: var(--gold); background: #FFF9E3; }
.cust-req-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
.cust-req-actions form { margin: 0; }
.cust-req-reject { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 260px; }
.cust-req-reject .field-label { width: 100%; }
.cust-req-reject .input { flex: 1 1 180px; min-width: 0; }
