/* ============================================================================
   视图层样式：登录/注册壳、页面级区块、数据分布条、导入简报、档案区块。
   与 tokens / desktop / mobile 三层配合，只负责「页面内容」的排布。
   ========================================================================== */

/* ------------------------------------------------------------ 启动占位 */
.boot { min-height: 100vh; display: grid; place-items: center; gap: var(--s-3); }
.boot-mark i {
  display: block; width: 30px; height: 30px; border-radius: 3px; background: var(--accent);
  animation: bootpulse 1.1s var(--ease) infinite;
}
@keyframes bootpulse { 0%, 100% { opacity: .35; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }
.boot-text { font-size: var(--t-sm); color: var(--ink-3); }

/* ---------------------------------------------------- 登录 / 注册壳（auth） */
body[data-client="auth"] {
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--paper);
  background-blend-mode: normal;
}
body[data-client="auth"] .line-grid-mask { display: none; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s-5) var(--s-4); }
.auth-card {
  width: min(432px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: var(--s-5);
}
.auth-brand { display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-5); }
.auth-brand i { display: block; width: 30px; height: 30px; border-radius: 3px; background: var(--accent); position: relative; flex: none; }
.auth-brand i::after { content: ""; position: absolute; inset: 8px; border: 1.5px solid var(--accent-ink); border-radius: 1px; }
.auth-title { font-size: var(--t-lg); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.auth-sub { font-size: var(--t-xs); color: var(--ink-3); margin-top: 3px; letter-spacing: .02em; }
.auth-foot { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }
/* 2026-09-22：登录页的 `.demo-accounts`（预置账号表）已删除，相关样式一并移除。
   前端资产是公开可下载的，把口令写在这里等于公开 —— 别再往回加。 */

/* --------------------------------------------------------------- 页面区块 */
.view-head { margin-bottom: var(--s-4); }
.view-head h1 { font-size: var(--t-xl); letter-spacing: -.02em; }
.view-head .sub { color: var(--ink-3); font-size: var(--t-sm); margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-sm); color: var(--ink-2); text-decoration: none; margin-bottom: var(--s-3); }
.back-link:hover { color: var(--accent-deep); }

/* 标签切换（待建档 / 已建档） */
.tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--s-4); }
.tabs button {
  border: 0; border-right: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: var(--t-sm); font-weight: 600; padding: 7px var(--s-4); cursor: pointer;
}
.tabs button:last-child { border-right: 0; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------- 数据分布（横条） */
.dist { display: grid; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 112px 1fr 56px; align-items: center; gap: var(--s-3); font-size: var(--t-sm); }
.dist-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-track { height: 9px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.dist-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.dist-fill.is-ok { background: var(--ok); }
.dist-fill.is-warn { background: var(--warn); }
.dist-fill.is-danger { background: var(--danger); }
.dist-fill.is-info { background: var(--info); }
.dist-fill.is-muted { background: var(--ink-4); }
.dist-value { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dist-empty { font-size: var(--t-sm); color: var(--ink-3); }

/* --------------------------------------------------------------- 简报文本 */
.report {
  margin: 0; padding: var(--s-3); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); font-family: var(--font-mono); font-size: var(--t-xs); line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto;
}

/* ------------------------------------------------------------- 档案区块 */
.block-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s-4); }
.block { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.block-head {
  padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em; color: var(--ink-2); text-transform: uppercase;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.block-body { padding: var(--s-4); }
.block .kv { grid-template-columns: 88px 1fr; }

/* 证件材料 */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-item { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.doc-item:last-child { border-bottom: 0; }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: var(--t-xs); color: var(--ink-3); font-family: var(--font-mono); flex: none; }

/* ------------------------------------------------------------- 表格补充 */
table.data caption { caption-side: bottom; text-align: left; padding: var(--s-2) var(--s-3); font-size: var(--t-xs); color: var(--ink-3); }
table.data tfoot td { background: var(--surface-2); font-weight: 600; }
.cell-check { width: 34px; }
.cell-nowrap { white-space: nowrap; }
.cell-sub { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent-deep); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--accent); }
.row-danger td { background: color-mix(in oklab, var(--danger-soft) 60%, transparent); }
.row-warn td { background: color-mix(in oklab, var(--warn-soft) 55%, transparent); }
.row-muted td { color: var(--ink-3); }

/* 结果徽记（日志 result 列） */
.res-ok { color: var(--ok); font-weight: 600; }
.res-denied { color: var(--danger); font-weight: 600; }
.res-error { color: var(--warn); font-weight: 600; }

/* 变更前后对照（日志展开行） */
.diff { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--s-3); font-size: var(--t-xs); }
.diff dt { color: var(--ink-3); font-weight: 600; }
.diff dd { margin: 0; }
.diff .from { color: var(--ink-3); text-decoration: line-through; }
.diff .to { color: var(--ink); font-weight: 600; }
.diff-json { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: pre-wrap; word-break: break-word; }

/* 关键行强调：跨站求和、数据缺口 */
.hl { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; padding: 0 3px; border-radius: 2px; }

/* 空状态里的图标 */
.empty-mark { font-size: 26px; color: var(--ink-4); line-height: 1; margin-bottom: var(--s-2); }
.empty .btn { margin-top: var(--s-4); }

/* ------------------------------------------------------- 移动端补充 */
body[data-client="mobile"] .view-head h1 { font-size: var(--t-lg); }
body[data-client="mobile"] .metrics { grid-template-columns: repeat(2, 1fr); }
body[data-client="mobile"] .metric { border-bottom: 1px solid var(--line); }
body[data-client="mobile"] .metric:nth-child(2n) { border-right: 0; }
body[data-client="mobile"] .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); align-items: end; }
body[data-client="mobile"] .toolbar .field.grow { grid-column: 1 / -1; }
body[data-client="mobile"] .toolbar .field { min-width: 0; }
body[data-client="mobile"] .toolbar .btn { min-height: 46px; }
body[data-resp="1"] .toolbar { display: flex; flex-wrap: wrap; }
body[data-resp="1"] .metrics { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* 移动端卡片可点击的整体感 */
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .14s var(--ease), background .14s var(--ease); }
a.card:hover, a.card:active { background: var(--surface-2); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 移动端「说明条」 */
.note-strip {
  font-size: var(--t-xs); color: var(--ink-3); background: var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: var(--s-2) var(--s-3);
}

/* 表格里的小列表（跑单明细） */
.mini-table { width: 100%; border-collapse: collapse; font-size: var(--t-xs); }
.mini-table th, .mini-table td { padding: 5px var(--s-2); border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { color: var(--ink-3); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
.mini-table td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.scroll-y { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* 上传区 */
.upload-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.upload-row .field { margin-bottom: 0; }
input[type="file"] { font-size: var(--t-sm); padding: 5px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); width: 100%; }

/* 进度/加载行 */
.loading-row { padding: var(--s-6); text-align: center; color: var(--ink-3); font-size: var(--t-sm); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2);
  border-top-color: var(--accent); display: inline-block; vertical-align: -3px; margin-right: 6px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spinner { border-top-color: currentColor; border-color: color-mix(in oklab, currentColor 30%, transparent); border-top-color: currentColor; }

/* 站点多选（分配站长 / 分配站点） */
.picklist { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-2); }
.picklist label { display: flex; align-items: center; gap: var(--s-2); padding: 5px var(--s-2); border-radius: var(--radius); font-size: var(--t-sm); cursor: pointer; }
.picklist label:hover { background: var(--surface-2); }
.picklist .pick-meta { margin-left: auto; font-size: var(--t-xs); color: var(--ink-3); font-family: var(--font-mono); }

/* 概览页双栏 */
.overview-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s-4); }

/* 打印（人事导出用） */
@media print {
  .sidebar, .tabbar, .topbar, .bottom-action, .page-actions, #toast-root { display: none !important; }
  body[data-client="desktop"] .shell { grid-template-columns: 1fr; }
  .view { padding: 0; }
  .panel, .table-wrap { border-color: #999; box-shadow: none; }
}
