/* 先帆房源库 · Base v2：重置、排版、通用工具类 */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: var(--weight-regular) var(--text-md)/1.6 var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* 内容不足一屏时把备案页脚压到窗口底部；内容超出时页脚跟随内容（登录页有整屏门廊，单独处理，不在此列） */
body:not(.login-body) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body:not(.login-body) > main { flex: 1 0 auto; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: 1.4; }
h3 { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: 1.4; }
/* 全站控件去掉 Safari 默认点击灰罩：已经有 :active / 滑块反馈，手机点按更干脆 */
a, button, summary, label { -webkit-tap-highlight-color: transparent; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: var(--space-2); color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
:where(a, summary):focus-visible { border-radius: var(--radius-sm); }

.muted, .hint, .small { color: var(--ink-3); }
.small, .hint { font-size: var(--text-xs); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.danger-text { color: var(--danger) !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* iOS Safari：表单控件字体小于 16px 时聚焦会自动放大页面且不还原，手机宽度下提升到 16px */
@media (max-width: 768px) {
  @supports (-webkit-touch-callout: none) {
    input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"]), select, textarea { font-size: 16px !important; }
    /* 工具条里的紧凑下拉（排序、每页条数）点开是系统选择器、不弹键盘，不会触发自动放大，
       保持 13px 与同排的筛选/新增按钮一致 */
    select.ledger-sort, .pager select { font-size: var(--text-sm) !important; }
  }
}

/* ============================================================
   内部滚动区的滚动条：平时隐藏，鼠标移上去才显示一条细线
   （筛选栏、列表、弹窗正文等「区块内滚动」的地方；整页滚动条保持系统默认）
   新增会内部滚动的区块时，把选择器加进下面这个列表。
   ============================================================ */
:is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
    .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu)::-webkit-scrollbar { width: 8px; height: 8px; }
:is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
    .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu)::-webkit-scrollbar-track { background: transparent; }
:is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
    .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu)::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: var(--radius-full); background: transparent; background-clip: padding-box; }
:is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
    .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu):hover::-webkit-scrollbar-thumb { background-color: var(--line-strong); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) {
  :is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
      .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu) { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  :is(.filter-rail, .filter-checklist, .wb-tree, .map-panel, #mapList, .modal-scroll, .activity-body, .drawer-body,
      .lease-drawer-body, .viewing-pick-list, .bulk-community-list, .due-list, .table-card, .nav-more-menu, .select-menu):hover { scrollbar-color: var(--line-strong) transparent; }
}

/* 日期/时间输入框：手机浏览器（尤其 iOS）默认有固有宽度，会撑出容器；强制收进容器并左对齐 */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { min-width: 0; max-width: 100%; }
@media (max-width: 768px) {
  /* iOS Safari 的原生日期控件会把数值贴在内容框顶部（即使输入框设了固定高度），
     表现为“选了日期后文字偏上、不垂直居中”。这里把输入框和它的内部数值都改成
     纵向 flex 居中，并清掉伪元素自带的行高/最小高度。 */
  input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
    -webkit-appearance: none; appearance: none;
    display: flex; align-items: center;
  }
  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value,
  input[type="datetime-local"]::-webkit-date-and-time-value,
  input[type="month"]::-webkit-date-and-time-value {
    display: flex; align-items: center;
    height: 100%; min-height: 0; margin: 0; line-height: 1;
    text-align: left;
  }
  /* 日期选择指示器（若有）也垂直居中，别顶到上沿 */
  input[type="date"]::-webkit-calendar-picker-indicator { margin-block: auto; }
}

/* 只读演示模式（?demo=1）：嵌在官网 iframe 里，隐藏工作台自己的顶栏与页脚 */
html.in-demo { --topbar-h: 0px; }
html.in-demo .topbar,
html.in-demo .app-foot { display: none !important; }
html.in-demo body { background: var(--canvas); }
