* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 14px; color: #1f2937; background: #f3f5f8; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { background: #1e293b; color: #fff; display: flex; align-items: center; padding: 0 20px; height: 52px; gap: 28px; }
.topbar .brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #cbd5e1; padding: 8px 14px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: #334155; color: #fff; text-decoration: none; }
.topbar .user { color: #cbd5e1; font-size: 13px; white-space: nowrap; }
.topbar .user a { color: #93c5fd; margin-left: 12px; }
main { max-width: 1180px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: #6b7280; margin: 0 0 20px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.card h2 { font-size: 16px; margin: 0 0 14px; }
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.row > .card { flex: 1; min-width: 300px; }
.btn { display: inline-block; border: 1px solid #d1d5db; background: #fff; color: #1f2937; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: #b91c1c; border-color: #fca5a5; }
.btn.sm { padding: 3px 10px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
label.f { display: block; font-weight: 500; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=month], input[type=number], select { border: 1px solid #d1d5db; border-radius: 6px; padding: 7px 10px; font-size: 14px; min-width: 220px; background: #fff; }
.hint { color: #6b7280; font-size: 12px; margin-top: 4px; }
.err-text { color: #b91c1c; font-size: 12px; margin-top: 4px; }
input.err { border-color: #ef4444; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 28px; text-align: center; color: #6b7280; background: #f9fafb; cursor: pointer; }
.dropzone b { color: #1f2937; }
.dropzone.picked { border-color: #2563eb; background: #eff6ff; color: #1e3a8a; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
th { background: #f9fafb; color: #4b5563; font-weight: 500; font-size: 13px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.muted td { color: #9ca3af; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.run { background: #dbeafe; color: #1e40af; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.gray { background: #f3f4f6; color: #4b5563; }
.progress { background: #e5e7eb; border-radius: 6px; height: 10px; overflow: hidden; min-width: 120px; }
.progress > div { background: #3b82f6; height: 100%; }
.alert { border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; }
.alert.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert.bad { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.alert.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; min-width: 140px; }
.stat .n { font-size: 22px; font-weight: 600; }
.stat .l { color: #6b7280; font-size: 12px; }
.stat.bad .n { color: #b91c1c; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid #d1d5db; border-radius: 14px; padding: 3px 12px; font-size: 13px; background: #fff; cursor: pointer; color: #374151; }
.chip.on { background: #1e293b; border-color: #1e293b; color: #fff; }
.problem { margin: 2px 0; }
.problem .tag { margin-right: 6px; }
.problem span.d { color: #4b5563; font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.pager { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 12px; color: #6b7280; font-size: 13px; }
.pager a, .pager span.cur { border: 1px solid #d1d5db; border-radius: 4px; padding: 2px 9px; color: #374151; background: #fff; }
.pager span.cur { background: #1e293b; color: #fff; border-color: #1e293b; }
.empty { text-align: center; padding: 48px 20px; color: #6b7280; }
.empty .ico { font-size: 36px; margin-bottom: 8px; }
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 24px; }
.meta div span { color: #6b7280; display: block; font-size: 12px; }
.breadcrumb { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; z-index: 10; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 460px; max-width: 92vw; padding: 22px; }
.modal h3 { margin: 0 0 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.login-wrap { min-height: calc(100vh - 32px); display: flex; align-items: center; justify-content: center; }
.login { width: 380px; background: #fff; border-radius: 10px; border: 1px solid #e5e7eb; padding: 30px; }
.login input { width: 100%; }
.sheet { overflow-x: auto; border: 1px solid #d1d5db; }
.sheet table { font-size: 13px; }
.sheet th, .sheet td { border: 1px solid #e5e7eb; padding: 5px 8px; white-space: nowrap; }
.sheet th.rn, .sheet td.rn { background: #f3f4f6; color: #6b7280; text-align: center; }
.sheet tr.hl td:not(.rn) { background: #fef3c7; }
.sheet td.hlc { background: #fecaca !important; }
.sheet td.note { color: #991b1b; white-space: normal; min-width: 320px; }
.radio-line { display: flex; gap: 18px; margin: 6px 0; }
.small { font-size: 12px; color: #6b7280; }

/* ---- 以下为实现补充（原型之外的交互状态、无障碍与窄屏） ---- */
.topbar .user { display: flex; align-items: center; }
.topbar .user .who { margin-right: 2px; }
button.linklike { background: none; border: 0; padding: 0; margin-left: 12px; color: #93c5fd; font: inherit; font-size: 13px; cursor: pointer; }
button.linklike:hover { text-decoration: underline; }
button.btn { font-family: inherit; }
.chip { font-family: inherit; }
.chip.zero { color: #9ca3af; }
.chip[aria-pressed="true"] { background: #1e293b; border-color: #1e293b; color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.dropzone.dragover { border-color: #2563eb; background: #eff6ff; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone { position: relative; }
.replace-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px; margin-top: 6px; }
.replace-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; margin-top: 6px; }
.replace-list label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; background: #fff; }
.replace-list label:hover { border-color: #d1d5db; }
.replace-list input:checked + span { color: #1e3a8a; font-weight: 500; }
.radio-line label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.loading { color: #9ca3af; padding: 24px; text-align: center; }
.table-wrap { overflow-x: auto; }
.mono { font-variant-numeric: tabular-nums; }
.modal label.f:first-of-type { margin-top: 10px; }
.modal input[type=text] { width: 100%; }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 20; min-width: 280px; max-width: 92vw; box-shadow: 0 6px 20px rgba(15,23,42,.15); }
code.pw { background: #fff; padding: 2px 6px; border: 1px solid #bbf7d0; font-size: 15px; letter-spacing: .5px; }
.compare-bad { color: #b91c1c; font-weight: 600; text-decoration: underline wavy #ef4444; }
.meta b { font-weight: 600; }
.pager button { border: 1px solid #d1d5db; border-radius: 4px; padding: 2px 9px; color: #374151; background: #fff; cursor: pointer; font: inherit; }
.pager button[disabled] { opacity: .45; cursor: default; }
.pager span.cur { border: 1px solid #1e293b; border-radius: 4px; padding: 2px 9px; }
.err-box { margin-top: 10px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footnote { margin-top: 24px; color: #9ca3af; font-size: 12px; text-align: center; }
@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px 16px; }
  .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .topbar nav a { padding: 6px 10px; white-space: nowrap; }
  .topbar .user { margin-left: auto; font-size: 12px; }
  main { padding: 0 12px; margin: 16px auto; }
  .card { padding: 14px; }
  .row > .card { min-width: 0; flex-basis: 100% !important; }
  input[type=text], input[type=password], select { min-width: 0; width: 100%; }
  .toolbar select, .toolbar input { flex: 1 1 140px; }
  /* 数据表格竖排成卡片，不再需要横向滚动；列名来自表头（common.js 写入 data-label） */
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .table-wrap tbody tr { border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 12px; margin-bottom: 10px; }
  .table-wrap td { position: relative; border: 0; padding: 5px 0 5px 100px; text-align: left; white-space: normal; overflow-wrap: anywhere; min-height: 28px; }
  .table-wrap td.num, .table-wrap td.nowrap { text-align: left; }
  .table-wrap td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 94px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #6b7280; font-size: 12px; font-weight: normal; line-height: 20px; }
  .table-wrap td[colspan] { padding-left: 0; }
  .table-wrap td[colspan]::before { content: none; }
  .table-wrap td:first-child { font-weight: 600; border-bottom: 1px solid #f3f4f6; padding-bottom: 7px; margin-bottom: 2px; }
  .table-wrap td[colspan]:first-child { font-weight: normal; border-bottom: 0; }
  .table-wrap td input[type=text] { width: 100%; }
  .radio-line { flex-direction: column; gap: 8px; }
  .head-actions { width: 100%; }
  .login { width: 92vw; padding: 22px; }
  .stat { min-width: 0; flex: 1; }
  h1 { font-size: 18px; }
}
[hidden] { display: none !important; }
td.nowrap, th.nowrap { white-space: nowrap; }
