/* 先帆房源库 · Components v2
   按钮、表单、勾选、页签、状态胶囊、标签、提示、菜单、弹窗基础。只引用 tokens.css。 */

/* ============================================================
   按钮：5 种意图 × 3 种高度
   .btn（次按钮）· .btn-primary · .btn-tonal · .btn-ghost · .btn-danger
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--h-md); padding: 0 var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink);
  font-size: var(--text-md); font-weight: var(--weight-medium); line-height: 1;
  white-space: nowrap; text-decoration: none; user-select: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-sunken); text-decoration: none; }
.btn:active { background: var(--line); }
.btn-sm { height: var(--h-sm); padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { height: var(--h-lg); padding: 0 var(--space-5); }
.btn-icon { width: var(--h-md); padding: 0; }
.btn-icon.btn-sm { width: var(--h-sm); }
.btn-icon.btn-lg { width: var(--h-lg); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { border-color: var(--brand-hover); background: var(--brand-hover); }
.btn-primary:active { border-color: var(--brand-active); background: var(--brand-active); }

.btn-tonal { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }
.btn-tonal:hover { background: var(--brand-soft-hover); }
.btn-tonal:active { background: var(--brand-soft-active); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-ghost:active { background: var(--line); }

.btn-danger { border-color: var(--danger-line); background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid, .btn-confirm-danger { border-color: var(--danger); background: var(--danger); color: var(--on-solid); }
.btn-danger-solid:hover, .btn-confirm-danger:hover { border-color: var(--danger-hover); background: var(--danger-hover); }

.btn:disabled, .btn[aria-disabled="true"] {
  border-color: var(--line); background: var(--surface-sunken); color: var(--ink-disabled); cursor: not-allowed;
}
.btn.is-busy { position: relative; pointer-events: none; opacity: 0.8; }
.btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 关闭图标按钮（弹窗、抽屉） */
.icon-close {
  display: inline-grid; place-items: center; width: var(--h-md); height: var(--h-md); padding: 0;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-3);
}
.icon-close:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   表单
   ============================================================ */
input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="hidden"])),
select, textarea {
  width: 100%; height: var(--h-md); padding: 0 var(--space-3);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font-size: var(--text-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
textarea { height: auto; padding: var(--space-2) var(--space-3); line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-placeholder); }
input:where(:not([type="checkbox"], [type="radio"], [type="file"])):hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:where(:not([type="checkbox"], [type="radio"], [type="file"])):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-accent); box-shadow: var(--focus-ring);
}
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-sunken); color: var(--ink-3); }
select {
  appearance: none; padding-right: 32px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235e6a7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat;
}
input[type="search"] { appearance: none; }
input[type="search"]::-webkit-search-cancel-button { appearance: none; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.field { display: grid; gap: var(--space-1); align-content: start; min-width: 0; }
.field > label, .field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-2); }
.field > label b, legend b { color: var(--danger); font-weight: var(--weight-medium); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.form-grid .full { grid-column: 1 / -1; }
.field-error { color: var(--danger-ink); font-size: var(--text-sm); }
.inline-error {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--danger-line); border-radius: var(--radius-md);
  background: var(--danger-bg); color: var(--danger-ink);
}

/* 勾选框 / 单选框 */
input[type="checkbox"], input[type="radio"] {
  appearance: none; flex: none; width: 18px; height: 18px; margin: 0;
  border: 1.5px solid var(--line-strong); background: var(--surface); display: inline-grid; place-items: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--ink-3); }
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { border-color: var(--brand); background: var(--brand); }
input[type="checkbox"]:checked::after {
  content: ""; width: 9px; height: 5px; border: 2px solid var(--on-solid); border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
input[type="checkbox"]:indeterminate::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--surface); }
input[type="radio"]:checked { border-color: var(--brand); background: var(--surface); }
input[type="radio"]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

.check-row {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--h-sm);
  font-size: var(--text-md); color: var(--ink); cursor: pointer;
}
.check-label { flex: 1; min-width: 0; }
.check-count { color: var(--ink-3); font-size: var(--text-xs); }

/* 选项卡片（单选 / 多选大选项） */
.choice-list, .restore-options { display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.choice-list > legend, .restore-options > legend { margin-bottom: var(--space-2); padding: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-2); }
.choice-list.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-list.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-card, .restore-choice {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.choice-card:hover, .restore-choice:hover { border-color: var(--ink-3); }
.choice-card:has(input:checked), .restore-choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice-card input, .restore-choice input { margin-top: 2px; }
.choice-card span, .restore-choice span { display: grid; gap: 2px; min-width: 0; }
.choice-card b, .restore-choice b { font-weight: var(--weight-medium); }
.choice-card small, .restore-choice small { color: var(--ink-3); font-size: var(--text-xs); }

/* ============================================================
   页签 / 分段控件
   ============================================================ */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.seg button {
  height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
.seg button:hover { color: var(--ink); }
.seg button.active, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 28, 46, 0.12); }

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); }
.tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--space-3);
  border: 0; background: transparent; color: var(--ink-2); font-size: var(--text-md); font-weight: var(--weight-medium); white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button > span { color: var(--ink-3); font-size: var(--text-sm); font-weight: var(--weight-regular); }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { content: ""; position: absolute; right: var(--space-3); bottom: -1px; left: var(--space-3); height: 2px; border-radius: 2px; background: var(--ink); }
/* 状态页签带状态色圆点，颜色与状态胶囊一致 */
.tabs button[data-status]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-disabled); }
.tabs button[data-status=""]::before { display: none; }
.tabs button[data-status="on"]::before { background: var(--available); }
.tabs button[data-status="rented"]::before { background: var(--rented); }
.tabs button[data-status="off"]::before { background: var(--off); }
.tabs button[data-status="trash"]::before { background: transparent; border: 1.5px dashed var(--ink-3); }

/* ============================================================
   状态胶囊：房源「是什么状态」。实心 = 已成立；空心 = 即将发生
   ============================================================ */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.dot.on { background: var(--available); }
.dot.rented { background: var(--rented); }
.dot.off { background: var(--off); }
.dot.vacating, .dot.signed { background: transparent; border: 1.5px solid currentColor; width: 8px; height: 8px; }
.dot.trash { background: transparent; border: 1.5px solid var(--ink-3); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px;
  border: 1px solid var(--off-line); border-radius: var(--radius-full);
  background: var(--off-bg); color: var(--off-ink);
  font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; }
.pill.on { border-color: var(--available-line); background: var(--available-bg); color: var(--available-ink); }
.pill.rented { border-color: var(--rented-line); background: var(--rented-bg); color: var(--rented-ink); }
.pill.off { border-color: var(--off-line); background: var(--off-bg); color: var(--off-ink); }
.pill.vacating { border-color: var(--available); background: var(--surface); color: var(--available-ink); }
.pill.signed { border-color: var(--rented); background: var(--surface); color: var(--rented-ink); }
.pill.trash { border: 1px dashed var(--line-strong); background: transparent; color: var(--off-ink); }

/* ============================================================
   标签：补充信息与「要不要处理」
   ============================================================ */
.tag, .meta-tag, .lease-days, .filter-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-sunken); color: var(--ink-2);
  font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1; white-space: nowrap;
}
.tag-warn, .vacating-tag { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.tag-danger { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-ink); }
.tag-danger-solid { border-color: var(--danger); background: var(--danger); color: var(--on-solid); }
.tag-rented { border-color: var(--rented-line); background: var(--rented-bg); color: var(--rented-ink); }

/* 到期紧急度：琥珀 → 红，逐级升温 */
.lease-days.is-ok { background: var(--surface-sunken); color: var(--ink-2); }
.lease-days.is-soon { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.lease-days.is-urgent { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-ink); }
.lease-days.is-overdue { border-color: var(--danger); background: var(--danger); color: var(--on-solid); }
.lease-due-date, .lease-missing { font-size: var(--text-xs); color: var(--ink-3); }
.lease-missing { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--warn-line); border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-ink); font-weight: var(--weight-medium); }

.count-badge, .nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full); background: var(--danger); color: var(--on-solid);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 1;
}

/* ============================================================
   提示：进度条、Toast、空状态
   ============================================================ */
.request-bar { position: fixed; z-index: var(--z-toast); top: 0; left: 0; width: 0; height: 3px; background: var(--brand-accent); pointer-events: none; }
.request-bar.loading { animation: load-progress 7s cubic-bezier(0.12, 0.75, 0.25, 1) forwards; }
.request-bar.complete { width: 100%; opacity: 0; transition: width 160ms ease-out, opacity 160ms 180ms; }
@keyframes load-progress { to { width: 92%; } }

.toast {
  position: fixed; z-index: var(--z-toast); bottom: var(--space-6); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px); padding: 10px var(--space-4);
  border-radius: var(--radius-md); background: var(--ink); color: var(--on-solid); box-shadow: var(--shadow-pop);
  font-size: var(--text-md); opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease);
}
.toast.show { opacity: 1; }

.empty { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-12) var(--space-4); color: var(--ink-3); text-align: center; }
.empty strong { color: var(--ink); font-size: var(--text-lg); font-weight: var(--weight-semibold); }

/* ============================================================
   弹出菜单（行内「⋯」与顶部「更多」共用）
   ============================================================ */
.menu-panel {
  display: grid; gap: 2px; min-width: 148px; padding: var(--space-1);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-pop);
}
.menu-item {
  display: flex; align-items: center; width: 100%; min-height: var(--h-md); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font-size: var(--text-md); text-align: left; text-decoration: none; white-space: nowrap;
}
.menu-item:hover { background: var(--surface-sunken); text-decoration: none; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-bg); }

/* ============================================================
   弹窗基础：dialog / .modal / .modal-actions
   ============================================================ */
dialog {
  padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-dialog); max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: var(--scrim); }
.modal-dialog, .confirm-dialog { width: min(520px, calc(100vw - 32px)); }
.modal { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); min-height: 0; }
.modal-scroll { display: grid; gap: var(--space-4); align-content: start; padding: var(--space-6); overflow-y: auto; min-height: 0; }
.modal h2 { font-size: var(--text-lg); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--line); }
.confirm-dialog .modal { gap: var(--space-2); padding: var(--space-6) var(--space-6) 0; }
.confirm-dialog .modal p { color: var(--ink-2); }
.confirm-dialog .modal-actions { margin: var(--space-6) calc(var(--space-6) * -1) 0; }

@media (max-width: 640px) {
  /* 手机上弹窗居中显示，避免贴底时被浏览器底部工具栏遮住 */
  .modal-dialog, .confirm-dialog { width: calc(100vw - 28px); max-width: calc(100vw - 28px); margin: auto; }
  .modal-scroll { padding: var(--space-4); }
  .modal-actions { padding: var(--space-3) var(--space-4); }
  .modal-actions .btn { flex: 1; height: var(--h-lg); }
  .confirm-dialog .modal { padding: var(--space-5) var(--space-4) 0; }
  .confirm-dialog .modal-actions { margin: var(--space-5) calc(var(--space-4) * -1) 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .choice-list.three-col { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================
   行内更多操作菜单 / 批量选择（台账、租期、地图共用）
   ============================================================ */
/* 行内更多操作 */
.row-more { position: relative; }
.row-more > summary {
  display: inline-grid; place-items: center; width: var(--h-sm); height: var(--h-sm); list-style: none;
  border-radius: var(--radius-sm); color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer; user-select: none;
}
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary:hover, .row-more[open] > summary { background: var(--surface-sunken); color: var(--ink); }
.row-more-menu {
  position: absolute; z-index: var(--z-menu); top: calc(100% + 4px); right: 0;
  display: grid; gap: 2px; min-width: 148px; padding: var(--space-1);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-pop);
}
.row-more.up .row-more-menu { top: auto; bottom: calc(100% + 4px); }
.row-menu-item {
  display: flex; align-items: center; width: 100%; min-height: var(--h-md); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font-size: var(--text-md); text-align: left; text-decoration: none; white-space: nowrap;
}
.row-menu-item:hover { background: var(--surface-sunken); text-decoration: none; }
.row-menu-item.is-danger { color: var(--danger); }
.row-menu-item.is-danger:hover { background: var(--danger-bg); }

/* 批量选择勾选框：表格里在房源名前，卡片里浮在图片左上角 */
.share-check { position: relative; display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; cursor: pointer; }
.share-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.share-check-mark { display: grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface); transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.share-check:hover .share-check-mark { border-color: var(--ink-3); }
.share-check input:checked + .share-check-mark { border-color: var(--brand); background: var(--brand); }
.share-check input:checked + .share-check-mark::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--on-solid); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.share-check input:focus-visible + .share-check-mark { box-shadow: var(--focus-ring); }


.share-selection-actions {
  display: flex; align-items: center; gap: var(--space-2); padding: 3px 4px 3px var(--space-3);
  border: 1px solid var(--brand-line); border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand); font-size: var(--text-sm);
}
.share-selection-actions b { font-weight: var(--weight-semibold); }

/* ============================================================
   媒体：照片按钮、视频（档案、地图预览共用）
   ============================================================ */
.photo-preview { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); aspect-ratio: 4 / 3; }
.photo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-base) var(--ease); }
.photo-preview:hover img { transform: scale(1.03); }
.photo-preview.is-broken img { display: none; }

/* 地图选点容器（小区、编辑页共用） */
.picker { position: relative; height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); }

/* 状态胶囊 + 标签的排列容器（台账、档案、地图共用） */
.status-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ============================================================
   分页（所有列表页共用）
   ============================================================ */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-2); color: var(--ink-3); font-size: var(--text-sm); }
.pager label { display: inline-flex; align-items: center; gap: var(--space-2); }
.pager select { width: auto; height: var(--h-sm); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.pager .btns { display: flex; align-items: center; gap: var(--space-2); }

/* 视频播放图标：正圆 + 按圆心坐标放置的三角形 */
.video-play-icon { display: block; width: 44px; height: 44px; }
.video-play-disc { fill: var(--on-solid); }
.video-play-triangle { fill: var(--ink); }

/* ============================================================
   图标：从 /assets/v2/icons.svg 引用，颜色跟随文字
   用法：<svg class="icon"><use href="/assets/v2/icons.svg#i-plus" /></svg>
   ============================================================ */
.icon { display: inline-block; flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ============================================================
   提示条 .alert：页面内的信息、成功、警告、错误。颜色语义与状态色一致
   ============================================================ */
.alert { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid; border-radius: var(--radius-md); font-size: var(--text-md); }
.alert > .icon { margin-top: 3px; }
.alert-title { display: block; font-weight: var(--weight-semibold); }
.alert-info { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }
.alert-success { border-color: var(--available-line); background: var(--available-bg); color: var(--available-ink); }
.alert-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.alert-danger { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-ink); }

/* ============================================================
   面板 .panel：带标题栏的白色区块；工具条 .toolbar：筛选/搜索/操作的一行
   ============================================================ */
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: var(--text-lg); }
.panel-head p { color: var(--ink-3); font-size: var(--text-sm); }
.panel-body { padding: var(--space-5); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.toolbar > .spacer { flex: 1; }

/* ============================================================
   头像 .avatar：图片或首字
   ============================================================ */
.avatar { display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; overflow: hidden; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-lg); }

/* ============================================================
   键值对 .kv：档案、详情里的「字段 — 值」列表
   <dl class="kv"><div><dt>楼层</dt><dd>3 / 8 层</dd></div>…</dl>
   ============================================================ */
.kv { display: grid; gap: var(--space-2); margin: 0; }
.kv > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-3); }
.kv dt { color: var(--ink-3); font-size: var(--text-sm); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ============================================================
   时间线 .timeline：维护记录、跟进记录、带看路线等「按时间/顺序」的列表
   节点颜色：默认中性；.is-success 绿；.is-warn 琥珀；.is-danger 红
   ============================================================ */
.timeline { display: grid; margin: 0; padding: 0; list-style: none; }
.timeline > li { position: relative; display: grid; gap: var(--space-1); padding: 0 0 var(--space-4) var(--space-5); }
.timeline > li::before { content: ""; position: absolute; top: 7px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline > li::after { content: ""; position: absolute; top: 18px; bottom: 0; left: 3.5px; width: 1px; background: var(--line); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li:last-child::after { display: none; }
.timeline > li.is-success::before { background: var(--available); }
.timeline > li.is-warn::before { background: var(--warn); }
.timeline > li.is-danger::before { background: var(--danger); }
.timeline-title { font-weight: var(--weight-semibold); }
.timeline-meta { color: var(--ink-3); font-size: var(--text-xs); }

/* ============================================================
   进度条 .progress：默认品牌淡蓝（中性进度）；.is-success 绿（完成度）
   ============================================================ */
.progress, .progress-track { height: 6px; overflow: hidden; border-radius: var(--radius-full); background: var(--surface-sunken); }
.progress > i, .progress-track > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-accent); transition: width var(--dur-base) var(--ease); }
.progress.is-success > i { background: var(--available); }
.progress.is-warn > i { background: var(--warn); }
.progress-track { flex: 1; }
.progress.is-large, .progress-track.is-large { height: 8px; }

/* ============================================================
   统计块 .stat-tile：一个数字 + 说明。数字默认墨色，只有「预警类」才变色
   ============================================================ */
.stat-tile { display: grid; gap: 2px; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stat-tile-label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: var(--text-sm); }
.stat-tile-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-tile-value small { color: var(--ink-3); font-size: var(--text-sm); font-weight: var(--weight-regular); }
.stat-tile-hint { color: var(--ink-3); font-size: var(--text-xs); }
.stat-tile.is-warn .stat-tile-value { color: var(--warn); }
.stat-tile.is-danger .stat-tile-value { color: var(--danger); }

/* ============================================================
   数据表 .data-table：放在 .table-card 里（卡片外框 + 圆角裁切）
   数字列加 .num（右对齐）；整行可点时给 tr 加 tabindex 与 role="link"
   ============================================================ */
.table-card { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px var(--space-4); background: var(--surface-sunken); border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: var(--text-xs); font-weight: var(--weight-medium); text-align: left; white-space: nowrap; }
.data-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--canvas); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td small { display: block; color: var(--ink-3); font-size: var(--text-xs); }

/* ============================================================
   骨架屏 .skeleton：数据加载中的占位（列表、卡片），比「正在读取…」文字更稳定
   ============================================================ */
.skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--line) 37%, var(--surface-sunken) 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; }
.skeleton-line { height: 14px; }
.skeleton-line.is-short { width: 40%; }
.skeleton-block { height: 96px; border-radius: var(--radius-md); }
@keyframes skeleton { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ============================================================
   开关 input.switch：立即生效的二选一设置（不需要点保存）
   ============================================================ */
input[type="checkbox"].switch { position: relative; width: 38px; height: 22px; border: 0; border-radius: var(--radius-full); background: var(--line-strong); transition: background var(--dur-base) var(--ease); }
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--on-solid); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transform: none; transition: transform var(--dur-base) var(--ease); }
input[type="checkbox"].switch:checked { background: var(--brand); }
input[type="checkbox"].switch:checked::after { width: 18px; height: 18px; border: 0; transform: translateX(16px); }

/* ============================================================
   筛选胶囊 .chip：可点击的快捷筛选（与不可点的 .tag 区分）
   选中：加 .active 或 aria-pressed="true"
   ============================================================ */
.chip { display: inline-flex; align-items: center; gap: 6px; height: var(--h-sm); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-full); background: var(--surface); color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active, .chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ============================================================
   右侧抽屉 .drawer：编辑一条记录、较长的表单。窄屏占满宽度
   结构：.drawer-backdrop + aside.drawer > .drawer-head / .drawer-body / .drawer-foot
   ============================================================ */
.drawer-backdrop { position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--scrim); }
.drawer { position: fixed; z-index: var(--z-drawer); top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(460px, 100vw); background: var(--surface); box-shadow: var(--shadow-dialog); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-4) var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); }
.drawer-body { display: grid; flex: 1; gap: var(--space-5); align-content: start; padding: var(--space-5) var(--space-6); overflow-y: auto; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6); border-top: 1px solid var(--line); }
.drawer-foot-right { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.drawer > form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.drawer-kicker { display: block; color: var(--ink-3); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.drawer-head h2 { font-size: var(--text-lg); }
.drawer-head p { color: var(--ink-3); font-size: var(--text-sm); }
.drawer-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.drawer-section > h3 { font-size: var(--text-md); }
.drawer .choice-list.three-col, .drawer-dialog .choice-list.three-col { grid-template-columns: minmax(0, 1fr); }
.drawer, .activity-dialog.drawer-dialog[open] { animation: drawer-in var(--dur-base) var(--ease); }
@keyframes drawer-in { from { opacity: 0.6; transform: translateX(24px); } to { opacity: 1; transform: none; } }
/* 用 <dialog> 实现的抽屉：和 .drawer 长得完全一样（同一个组件，只是容器不同）。长表单一律用它，手机上占满屏幕 */
.activity-dialog.drawer-dialog { position: fixed; inset: 0 0 0 auto; width: min(460px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
.activity-dialog.drawer-dialog[open] { display: flex; flex-direction: column; }
@media (max-width: 640px) {
  .drawer-head { padding: var(--space-4) var(--space-3) var(--space-3) var(--space-4); }
  .drawer-body { padding: var(--space-4); }
  .drawer-foot { padding: var(--space-3) var(--space-4); }
}

/* 空状态：标题 + 一句说明 + 可选的一个主要动作 */
.empty .btn { margin-top: var(--space-3); }

/* 表单容器里的网格项：允许收缩，避免输入框的固有宽度把整列撑出屏幕 */
.form-grid > *, .activity-body > *, .modal-scroll > *, .drawer-body > *, .lease-drawer-body > *, .lease-form-section > * { min-width: 0; }
.activity-body, .drawer-body { grid-template-columns: minmax(0, 1fr); }
