/* 投诉处理中心 · 共享样式（暖玉宣纸）。Chrome 87 兼容（禁用写法见设计规范 §1，tests/check_css_compat.py 把关）。
   令牌与组件类名见 docs/前端设计规范.md §2–§3。 */
:root {
  --bg: #FAF6EF;
  --card: #FFFDF7;
  --line: #E3D7C0;
  --ink: #3B2F25;
  --muted: #8A6A3B;
  --primary: #B23A2E;
  --primary-ink: #FFFDF7;
  --accent: #B95A3C;
  --gold: #C69C4D;
  --green: #0F3A33;
  --soft-red: #F5E6E3;
  --soft-gold: #F3EAD3;
  --soft-green: #E3ECE9;
  --shadow: 0 1px 2px rgba(59,47,37,.06), 0 6px 20px rgba(59,47,37,.06);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

/* ---- 重置与排版 ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.4; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap;
  font-size: 14px; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary, .btn-danger { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover, .btn-danger:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn[aria-disabled="true"] { opacity: .5; cursor: default; }   /* 不用 disabled 的忙碌态：保焦点、点击由脚本忽略 */
/* 忙碌态不给 hover 反馈：按变体保持本色（ghost 边框 / 字色；primary / danger 底色与边框） */
.btn-ghost[aria-disabled="true"]:hover { border-color: var(--line); color: var(--ink); }
.btn-primary[aria-disabled="true"]:hover, .btn-danger[aria-disabled="true"]:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* ---- 徽标 ---- */
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; line-height: 20px;
  white-space: nowrap; background: var(--soft-gold); color: var(--muted);
}
.badge-pending { background: var(--soft-red); color: var(--primary); }
.badge-open { background: var(--soft-gold); color: #8A6420; }
.badge-closed { background: var(--soft-green); color: var(--green); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tag-legacy, .tag-upstream {
  display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 18px;
  border: 1px solid var(--line); color: var(--muted);
}

/* ---- 卡片 ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { position: relative; font-size: 15px; font-weight: 600; padding-bottom: 8px; }
.card-title::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 32px; border-bottom: 2px solid var(--gold);
}
.card-sub { color: var(--muted); font-size: 12px; }

/* ---- KPI ---- */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 32px; font-weight: 600; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-value::after { content: ""; display: block; width: 24px; margin-top: 8px; border-bottom: 2px solid var(--gold); }
.kpi-unit { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.kpi-hint { color: var(--muted); font-size: 12px; }
.kpi-warn .kpi-value { color: var(--primary); }
.kpi-warn .kpi-value::after { border-bottom-color: var(--primary); }

/* ---- 表格 ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 400; font-size: 13px; color: var(--muted);
  padding: 0 12px; height: 40px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 0 12px; height: 44px; border-bottom: 1px solid var(--line); }
.table tbody tr:nth-child(even) { background: rgba(198,156,77,.06); }
.table tbody tr:hover { background: rgba(185,90,60,.08); }
.table tr.clickable { cursor: pointer; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 表单 ---- */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row > label { font-size: 13px; color: var(--muted); }
/* 复选框 / 单选框保持原生尺寸，不套文本框样式 */
input:not([type=checkbox]):not([type=radio]), select, textarea {
  height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 96px; padding: 8px 12px; resize: vertical; line-height: 1.6; }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185,90,60,.15); }
.form-error { color: var(--primary); font-size: 13px; min-height: 20px; }

/* ---- 分段选择 ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button {
  height: 32px; padding: 0 14px; border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--ink); cursor: pointer; font-size: 13px;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--accent); }
.seg button.on { background: var(--soft-red); color: var(--primary); font-weight: 600; }

/* ---- 提示 / 弹层 ---- */
.toast-wrap {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
.toast {
  max-width: 360px; padding: 10px 16px; border-radius: 8px; color: #fff; background: var(--ink);
  box-shadow: var(--shadow); font-size: 14px; pointer-events: auto; animation: toast-in .2s ease-out;
}
.toast-ok { background: var(--green); }
.toast-err { background: var(--primary); }
.toast-info { background: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 900;
  background: rgba(59,47,37,.45); display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 480px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; max-height: 90vh;
}
.modal-head { padding: 16px 20px 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 16px; }

/* ---- 对话气泡（详情页用） ---- */
.bubble-patient, .bubble-hospital { max-width: 80%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble-patient { align-self: flex-start; background: var(--soft-red); border-top-left-radius: 4px; }
.bubble-hospital { align-self: flex-end; background: var(--soft-gold); border-top-right-radius: 4px; }
.bubble-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- 空态 / 骨架 ---- */
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .btn { margin-top: 12px; }
.skeleton { background: var(--soft-gold); border-radius: 8px; min-height: 16px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ---- 电脑端布局（Layout.render） ---- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 56px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
a.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 6px; }
.brand-hosp { color: var(--muted); font-size: 13px; }
.brand-sep { color: var(--line); }
.brand-name { color: var(--ink); font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidenav { flex: 0 0 220px; background: var(--card); border-right: 1px solid var(--line); padding: 16px 0; }
.sidenav a {
  display: block; position: relative; height: 44px; line-height: 44px; padding: 0 24px;
  color: var(--ink); font-size: 14px;
}
.sidenav a:hover { background: rgba(185,90,60,.06); color: var(--accent); text-decoration: none; }
.sidenav a.active { background: var(--soft-red); color: var(--primary); font-weight: 600; }
.sidenav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--primary); border-radius: 0 2px 2px 0;
}
.content { flex: 1 1 auto; min-width: 0; padding: 24px; }
.content-inner { max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 600; }

/* ---- 栅格 ---- */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-wide { grid-column: 1 / -1; }   /* 在任意栅格里独占一整行 */
.table-wrap { overflow-x: auto; }

/* ---- 工具条（区间选择等，贴在它作用的那一行上方） ---- */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 8px 0 12px; }
.toolbar-label { font-size: 13px; color: var(--muted); }
.toolbar-note { font-size: 12px; color: var(--muted); }

/* ---- 图表（手写 SVG） ---- */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .line-new { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .line-closed { fill: none; stroke: var(--green); stroke-width: 2; }
.chart .dot-new { fill: var(--accent); }
.chart .dot-closed { fill: var(--green); }
.chart .bar { fill: var(--gold); }
.chart .bar-track { fill: var(--soft-gold); }
.chart .bar-label { fill: var(--ink); font-size: 12px; }
.chart .bar-value { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---- 周报卡 ---- */
.weekly-period { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.weekly-summary { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.7; }
.card-link { display: inline-block; margin-top: 12px; font-size: 13px; }
.weekly-card { cursor: pointer; }
.weekly-card:hover { border-color: var(--gold); }
.weekly-card:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185,90,60,.15); }

/* ---- 登录页 ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px 24px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 24px; text-align: center; }
.login-brand img { width: 64px; height: 64px; border-radius: 12px; }
.login-brand .brand-hosp { margin-top: 6px; }
.login-brand .brand-name { font-size: 20px; }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---- 投诉列表 ---- */
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.filter-bar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item select { min-width: 120px; }
.filter-item input[type=search] { width: 220px; }
.filter-range { display: inline-flex; align-items: center; gap: 6px; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }
.card-flush { padding: 0; overflow: hidden; }
.table-list td { vertical-align: middle; }
/* Chrome 87 自动表格布局忽略单元格的 max-width：摘要 div 绝对定位不撑列宽，摘要列 width:100% 吃掉其余列剩下的宽度；
   区域/类型也收进定宽 div 省略。1280 / 1366 宽下表格不再横向滚动。 */
.td-summary { position: relative; width: 100%; min-width: 140px; }
.cell-summary { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-clip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.wait-hot { color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
select.select-sm { height: 30px; padding: 0 8px; font-size: 13px; max-width: 140px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; font-size: 13px; }

/* ---- 投诉详情 ---- */
.head-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back-link { font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.detail-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kv { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv-label { font-size: 12px; color: var(--muted); }
.kv-value { white-space: pre-wrap; word-break: break-word; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.thumbs a { display: block; line-height: 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--soft-gold); }
.prio-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--line); }
.prio-high { background: var(--primary); }
.prio-mid { background: var(--gold); }
.prio-low { background: var(--green); }
.timeline { display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.msg { display: flex; flex-direction: column; }
.msg-patient { align-items: flex-start; }
.msg-hospital { align-items: flex-end; }
.msg .bubble-patient, .msg .bubble-hospital { align-self: auto; }
.msg .thumbs { white-space: normal; }
.composer textarea { width: 100%; min-height: 140px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.composer-foot .composer-actions { margin-top: 0; }
.counter.over { color: var(--primary); font-weight: 600; }
.sig-note { margin-left: 10px; }
.banner { background: var(--soft-red); color: var(--primary); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.banner-lock { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.banner-lock .btn { flex: 0 0 auto; }
.sig-preview { white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.banner-weak { background: var(--soft-gold); color: var(--ink); }
.banner-lock.banner-weak { font-weight: 400; }   /* 过期提醒是弱提示：不加粗 */
.composer textarea.is-locked { background: var(--bg); color: var(--muted); }
/* Chrome 87 的 outline 不跟随圆角：用两层 box-shadow 画出间隔 + 圆角描边 */
.bubble-new { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(178, 58, 46, .45); }
.denied-draft { display: block; width: 100%; resize: vertical; color: var(--ink); text-align: left; white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0 12px; font: inherit; font-size: 13px; max-height: 240px; overflow-y: auto; }
.polish { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.polish-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.polish-text { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-height: 80px; margin-top: 4px; }
.polish-cols > div:last-child .polish-text { background: var(--soft-gold); }
.assign-row { display: flex; gap: 8px; }
.assign-row select { flex: 1 1 auto; min-width: 0; }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.side-actions .assign-row { flex: 1 1 100%; }
.notes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.note { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.note-meta { font-size: 12px; color: var(--muted); }
.note-text { white-space: pre-wrap; word-break: break-word; }
#app .notes + textarea { width: 100%; min-height: 72px; }
.audit summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.audit-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; max-height: 320px; overflow-y: auto; }
.audit-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.audit-action { color: var(--ink); }

/* ---- 窄屏 ---- */
/* 三栏（≥1280）时中栏还要让出 220 导航 + 48 内边距，1280–1499 中栏只剩 ~340–550px：润色对照改单列 */
@media (min-width: 1280px) and (max-width: 1499px) {
  .polish-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1499px) {
  .cell-clip { max-width: 84px; }
  select.select-sm { max-width: 112px; }
}
@media (max-width: 1279px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .detail-left { grid-row: 1 / span 2; }
  .detail-right { grid-column: 2; }
}
@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-wide, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-left { grid-row: auto; }
  .detail-right { grid-column: auto; }
  .polish-cols { grid-template-columns: minmax(0, 1fr); }
  .sidenav { flex-basis: 160px; }
  .brand-hosp, .brand-sep { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .shell { flex-direction: column; }
  .sidenav { flex-basis: auto; display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav a { padding: 0 16px; white-space: nowrap; }
  .content { padding: 16px; }
  .card { padding: 16px; }
  .btn { height: 44px; }
  .toast-wrap { top: auto; bottom: 24px; right: 16px; left: 16px; align-items: center; }
}

/* ---- 管理页（用户 / 设置 / 报表 / 状态，Task 14） ---- */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.td-actions { white-space: nowrap; }
.me-tag { color: var(--muted); font-size: 12px; margin-left: 4px; }
.badge-off { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
/* 管理页语义徽标（不借投诉状态的 pending/open/closed；管理员不用红色，红色只留给告警） */
.badge-role-admin { background: var(--soft-gold); color: var(--ink); font-weight: 600; }
.badge-role-handler { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--muted); }   /* 与 .badge-off（bg 底 + line 描边）区分 */
.badge-on { background: var(--soft-green); color: var(--green); }
.badge-warn { background: var(--soft-red); color: var(--primary); }
.form-ok { color: var(--green); font-size: 13px; min-height: 20px; }
.form-hint { color: var(--muted); font-size: 12px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.check-row { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; cursor: pointer; }
.form-grid .check-row { justify-self: start; }   /* 网格项会被块化：靠 justify-self 让可点区域只包住框和字 */
/* 复选框手绘（Chrome 87 不认给原生复选框换色的属性，原生勾选是蓝色） */
.check-row input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 16px; height: 16px; margin: 0; cursor: pointer;
  border: 1px solid var(--muted); border-radius: 4px; background-color: var(--card);
  background-repeat: no-repeat; background-position: center; background-size: 12px 12px;
}
.check-row input[type=checkbox]:checked {
  background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check-row input[type=checkbox]:hover, .check-row:hover input[type=checkbox] { border-color: var(--accent); }   /* 悬停文字也算 */
.check-row input[type=checkbox]:focus { outline: none; }
.check-row input[type=checkbox]:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185,90,60,.15); }
.check-row input[type=checkbox]:checked:hover, .check-row:hover input[type=checkbox]:checked,
.check-row input[type=checkbox]:checked:focus-visible { border-color: var(--primary); }
/* 只读框：特异度要压过上面 input:not(checkbox):not(radio) 的底色与聚焦光圈 */
input[readonly]:not([type=checkbox]):not([type=radio]) { background: var(--bg); color: var(--muted); }
input[readonly]:not([type=checkbox]):not([type=radio]):focus { box-shadow: none; border-color: var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.card-foot .card-msg { flex: 1 1 100%; word-break: break-word; }
/* 抽屉（新建用户）：右侧滑出，遮罩同 .modal-mask */
.drawer-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(59,47,37,.45); z-index: 60; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100%; background: var(--card);
  box-shadow: var(--shadow); display: flex; flex-direction: column; animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 20px 24px 12px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1 1 auto; overflow: auto; padding: 20px 24px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; border-top: 1px solid var(--line); }
/* 报表 */
.report-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.report-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 220px); overflow: auto; }
.report-item {
  display: block; width: 100%; text-align: left; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; cursor: pointer; border-left: 3px solid transparent;
}
.report-item:hover { background: rgba(185,90,60,.06); }
/* 列表和分段按钮的容器 overflow 会裁掉外描边：聚焦用内描边 */
.report-item:focus, .seg button:focus { outline: none; }
.report-item:focus-visible, .seg button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.report-item.on { background: var(--soft-red); border-left-color: var(--primary); }
.report-item-title { font-weight: 600; font-variant-numeric: tabular-nums; }
.report-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.report-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section-label { font-size: 13px; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; line-height: 22px; background: var(--soft-gold); color: var(--ink); }
.plain-list { margin: 0; padding-left: 22px; line-height: 1.8; }
.md { line-height: 1.75; word-break: break-word; }
.md h1, .md h2, .md h3 { margin: 16px 0 8px; }
.md h1 { font-size: 18px; }
.md h2 { font-size: 16px; color: var(--ink); padding-bottom: 4px; border-bottom: 2px solid var(--gold); }
.md h3 { font-size: 15px; color: var(--muted); }
.md p { margin: 0 0 10px; }
.md strong { font-weight: 600; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--gold); background: var(--soft-gold); color: var(--ink); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md code { font-family: Consolas, monospace; background: var(--soft-gold); padding: 0 4px; border-radius: 4px; font-size: 13px; }
/* 状态 */
.progress { height: 8px; border-radius: 999px; background: var(--soft-gold); overflow: hidden; margin: 6px 0 2px; }
.progress-bar { height: 100%; background: var(--gold); }
.id-list { font-size: 12px; font-variant-numeric: tabular-nums; word-break: break-all; }
.stat-row { display: flex; gap: 32px; margin-bottom: 12px; }
.text-ok { color: var(--green); }
.text-bad { color: var(--primary); }
@media (max-width: 1023px) {
  .report-layout, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .report-list { max-height: 320px; }
}
