/* =========================================================================
   base.css — 设计令牌 + 通用组件
   单位硬件运维工具 · 零依赖
   ========================================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  /* 主色 / 中性 */
  --c-primary: #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-primary-soft: #eff6ff;
  --c-bg: #f4f6f8;
  --c-surface: #ffffff;
  --c-border: #e5e7eb;
  --c-border-strong: #d1d5db;
  --c-text: #1f2937;
  --c-text-2: #6b7280;
  --c-text-3: #9ca3af;

  /* 状态四态 */
  --st-in_use: #16a34a;
  --st-idle:   #0ea5e9;
  --st-repair: #f59e0b;
  --st-scrap:  #dc2626;

  /* 语义 */
  --c-success: #16a34a;
  --c-warning: #f59e0b;
  --c-danger:  #dc2626;
  --c-info:    #2563eb;

  /* 字号 */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  /* 间距（8 主栅格 / 4 微调） */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* 圆角 */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(16,24,40,.06);
  --sh-md: 0 1px 3px rgba(16,24,40,.1), 0 1px 2px rgba(16,24,40,.06);
  --sh-lg: 0 4px 16px rgba(16,24,40,.1);

  /* 布局 */
  --topbar-h: 56px;
  --container: 1280px;
  --lh: 1.5;

  /* 字体 */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* 动效 */
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 300ms;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- 排版工具 ---------- */
.h-title { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.3; margin: 0; }
.h-section { font-size: var(--fs-xl); font-weight: 600; line-height: 1.3; margin: 0; }
.muted { color: var(--c-text-2); }
.muted-3 { color: var(--c-text-3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-6);
  padding: 0 var(--sp-6);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--sh-sm);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-lg); font-weight: 700; color: var(--c-text);
  white-space: nowrap;
}
.topbar__brand .logo {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: var(--c-primary); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.topbar__nav { display: flex; gap: var(--sp-1); flex: 1; }
.topbar__nav a {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  color: var(--c-text-2); font-weight: 500; font-size: var(--fs-base);
  text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.topbar__nav a:hover { background: var(--c-bg); color: var(--c-text); }
.topbar__nav a.active { background: var(--c-primary-soft); color: var(--c-primary); }
.topbar__spacer { flex: 1; }

/* ---------- 容器 ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: var(--sp-6); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  user-select: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-hover); }
.btn-ghost { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--c-bg); border-color: var(--c-text-3); }
.btn-danger { background: var(--c-surface); color: var(--c-danger); border-color: #f3c2c2; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: var(--c-danger); }
.btn-danger-solid { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-danger-solid:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; flex: none; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-2); }
.field .req { color: var(--c-danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-base); color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { height: auto; min-height: 76px; padding: var(--sp-2) var(--sp-3); line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.input::placeholder, .textarea::placeholder { color: var(--c-text-3); }
.select { appearance: none; background-image: 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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-2); }
.field-error { color: var(--c-danger); font-size: var(--fs-sm); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); background: var(--c-surface); }
.table thead th {
  background: #fafbfc; color: var(--c-text-2);
  font-weight: 600; font-size: var(--fs-sm); text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text); vertical-align: middle;
}
.table tbody tr:hover { background: var(--c-primary-soft); }
.table tbody tr.selected { background: var(--c-primary-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table .col-check { width: 40px; }
.table .col-ops { width: 1%; white-space: nowrap; }
.cell-sub { color: var(--c-text-3); font-size: var(--fs-sm); }
.cell-strong { font-weight: 600; }
.table td[data-label="资产编号"] { min-width: 90px; white-space: nowrap; }
.empty {
  padding: var(--sp-12) var(--sp-4); text-align: center;
  color: var(--c-text-3); font-size: var(--fs-base);
}

/* ---------- 徽章（状态） ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.6;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-in_use  { color: var(--st-in_use);  background: #e7f6ed; }
.badge-idle    { color: var(--st-idle);    background: #eef1f4; }
.badge-repair  { color: #b45309;           background: #fef3e2; }
.badge-repair::before { background: var(--st-repair); }
.badge-scrap   { color: #b91c1c;           background: #fdecec; }
.badge-in_use::before { background: var(--st-in_use); }
.badge-idle::before   { background: var(--st-idle); }
.badge-scrap::before  { background: var(--st-scrap); }

/* ---------- 工具栏 / 筛选条 ---------- */
.toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.toolbar .spacer { flex: 1; }
.filterbar {
  display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end;
  padding: var(--sp-4); margin-bottom: var(--sp-4);
}
.filterbar .field { min-width: 160px; }
.filterbar .field.grow { flex: 1; min-width: 200px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); flex-wrap: wrap; }
.pagination .total { color: var(--c-text-2); font-size: var(--fs-sm); }
.pagination .pages { display: flex; gap: var(--sp-1); margin-left: auto; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 var(--sp-2);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text); cursor: pointer; font-size: var(--fs-sm);
}
.page-btn:hover:not(:disabled) { background: var(--c-bg); }
.page-btn.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal-overlay, .drawer-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 24, 39, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-base) var(--ease), visibility var(--t-base) var(--ease);
}
.modal-overlay.open, .drawer-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - var(--sp-12));
  background: var(--c-surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); display: flex; flex-direction: column;
  transform: translateY(8px); transition: transform var(--t-base) var(--ease);
}
.modal-overlay.open .modal { transform: translateY(0); }
/* .modal 内的 <form> 包裹 body+footer 时，必须作为 flex 列容器传递滚动链 */
.modal form {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0;
  overflow: hidden;      /* 由 .modal__body 负责滚动 */
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--c-border);
}
.modal__title { font-size: var(--fs-lg); font-weight: 600; margin: 0; }
.modal__body { padding: var(--sp-5); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal__footer {
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--c-border);
}
.x-btn {
  width: 32px; height: 32px; border: none; border-radius: var(--r-md);
  background: transparent; color: var(--c-text-2); cursor: pointer; font-size: 20px; line-height: 1;
}
.x-btn:hover { background: var(--c-bg); color: var(--c-text); }

/* ---------- 抽屉 ---------- */
.drawer-overlay { justify-content: flex-end; padding: 0; }
.drawer {
  width: 440px; max-width: 100vw; height: 100vh; height: 100dvh;
  background: var(--c-surface); box-shadow: var(--sh-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--t-slow) var(--ease);
}
.drawer-overlay.open .drawer { transform: translateX(0); }
.drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--c-border);
}
.drawer__body { padding: var(--sp-5); overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.drawer__footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--c-border); display: flex; gap: var(--sp-3); }

/* ---------- 详情字段列表 ---------- */
.dl { display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-3) var(--sp-4); margin: 0; }
.dl dt { color: var(--c-text-2); font-size: var(--fs-sm); align-self: start; padding-top: 2px; }
.dl dd { margin: 0; color: var(--c-text); word-break: break-word; }
.dl dd.mono { font-family: var(--mono); }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2); max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--c-surface); box-shadow: var(--sh-lg);
  border-left: 4px solid var(--c-text-3);
  font-size: var(--fs-base); transform: translateX(20px); opacity: 0;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { border-left-color: var(--c-success); }
.toast-warning { border-left-color: var(--c-warning); }
.toast-danger  { border-left-color: var(--c-danger); }
.toast-info    { border-left-color: var(--c-info); }
.toast__icon { font-weight: 700; margin-top: 1px; }
.toast-success .toast__icon { color: var(--c-success); }
.toast-warning .toast__icon { color: var(--c-warning); }
.toast-danger  .toast__icon { color: var(--c-danger); }
.toast-info    .toast__icon { color: var(--c-info); }
.toast__body { flex: 1; }
.toast__title { font-weight: 600; }
.toast__msg { color: var(--c-text-2); font-size: var(--fs-sm); }
.toast__close { border: none; background: none; color: var(--c-text-3); cursor: pointer; font-size: 16px; line-height: 1; }

/* ---------- 区块标题 ---------- */
.block-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.block-head h2 { font-size: var(--fs-xl); font-weight: 600; margin: 0; }
.block-head .spacer { flex: 1; }

/* ---------- 列表（运维/分类）项 ---------- */
.list { display: flex; flex-direction: column; gap: var(--sp-3); }
.list-item {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-4); background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--r-lg);
}
.list-item .li-main { flex: 1; min-width: 0; }

/* ---------- 加载态 ---------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--c-border-strong); border-top-color: var(--c-primary);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 选择/复选框 ---------- */
.checkbox { width: 16px; height: 16px; accent-color: var(--c-primary); cursor: pointer; }

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row.wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--sp-2); } .gap-4 { gap: var(--sp-4); }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); }
.hide { display: none !important; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { gap: var(--sp-3); padding: 0 var(--sp-4); overflow-x: auto; }
  .topbar__brand { font-size: var(--fs-base); }
  .container { padding: var(--sp-4); }
  .form-grid { grid-template-columns: 1fr; }
  .filterbar .field { min-width: 100%; }
  .modal { max-width: 100%; }
  .dl { grid-template-columns: 84px 1fr; }
}

/* ============================================================
   移动端外壳（追加）— 桌面端显式隐藏移动专属元素
   阈值 ≤768px；原 640px 规则在本块之前，冲突处以本媒体查询为准
   ============================================================ */
.topbar__menu { display: none; }
.app-tabbar { display: none; }

@media (max-width: 768px) {
  /* 正文与基础点按区放大 */
  body { font-size: 16px; }
  .btn { height: 44px; }
  .btn-sm { height: 40px; }
  .page-btn { min-width: 44px; height: 44px; }
  .x-btn { width: 40px; height: 40px; }
  .checkbox { width: 20px; height: 20px; }

  /* 顶栏：隐藏横向导航与机构/用户，显示汉堡 */
  .topbar { gap: var(--sp-3); padding: 0 var(--sp-4); overflow: hidden; }
  .topbar__brand { font-size: var(--fs-base); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar__nav { display: none; }
  .topbar__org, #org-select-wrap, #user-menu { display: none; }
  .topbar__menu.icon-btn {
    width: 44px; height: 44px; margin-left: -12px;
    border: none; background: transparent; color: var(--c-text);
    display: grid; place-items: center; cursor: pointer; border-radius: var(--r-md);
  }
  .topbar__menu.icon-btn:active { background: var(--c-bg); }
  .topbar__menu.icon-btn svg { width: 24px; height: 24px; }

  /* 容器底部留白给 Tab 栏 + 安全区 */
  .container { padding: var(--sp-4); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* 表单栅格单列 */
  .form-grid { grid-template-columns: 1fr; }
  .filterbar .field { min-width: 100%; }

  /* 底部 Tab 栏 */
  .app-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex; background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -2px 10px rgba(16,24,40,.06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app-tabbar .app-tab {
    flex: 1; min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; border: none; background: transparent; cursor: pointer;
    color: var(--c-text-3); font-size: 11px; font-weight: 500; padding: 6px 0;
    -webkit-tap-highlight-color: transparent;
  }
  .app-tabbar .app-tab svg { width: 24px; height: 24px; }
  .app-tabbar .app-tab.active { color: var(--c-primary); }
  .app-tabbar .app-tab.active svg { stroke: var(--c-primary); }

  /* 导航抽屉：复用 .drawer-overlay，改为左侧滑出 */
  #app-drawer { justify-content: flex-start; padding: 0; }
  #app-drawer .app-drawer { width: 82%; max-width: 320px; transform: translateX(-100%); }
  #app-drawer.open .app-drawer { transform: translateX(0); }
  .app-drawer__body { padding: var(--sp-2); }
  .app-drawer__foot {
    display: flex; flex-direction: column; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-border);
  }
  .app-drawer__org { display: flex; flex-direction: column; gap: 6px; }
  .app-drawer__label { font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-2); }
  .app-drawer__org .org-select { width: 100%; height: 44px; font-size: 16px; }
  .app-drawer .nav-item {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 52px; padding: 0 var(--sp-4);
    border-radius: var(--r-md); color: var(--c-text);
    font-size: 16px; font-weight: 500; cursor: pointer;
  }
  .app-drawer .nav-item svg { width: 22px; height: 22px; color: var(--c-text-2); flex: none; }
  .app-drawer .nav-item:active { background: var(--c-bg); }
  .app-drawer .nav-item.active { background: var(--c-primary-soft); color: var(--c-primary); }
  .app-drawer .nav-item.active svg { color: var(--c-primary); }
  .app-drawer__sep { height: 1px; background: var(--c-border); margin: var(--sp-2) var(--sp-4); }

  /* 通用表格卡片降级（.responsive） */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr {
    border: 1px solid var(--c-border); border-radius: var(--r-lg);
    margin-bottom: var(--sp-3); padding: var(--sp-2); background: var(--c-surface);
  }
  .table.responsive tbody td {
    border: none; padding: var(--sp-2) var(--sp-3);
    display: flex; justify-content: space-between; gap: var(--sp-4); align-items: center;
  }
  .table.responsive tbody td::before {
    content: attr(data-label); color: var(--c-text-2);
    font-size: var(--fs-sm); font-weight: 600; flex: none;
  }
  .table.responsive tbody td.col-check { display: none; }
  .table.responsive tbody td.col-ops { justify-content: flex-start; flex-wrap: wrap; }
  .table.responsive tbody td.empty { justify-content: center; }
  .table.responsive tbody tr:hover { background: var(--c-surface); }

  /* 模态框手机全屏化（底部上滑 Sheet） */
  .modal-overlay {
    align-items: flex-end; padding: 0;
    height: 100vh; height: 100dvh;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .modal {
    max-width: 100%; max-height: 92vh; max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .modal__body {
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .modal__footer { padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); }

  /* Toast 上移避开 Tab 栏 + 安全区 */
  .toast-host { bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* dl 窄屏两列 */
  .dl { grid-template-columns: 84px 1fr; }
}

/* ── JS 兜底：部分浏览器（鸿蒙等）viewport CSS 宽度检测不准，
   用 html.is-mobile 类强制应���关键移动端规则 ── */
html.is-mobile .topbar__menu   { display: flex; }
html.is-mobile .app-tabbar     { display: flex; }
html.is-mobile .modal-overlay {
  align-items: flex-end; padding: 0;
  height: 100vh; height: 100dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
html.is-mobile .modal {
  max-width: 100%; max-height: 92vh; max-height: 92dvh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
html.is-mobile .modal__body {
  padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
html.is-mobile .modal__footer {
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
}
html.is-mobile .container {
  padding: var(--sp-4);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
html.is-mobile .row-actions   { display: none; }
html.is-mobile .row-actions-m { display: flex; gap: var(--sp-2); }
