/* 华东制管 Agent CRM — 前端样式（原生 CSS，移动优先，无框架）

   风格依据：agent-crm/docs/ui-style-spec.md《界面风格约定》v1.4（含 Q-01~Q-05 队长裁定）；
             条款编号 T-xx / L-xx / C-xx / R-xx / A-xx / X-xx / H-x 与本文件注释一一对应。
   结构：左侧固定侧栏（>768px 220px → ≤768px 60px → ≤480px 44px）+ 主内容区（.app-topbar + #page + 页脚）。
   字号阶梯（T-32 v1.4，14px 基准）：1.35/1.15/1/.95/.9/.86rem（表格内小字一律 ≥.9rem，表格外小字 ≥.86rem = 12.04px）；
     组件级现状保留：.85rem(btn, C-01) / 1.4rem(登录标题, C-14) / 1.5rem(.stat-num) / 1.2rem(.summary-item .n) / 16px(≤720px 输入, A-11)。
   编码：UTF-8（无 BOM）
   ============================================================ */

:root {
  /* ---- 颜色令牌（T-01 ~ T-19、T-33 ~ T-34） ---- */
  --c-bg: #eef1f5;                    /* T-01 页面底色 */
  --c-surface: #ffffff;               /* T-02 卡片/面板底 */
  --c-line: #cdd4dc;                  /* T-03 边框、分隔线 */
  --c-text: #1a1d23;                  /* T-04 正文 */
  --c-text-soft: #5a6675;             /* T-05 次级文字（偏离参考的次级色，按对比度加固取值） */
  --c-primary: #2c3e50;               /* T-06 主色 */
  --c-primary-hover: #1a252f;         /* T-07 主色 hover */
  --c-primary-active: #131b24;        /* T-33 主色按下态（v1.4 新增） */
  --c-primary-light: #3d566e;         /* T-08 侧栏激活项底色 */
  --c-sidebar-bg: #1a252f;            /* T-09 侧栏底 */
  --c-sidebar-text: #c8d2dc;          /* T-10 侧栏正文 */
  --c-sidebar-item: #8899aa;          /* T-11 导航项默认色（5.32 ✓） */
  --c-sidebar-item-hover: #cdd6e0;    /* T-12 hover 文字（10.59 ✓） */
  --c-sidebar-hover-bg: rgba(255, 255, 255, .06);  /* T-13 hover 底色（A-12 装饰性豁免） */
  --c-sidebar-line: rgba(255, 255, 255, .08);      /* T-14 侧栏分隔线（A-12 装饰性豁免） */
  --c-control-disabled-bg: #f6f8fb;   /* T-34 禁用控件底（A-12⑥ 豁免） */
  --c-danger: #c0392b;                /* T-15 危险/错误 */
  --c-warn: #a15c00;                  /* T-16 警示（文字用；偏离参考 #c26a00，加固后 4.95/5.19） */
  --c-warn-graphic: #c26a00;          /* T-17 警示图形色（仅非文字） */
  --c-ok: #2d7d46;                    /* T-18 成功 */

  /* ---- 圆角 / 阴影 / 字体 / 侧栏宽度（T-20 ~ T-29） ---- */
  --radius-xs: 4px;                   /* T-22 表格内联控件 */
  --radius: 6px;                      /* T-20 */
  --radius-lg: 8px;                   /* T-21 卡片 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);    /* T-23 */
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .06);    /* T-24 */
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, .08);   /* T-25 */
  --shadow-modal: 0 8px 40px rgba(0, 0, 0, .18);/* T-26 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; /* T-27 全站唯一字体声明 */
  --sidebar-w: 220px;                 /* T-29 */
  --sidebar-w-md: 60px;
  --sidebar-w-sm: 44px;
  /* 注：T-31 已删除顶栏高度耦合令牌（原变量名不再出现在 web/ 任何文件中） */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 14px/1.5 var(--font);               /* T-28（Q-05 裁定：对齐参考 14px） */
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; }
h1 { font-size: 1.35rem; }                   /* T-32 保留档位 */
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }       /* C-17：链接 hover 加下划线 */
a:active { color: var(--c-primary-hover); }

.muted { color: var(--c-text-soft); }
.small { font-size: .86rem; }                 /* A-13 小字保底 12.04px */
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
[hidden] { display: none !important; }

/* 视觉隐藏（A-03）：保留真实文本节点与可访问名称，不使用 display:none */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============ 焦点可见（A-05 / C-17；禁止全局 outline:none） ============ */

.app-content a:focus-visible,
.app-content button:focus-visible,
.app-content [tabindex]:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.app-sidebar a:focus-visible,
.app-sidebar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ============ 外壳：左侧固定侧栏（L-01 ~ L-08） ============ */

.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);                       /* L-02 */
  z-index: 100;                                  /* T-30 侧栏 100 < 模态 200 < Toast 300 */
  display: flex;
  flex-direction: column;
  background: var(--c-sidebar-bg);
  color: var(--c-sidebar-text);
}

.sidebar-brand { position: relative; padding: 22px 20px 18px; border-bottom: 1px solid var(--c-sidebar-line); }  /* L-03 */
.sidebar-brand h2 {
  margin: 0;
  font-size: 1rem;                               /* T-32 侧栏品牌标题（约定新增变更项） */
  font-weight: 600;
  color: #fff;
  letter-spacing: .3px;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }                              /* L-03 */

.nav-item {                                      /* L-06 / A-01 / A-02：<button> + aria-current */
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  margin-bottom: 1px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;                              /* T-32（14px 基准下 12.60px） */
  font-weight: 500;
  line-height: 1.2;
  color: var(--c-sidebar-item);
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;       /* A-10 过渡 ≤ .15s */
}
.nav-item:hover { background: var(--c-sidebar-hover-bg); color: var(--c-sidebar-item-hover); }
.nav-item:active { background: rgba(255, 255, 255, .09); color: var(--c-sidebar-item-hover); }   /* C-17 按下态 */
.nav-item[aria-current="page"] { background: var(--c-primary-light); color: #fff; font-weight: 600; }
.nav-item[aria-current="page"]:hover,
.nav-item[aria-current="page"]:active { background: var(--c-primary-light); color: #fff; }

.nav-icon {                                      /* L-03 附注 / A-04：槽宽 20px、居中、currentColor、opacity 1 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex: 0 0 20px;
  font-size: .95rem;
  text-align: center;
  opacity: 1;
  color: currentColor;
}
.nav-icon svg { display: block; width: 18px; height: 18px; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-user {                                  /* L-03 + 附注 H4：底部块含 iOS 安全区 */
  position: relative;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-sidebar-line);
}
.sidebar-user .user-name {                       /* L-03 附注：长名字可换行，不撑破 220px 侧栏 */
  font-size: .86rem;                             /* T-32（12.04px ≥ 12 保底） */
  font-weight: 600;
  color: #e2e8f0;
  word-break: break-word;
}
.sidebar-user .whoami { color: inherit; }
.sidebar-user .btn-logout {                      /* 参考 .btn-logout；收起态改用图标 + sr-only 文本 */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 14px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius);
  background: transparent;
  color: var(--c-sidebar-item);
  font-family: inherit;
  font-size: .86rem;                             /* T-32 */
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-user .btn-logout:hover,
.sidebar-user .btn-logout:active { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.sidebar-user .btn-logout .btn-icon { display: none; }          /* 展开态只显示文字 */
.sidebar-user .btn-logout .btn-icon svg { display: block; width: 18px; height: 18px; }

/* 主内容区（L-02：margin-left 与侧栏宽度同源；L-09：.app-topbar 承载范围徽标） */
.app-content {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-topbar {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 32px 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.app-main { flex: 1 1 auto; width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 32px; min-height: 60vh; }
.app-footer { width: 100%; max-width: 1100px; margin: 0 auto; padding: 4px 32px calc(18px + env(safe-area-inset-bottom)); text-align: center; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.page-title h2 { margin: 0; }

/* ============ 登录页（C-14） ============ */

.view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background: linear-gradient(160deg, #1a252f 0%, #2c3e50 50%, #34495e 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .15);
}
.login-head { margin-bottom: 16px; }
.login-head .brand { font-size: 1.4rem; font-weight: 600; margin-bottom: 4px; }
.login-foot { margin-top: 14px; }

/* 版本号：跟在主标题后面，小字号（T-32 阶梯下限 .86rem，遵守"表格外小字 ≥.86rem"） */
.app-version {
  display: inline-block;
  margin-left: 8px;
  font-size: .86rem;
  font-weight: 400;
  letter-spacing: .3px;
  color: var(--c-text-soft);
  vertical-align: baseline;
}
.app-version:empty { display: none; }              /* 未取到版本时不占位 */
.sidebar-brand .app-version { color: var(--c-sidebar-item); }

/* ============ 通用组件（C 段 / C-17 四态） ============ */

.btn {                                            /* C-01 */
  appearance: none;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text);
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  min-height: 40px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: #b9c2cf; background: #f7f9fc; }        /* C-17 hover */
.btn:active:not(:disabled) { background: #eef1f5; }                              /* C-17 按下 */
.btn:disabled { opacity: .55; cursor: not-allowed; background: var(--c-control-disabled-bg); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }   /* C-02 */
.btn-primary:hover:not(:disabled) { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--c-primary-active); border-color: var(--c-primary-active); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }      /* C-04 */
.btn-danger:hover:not(:disabled) { background: #a93226; border-color: #a93226; }
.btn-danger:active:not(:disabled) { background: #952d21; border-color: #952d21; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-primary); }   /* C-03 */
.btn-ghost:hover:not(:disabled) { background: rgba(44, 62, 80, .08); }
.btn-ghost:active:not(:disabled) { background: rgba(44, 62, 80, .14); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: .86rem; }              /* A-13 小字保底 */
.btn-block { display: block; width: 100%; }

.card {                                           /* C-05 */
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card > h2, .card > h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }

.chip {                                           /* C-08 */
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: .86rem;
  background: #e8f0fe;
  color: var(--c-primary);                        /* 9.59 ✓ */
  border: 1px solid rgba(44, 62, 80, .16);
}
.badge {                                          /* C-07 */
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius);
  font-size: .86rem;
  border: 1px solid var(--c-line);
  background: #f1f3f6;
  color: var(--c-text-soft);
}
.badge-key { background: #fdeceb; border-color: #f0c9c6; color: #93251d; font-weight: 600; }
.badge-normal { background: #eef7f1; border-color: #c8e3d3; color: #166b3f; }
.badge-mid { background: #fff6e6; border-color: #f0dcb6; color: #8a5a00; }
.badge-high { background: #fdeceb; border-color: #f0c9c6; color: #93251d; }
.badge-muted { background: #f1f3f6; }

.alert { border-radius: var(--radius-lg); padding: 9px 11px; font-size: .86rem; margin: 0 0 10px; border: 1px solid transparent; }  /* C-11 */
.alert-error { background: #fff3f2; border-color: #e9bebb; color: var(--c-danger); }
.alert-warn { background: #fff9ec; border-color: #eedcb4; color: var(--c-warn); }
.alert-info { background: #f2f7fd; border-color: #cfe0f3; color: #17518f; }
.alert-ok { background: #eff8f2; border-color: #c4e2d2; color: var(--c-ok); }

.empty { text-align: center; color: var(--c-text-soft); padding: 22px 10px; }                 /* C-16 */

/* ============ 表单（C-10 / C-17） ============ */

.field { margin-bottom: 12px; }
.field > label { display: block; font-size: .86rem; color: var(--c-text-soft); margin-bottom: 4px; }
.field .req { color: var(--c-danger); font-weight: 700; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  font: inherit;
  font-size: .95rem;                              /* T-32 表单控件（桌面） */
  background: #fafbfc;
  color: var(--c-text);
  min-height: 40px;
}
textarea { min-height: 84px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b9c2cf; }             /* C-17 hover */
input:focus, select:focus, textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(44, 62, 80, .12);
  background: #fff;
}
input:disabled, select:disabled, textarea:disabled {                            /* C-17 disabled（A-12⑥ 豁免） */
  background: var(--c-control-disabled-bg);
  color: var(--c-text-soft);
  cursor: not-allowed;
}
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--c-danger); background: #fffafa; }
.field .hint { font-size: .86rem; color: var(--c-text-soft); margin-top: 3px; }
.field .field-error { font-size: .86rem; color: var(--c-danger); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: 1 / -1; } }
fieldset { border: 1px solid var(--c-line); border-radius: var(--radius); padding: 12px; margin: 0 0 12px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 6px; color: var(--c-primary); }
.readonly-value { font-size: .95rem; padding: 8px 10px; background: #f8f9fc; border: 1px dashed var(--c-line); border-radius: var(--radius); word-break: break-all; }

/* ============ 表格 / 列表（C-09；H7：不引入吸顶表头） ============ */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }        /* T-32：14px 基准下 12.60px ≥12.5 */
table.table th, table.table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f5; text-align: left; vertical-align: top; }
table.table th {
  padding: 12px 14px;
  background: #f8f9fc;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
}
table.table th.row-head { width: 168px; background: transparent; font-weight: 500; color: var(--c-text-soft); }
table.table tbody tr:hover td { background: #fafcff; }                          /* A-12④ 装饰性豁免 */
table.table tbody tr:last-child td { border-bottom: none; }
/* 表格作用域内小字统一提升到 .9rem（T-32 硬要求：表格内文字 ≥12.5px） */
table.table .badge, table.table .chip, table.table .btn-sm, table.table .cell-sub { font-size: .9rem; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: .86rem; color: var(--c-text-soft); }                     /* 表格外为 .86rem，表格内上行覆盖为 .9rem */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ============ 统计 ============ */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
}
.stat .stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }       /* 现状档位保留 */
.stat .stat-label { font-size: .86rem; color: var(--c-text-soft); }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .86rem; }
.bar-row .bar-label { flex: 0 0 108px; color: var(--c-text-soft); }
.bar-row .bar-track { flex: 1 1 auto; height: 10px; background: #eef1f5; border-radius: var(--radius); overflow: hidden; }  /* C-15 */
.bar-row .bar-fill { height: 100%; background: var(--c-primary); border-radius: var(--radius); }
.bar-row .bar-num { flex: 0 0 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 导入结果 ============ */

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
@media (min-width: 700px) { .summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.summary-item { border: 1px solid var(--c-line); border-radius: var(--radius); padding: 8px 10px; background: var(--c-surface); }
.summary-item .n { font-size: 1.2rem; font-weight: 700; }                        /* 现状档位保留 */
.summary-item .t { font-size: .86rem; color: var(--c-text-soft); }
.summary-item.is-failed .n { color: var(--c-danger); }
.summary-item.is-ok .n { color: var(--c-ok); }

.error-line { border-left: 3px solid var(--c-danger); background: #fffafa; border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; }
.error-line .err-head { font-size: .86rem; font-weight: 600; margin-bottom: 3px; }
.error-line .err-body { font-size: .86rem; color: #5f2b27; word-break: break-word; }
pre.copybox {
  background: #f8f9fc;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 10px;
  font-size: .86rem;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.file-drop {
  border: 2px dashed var(--c-line);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  background: #fafcff;
  cursor: pointer;
}
.file-drop.dragover { border-color: var(--c-primary); background: #f2f7fd; }
.file-drop input[type="file"] { display: none; }
.file-chosen { font-size: .86rem; color: var(--c-text-soft); margin-top: 6px; word-break: break-all; }

/* X-06 收口：原先由 JS 内联 style="color:#93251d" 承担的错误提示，改为类名 */
.notice-danger { color: var(--c-danger); margin-top: 2px; }

.progress { height: 8px; background: #eef1f5; border-radius: var(--radius); overflow: hidden; margin-top: 10px; }  /* C-15 */
.progress > span { display: block; height: 100%; width: 0; background: var(--c-primary); transition: width .2s; }

/* ============ Toast 与 Modal（C-12 / C-13 / T-30） ============ */

.toast {                                          /* C-12：右上角 + 左侧 3px 语义色条（Q-03：修复"被模态遮挡"既有缺陷） */
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: min(340px, 92vw);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .86rem;
  font-weight: 500;
  background: #eff6ff;
  color: #1e40af;
  border-left: 3px solid var(--c-primary);
  box-shadow: var(--shadow-md);
  z-index: 300;                                   /* T-30：Toast 300 > 模态 200 */
  animation: toastIn .25s ease;
  word-break: break-word;
}
.toast.is-error { background: #fef2f2; color: #991b1b; border-left-color: var(--c-danger); }
.toast.is-ok { background: #ecfdf5; color: #065f46; border-left-color: var(--c-ok); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }   /* A-10 */

.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); }
.modal-box {                                      /* C-13 */
  position: relative;
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 82vh;
  overflow: auto;
  box-shadow: var(--shadow-modal);
}
.modal-title { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ============ 响应式（R-01 / R-02 / L-08；断点终裁 768px / 480px） ============ */

/* > 768px：220px 全展开（以上默认值即此档，主内容 28px 32px） */

/* ≤768px：60px 图标栏 —— 文字一律 .sr-only 视觉隐藏（A-03），保留图标与真实文本节点 */
@media (max-width: 768px) {
  .app-sidebar { width: var(--sidebar-w-md); }
  .app-content { margin-left: var(--sidebar-w-md); }
  .app-main { padding: 14px; }
  .app-footer { padding: 4px 14px calc(18px + env(safe-area-inset-bottom)); }
  .app-topbar { padding: 14px 14px 0; }

  /* L-08：以下文字改视觉隐藏（不 display:none），可访问名称来自真实文本节点 */
  .sidebar-brand h2,
  .sidebar-user .user-name,
  .nav-label,
  .sidebar-user .btn-logout .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .nav-item { justify-content: center; gap: 0; padding: 10px 4px; min-height: 40px; }   /* A-07：60px 档 40×40 */
  .nav-icon { width: auto; flex: 0 0 auto; }

  .sidebar-user { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  .sidebar-user .btn-logout { width: 100%; min-height: 40px; margin-top: 0; padding: 4px 6px; }
  .sidebar-user .btn-logout .btn-icon { display: inline-flex; }                        /* A-03：收起态显示退出图标 */
}

/* ≤720px：保留表格卡片化；主内容内距收窄（R-01；后写者生效） */
@media (max-width: 720px) {
  .app-main { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  .app-footer { padding: 4px 10px calc(12px + env(safe-area-inset-bottom)); }
  .app-topbar { padding: 12px 10px 0; }
  .card { padding: 14px; }
  .modal-box { padding: 18px; }

  /* A-07：移动端可点元素 ≥ 40×40 */
  .btn, .btn-sm { min-height: 40px; }
  /* A-11（建议级）：移动端输入字号 ≥16px，避免 iOS 聚焦自动缩放 */
  input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea { font-size: 16px; }

  table.table thead { display: none; }
  table.table th.row-head { display: none; }
  table.table, table.table tbody, table.table tr, table.table td { display: block; width: 100%; }
  table.table tr { border: 1px solid var(--c-line); border-radius: var(--radius); margin-bottom: 10px; padding: 3px 0; background: #fff; }
  table.table td { border: none; padding: 4px 10px; display: flex; flex-wrap: wrap; gap: 10px; }
  table.table td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    color: var(--c-text-soft);
    font-size: .86rem;
    padding-top: 2px;
  }
  table.table td .cell-sub { flex: 1 1 100%; }
  table.table td[data-label=""]::before { display: none; }
  table.table td.td-actions { padding-top: 8px; border-top: 1px dashed var(--c-line); margin-top: 4px; }
}

/* ≤480px：44px 窄图标栏 */
@media (max-width: 480px) {
  .app-sidebar { width: var(--sidebar-w-sm); }
  .app-content { margin-left: var(--sidebar-w-sm); }
  .app-main { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .app-footer { padding: 4px 10px calc(10px + env(safe-area-inset-bottom)); }
  .app-topbar { padding: 10px 10px 0; }

  .sidebar-nav { padding: 10px 0; }
  .nav-item { min-height: 44px; padding: 10px 0; }             /* A-07：44px 档 44×44 */
  .sidebar-user { padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
  .sidebar-user .btn-logout { min-height: 44px; }
}
