/* ============ 租約通 設計系統 ============ */
:root {
  --paper: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1f2a37;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e1d8;
  --line-2: #d6d0c4;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e4eee9;
  --warm: #c26a4a;
  --warm-soft: #f8e9e2;
  --ok: #2f7a4f;       --ok-soft: #e3f2e8;
  --warn: #a15c07;     --warn-soft: #fdf1dc;
  --danger: #b4382f;   --danger-soft: #fbe6e3;
  --info: #2c5d8f;     --info-soft: #e3edf7;
  --idle: #6b7280;     --idle-soft: #eeede9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 42, 55, .05), 0 4px 16px rgba(31, 42, 55, .06);
  --shadow-lg: 0 10px 40px rgba(31, 42, 55, .14);
  --sidebar: 244px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.65 var(--font); letter-spacing: .01em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: .02em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .86em; word-break: break-all; }

/* ---------- 版面 ---------- */
/* minmax(0, 1fr)：避免寬表格把整個內容欄撐開，讓表格自己在 .table-wrap 內橫向捲動 */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: #22322d; color: #dfe7e3; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; padding: 4px 10px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #7fb59e, #2f5d50);
  display: grid; place-items: center; font-size: 17px; color: #fff;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: #cfdad5; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav .ico { width: 20px; text-align: center; opacity: .9; }
.sidebar .spacer { flex: 1; }
.sidebar .who { font-size: .82rem; color: #9fb3ab; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .who button { background: none; border: 0; color: #cfdad5; padding: 0; cursor: pointer; font: inherit; }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.container { max-width: 1180px; margin: 0 auto; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 0; color: var(--muted); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    background: rgba(246,244,239,.92); backdrop-filter: blur(8px); padding: 10px 16px; border-bottom: 1px solid var(--line);
  }
  .topbar .brand { color: var(--ink); padding: 0; font-size: 1.05rem; }
  .main { padding: 18px 16px 60px; }
}

/* ---------- 元件 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font: 600 .92rem var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #c7c0b2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #264d42; border-color: #264d42; }
.btn-warm { background: var(--warm); border-color: var(--warm); color: #fff; }
.btn-warm:hover { background: #a9573a; border-color: #a9573a; }
.btn-danger { color: var(--danger); border-color: #e9c3be; }
.btn-line { background: #06c755; border-color: #06c755; color: #fff; }  /* LINE 品牌綠 */
.btn-line:hover { background: #05a847; border-color: #05a847; text-decoration: none; }
.share-once { border: 2px solid #06c755; }

/* 新手進度清單 */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.checklist li.done { color: var(--muted); }
.checklist li.done .t { text-decoration: line-through; }
.checklist .mark { width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px; display: grid; place-items: center; border: 2px solid var(--line-2); }
.checklist li.done .mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.checklist .t { flex: 1; }
.checklist .opt { font-size: .76rem; color: var(--muted); margin-left: 6px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* 使用說明 */
.guide-item summary { cursor: pointer; list-style: none; }
.guide-item summary::-webkit-details-marker { display: none; }
.guide-item summary h3 { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.guide-item summary::after { content: "＋"; float: right; color: var(--muted); }
.guide-item[open] summary::after { content: "－"; }
.guide-item[open] summary { margin-bottom: 10px; }
.guide-item li { margin-bottom: 6px; }
.faq dt { font-weight: 700; margin-top: 10px; }
.faq dd { margin: 4px 0 0; color: var(--ink-2); }
.timeline-steps { padding-left: 20px; }
.timeline-steps li { margin-bottom: 12px; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(0,0,0,.04); }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.inline { display: inline; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--idle-soft); color: var(--idle);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-rented, .b-active, .b-signed, .b-paid { background: var(--ok-soft); color: var(--ok); }
.b-expiring, .b-unpaid, .b-sent, .b-pending { background: var(--warn-soft); color: var(--warn); }
.b-vacant { background: var(--warm-soft); color: var(--warm); }
.b-reserved, .b-upcoming, .b-draft, .b-held, .b-converted { background: var(--info-soft); color: var(--info); }
.b-agreed, .b-reported { background: var(--warn-soft); color: var(--warn); }
.b-forfeited, .b-refunded, .b-refunded_double { background: var(--idle-soft); color: var(--idle); }
.b-expired, .b-cancelled, .b-terminated { background: var(--idle-soft); color: var(--idle); }

.flash-wrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.flash {
  padding: 12px 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--ok); font-weight: 500; animation: slide .25s ease;
}
.flash.error { border-left-color: var(--danger); }
@keyframes slide { from { transform: translateY(-8px); opacity: 0; } }

/* 表單 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fields .span-2 { grid-column: span 2; }
.fields .span-all { grid-column: 1 / -1; }
@media (max-width: 520px) { .fields .span-2 { grid-column: 1 / -1; } }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: 1rem var(--font); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,93,80,.15); }
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.input-unit { position: relative; }
.input-unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.input-unit input { padding-right: 46px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.segmented { display: inline-flex; background: var(--idle-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented label { padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.segmented input { display: none; }
.segmented label:has(input:checked) { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
fieldset { border: 0; padding: 0; margin: 0; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .82rem; font-weight: 700; }
.fee-row { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.fee-row:last-child { border-bottom: 0; }
@media (max-width: 560px) { .fee-row { grid-template-columns: 1fr 1fr; } .fee-row > :first-child { grid-column: 1 / -1; } }
.sticky-actions {
  position: sticky; bottom: 0; background: rgba(246,244,239,.94); backdrop-filter: blur(6px);
  padding: 14px 0; margin-top: 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; z-index: 5;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.eq-table td { padding: 6px 4px; border: 0; }
.row-actions { text-align: right; white-space: nowrap; }
.row-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.btn-del:hover { color: var(--danger); background: var(--danger-soft); }
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--danger-soft); color: #7a241e; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
}
.bulk-bar[hidden] { display: none; }
.eq-table input { padding: 8px 10px; }

/* 統計 */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .9rem; font-weight: 500; }
.stat.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.stat.accent .k { color: #cfe3da; }

/* 房間卡片 */
.room-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; color: inherit; display: block;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.room-card .thumb { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #dfe8e3, #efe6dc); position: relative; overflow: hidden; }
.room-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.room-card:hover .thumb img { transform: scale(1.06); }
.room-card .thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #8a9a92; font-size: .9rem; text-align: center; }
.room-card .photo-chip {
  position: absolute; left: 10px; bottom: 10px; background: rgba(20,28,25,.72); color: #fff; font-size: .74rem;
  padding: 3px 9px; border-radius: 999px; font-weight: 600; backdrop-filter: blur(4px);
}
.room-card .status { position: absolute; right: 10px; top: 10px; }
.room-card .status .badge { box-shadow: 0 1px 4px rgba(0,0,0,.12); background: #fff; }
.room-card .body { padding: 14px 16px 16px; }
.room-card .title { font-weight: 700; font-size: 1.05rem; }
.room-card .meta { color: var(--muted); font-size: .86rem; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.room-card .price { font-weight: 700; color: var(--accent); }
.add-card {
  display: grid; place-items: center; min-height: 240px; border: 2px dashed var(--line-2); border-radius: var(--radius);
  background: transparent; color: var(--muted); text-align: center; padding: 20px;
}

.prop-block { margin-bottom: 30px; }
.prop-block .prop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.prop-block .prop-head h2 { margin: 0; }

/* 租客看房頁：照片牆（第一張大圖，其餘最多四張小圖） */
.gallery {
  display: grid; gap: 8px; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr));
  height: min(58vh, 480px); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.gallery.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.gallery.n2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.gallery.n2 figure.lead { grid-row: auto; }
.gallery.n3 { grid-template-columns: 2fr 1fr; }
.gallery.n4 figure:last-child { grid-column: span 2; }
.gallery figure { margin: 0; position: relative; overflow: hidden; background: #e6ece9; cursor: zoom-in; }
.gallery figure.lead { grid-row: span 2; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery figure:hover img { transform: scale(1.03); }
.gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; color: #fff; font-size: .8rem;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); pointer-events: none; }
.gallery .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff;
  font-size: 1.4rem; font-weight: 700; pointer-events: none; }
@media (max-width: 700px) {
  .gallery { grid-template-columns: repeat(2, 1fr); grid-template-rows: 240px; grid-auto-rows: 110px; height: auto; }
  .gallery figure.lead { grid-column: span 2; grid-row: auto; }
  .gallery.n1 { grid-template-columns: 1fr; }
  .gallery.n1 figure.lead { grid-column: auto; }
  .gallery.n2, .gallery.n3 { grid-template-columns: repeat(2, 1fr); grid-template-rows: 240px; }
  .gallery.n3 figure.lead { grid-row: auto; }
  .gallery.n2 figure:last-child, .gallery.n4 figure:last-child { grid-column: span 2; }
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; padding: 10px 14px; font: 600 .92rem var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }

.photo-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.photo-grid figure { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-grid img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; cursor: zoom-in; }
.photo-grid figcaption { padding: 8px; font-size: .82rem; }
.photo-grid figcaption input { padding: 6px 8px; font-size: .82rem; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline .t { color: var(--muted); font-size: .8rem; }

.steps { display: flex; gap: 0; margin-bottom: 20px; counter-reset: s; flex-wrap: wrap; }
.steps li { list-style: none; flex: 1; min-width: 110px; position: relative; padding-top: 34px; text-align: center; font-size: .82rem; color: var(--muted); font-weight: 600; }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: var(--idle-soft); display: grid; place-items: center; z-index: 1;
}
.steps li::after { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--accent); }
.steps li.done::before { background: var(--accent); color: #fff; content: "✓"; }
.steps li.done::after { background: var(--accent); }
.steps li.now { color: var(--ink); }
.steps li.now::before { background: var(--warm); color: #fff; }

.callout { padding: 14px 16px; border-radius: 12px; background: var(--info-soft); color: #1d3f63; font-size: .9rem; }
.callout.warn { background: var(--warn-soft); color: #6d3f05; }
.callout.ok { background: var(--ok-soft); color: #1d5234; }
.callout.danger { background: var(--danger-soft); color: #7a241e; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }

dialog { border: 0; border-radius: 18px; padding: 0; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 28, 25, .45); backdrop-filter: blur(2px); }
dialog .d-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
dialog .d-body { padding: 16px 22px 22px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: none; place-items: center; z-index: 200; padding: 20px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 90vh; border-radius: 8px; }

/* ---------- 簽名板 ---------- */
.sigpad { position: relative; background: #fff; border: 2px dashed var(--line-2); border-radius: 14px; touch-action: none; user-select: none; }
.sigpad canvas { display: block; width: 100%; height: 220px; border-radius: 12px; cursor: crosshair; }
.sigpad .guide { position: absolute; left: 24px; right: 24px; bottom: 46px; border-bottom: 1px solid #cfc8b9; pointer-events: none; }
.sigpad .guide::before { content: "✕"; position: absolute; left: -2px; bottom: 2px; color: #b8b0a0; font-size: .9rem; }
.sigpad .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #b8b0a0; pointer-events: none; font-size: 1.05rem; }
.sigpad.signed .ph { display: none; }
.sigpad.fullscreen { position: fixed; inset: 0; z-index: 300; border-radius: 0; border: 0; display: flex; flex-direction: column; }
.sigpad.fullscreen canvas { flex: 1; height: auto; border-radius: 0; }
.sigpad .fs-bar { display: none; }
.sigpad.fullscreen .fs-bar { display: flex; gap: 10px; padding: 12px; justify-content: flex-end; background: var(--surface-2); border-top: 1px solid var(--line); }

/* ---------- 契約文件（房客審閱頁） ---------- */
.doc { background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 5vw, 44px); box-shadow: var(--shadow); font-family: var(--serif); }
.doc h1 { text-align: center; font-size: 1.6rem; letter-spacing: .2em; margin-bottom: 4px; }
.doc .doc-meta { text-align: center; color: var(--muted); font-size: .82rem; font-family: var(--font); margin-bottom: 26px; }
.doc h3 { font-family: var(--font); color: var(--accent); margin: 24px 0 8px; font-size: 1rem; }
.doc p { line-height: 1.95; font-size: .98rem; text-align: justify; margin: 0 0 .5em; }
.doc table { width: 100%; border-collapse: collapse; font-size: .9rem; font-family: var(--font); margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--line-2); padding: 8px 10px; text-align: left; }
.doc th { background: #f3efe6; }

/* ---------- 公開頁（登入、簽署） ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-top { padding: 16px clamp(16px, 4vw, 40px); display: flex; align-items: center; justify-content: space-between; }
.public-top .brand { color: var(--ink); padding: 0; }
.public-main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 10px 16px 60px; }
.auth-wrap { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-art {
  background: linear-gradient(160deg, rgba(34,50,45,.92), rgba(47,93,80,.78)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M0 40h80M40 0v80' stroke='%23ffffff' stroke-opacity='.05'/%3E%3C/svg%3E");
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.35; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.auth-art li { display: flex; gap: 12px; align-items: flex-start; color: #d7e5df; }
.auth-art li b { color: #fff; display: block; }
.auth-art .ico { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex: 0 0 auto; }
.auth-form { display: grid; place-items: center; padding: 40px 20px; }
.auth-form .card { width: min(420px, 100%); padding: 32px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

.sign-hero { text-align: center; padding: 20px 0 10px; }
.sign-hero .big { font-size: 2.8rem; }
.pin-input { font-size: 1.8rem !important; letter-spacing: .6em; text-align: center; font-variant-numeric: tabular-nums; padding: 14px !important; }
.sign-bar {
  position: sticky; bottom: 0; z-index: 10; background: rgba(255,253,248,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); margin: 0 -16px;
}

.hide-mobile { }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }
.only-mobile { display: none; }
@media (max-width: 640px) { .only-mobile { display: initial; } }

@media print {
  .sidebar, .topbar, .sign-bar, .btn, .flash-wrap { display: none !important; }
  .shell { display: block; }
}

/* 房間頁狀態卡 */
.room-hero { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.room-hero-status { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.room-hero-status .label { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.room-hero-actions { display: flex; flex-direction: column; gap: 8px; }
.room-hero-actions .btn { width: 100%; }
@media (max-width: 760px) { .room-hero { grid-template-columns: 1fr; } }
