/* 授权中心管理台样式（服务端渲染，无构建步骤）。
 *
 * 设计语言「台账」：冷石灰纸底、细横线、等宽数字，单一强调色 verdigris。
 * 状态用「小方块 + 文字」，不用彩色药丸；面板不用阴影，只靠发丝线分层。
 * 移动端：平板宽度导航收进吸顶条；手机（< 720px）导航移到屏幕底部的固定标签条，
 * 顶部只留品牌与退出；数据表在 720px 以下折成「标签 / 值」的记录块。
 */

/* ---------- 设计 token ---------- */
:root {
  color-scheme: light;

  --paper: #f2f3ef;
  --surface: #fdfdfb;
  --surface-2: #f7f8f4;
  --ink: #161c1a;
  --ink-soft: #333d3a;
  --muted: #5c6763;
  --line: #dfe3da;
  --line-strong: #c8cec4;

  --accent: #0f5549;
  --accent-deep: #0a3d35;
  --accent-tint: #e7efeb;

  --ok: #1c6b4a;
  --warn: #8a5a12;
  --bad: #9a2f26;

  --radius: 6px;
  --radius-sm: 3px;
  --rail: 214px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: Georgia, "Iowan Old Style", "Source Han Serif SC", "Songti SC",
    "Noto Serif SC", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas,
    "Liberation Mono", monospace;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.62 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

a { color: inherit; }

code, .mono, .num, time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

code {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 5px;
  word-break: break-all;
}

.muted { color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus { left: 12px; top: 10px; }

/* ---------- 外壳：左侧导航 ---------- */
.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--rail);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 22px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
  text-decoration: none;
  color: var(--ink);
}

.brand .mark { width: 23px; height: 23px; flex: none; color: var(--accent); }
.brand b { display: block; font-size: 15px; font-weight: 600; letter-spacing: .03em; line-height: 1.2; }
.brand small {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--muted);
}

.rail-nav { display: flex; flex-direction: column; gap: 1px; margin-top: 28px; }

.rail-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}

.rail-nav a:hover { background: var(--surface-2); }

.rail-nav a.on {
  border-left-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-weight: 600;
}

.rail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.main { margin-left: var(--rail); padding: 34px 40px 72px; }
.page { max-width: 1120px; margin: 0 auto; }

/* ---------- 页头 ---------- */
.page-head {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

/* 没有说明文字时页头收紧，别留一大截空白 */
.page-head:not(:has(.lead)) { margin-bottom: 16px; padding-bottom: 12px; }

.page-head h1 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -.005em;
}

.page-head .lead {
  max-width: 66ch;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.crumbs { margin: 0 0 8px; font-size: 12.5px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------- 指标读数条 ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 0 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.metric {
  display: block;
  padding: 14px 18px 15px;
  border-left: 1px solid var(--line);
  text-decoration: none;
  transition: background .12s ease;
}

.metric:first-child { border-left: 0; }
a.metric:hover { background: var(--surface-2); }

.metric .k {
  display: block;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--muted);
}

.metric .v {
  display: block;
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric.hot .v { color: var(--accent); }

/* ---------- 面板 ---------- */
.panel {
  margin: 0 0 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.panel-head .more { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.panel-head .more:hover { color: var(--accent); }

.panel-body { padding: 16px 18px; }

.panel-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.machine-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.machine-name .id { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- 标签组（范围 / 操作 / key） ---------- */
/* 必须是一个容器包住多个 code：手机上的 stack 表格把 td 变成 flex，
   裸的 code 会各自成为被压缩的 flex item，一个字一行。 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}

.chips code {
  /* 单个名字很长时在容器边缘折行，而不是把整组挤成一列 */
  word-break: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* ---------- 键值网格 ---------- */
.kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.kv > div { padding: 12px 18px; border-top: 1px solid var(--line); }
.kv > div:nth-child(-n+3) { border-top: 0; }
.kv .wide { grid-column: span 2; }
.kv .full { grid-column: 1 / -1; }
.kv dt { font-size: 11.5px; letter-spacing: .06em; color: var(--muted); }
.kv dd { margin: 3px 0 0; font-size: 13px; word-break: break-all; }
.kv .fp { font-size: 12px; color: var(--ink-soft); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

.tbl thead th {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
}

.tbl tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; }
.tbl .act { text-align: right; white-space: nowrap; }

.sub { margin-top: 2px; color: var(--muted); font-size: 12px; }

/* 危险操作的确认页按钮行 */
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* ---------- 分页页脚 ---------- */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.pg {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  text-decoration: none;
  transition: border-color .12s ease, background .12s ease;
}

.pg:hover { border-color: #aeb6a9; }
.pg.off { border-color: var(--line); background: transparent; color: #a9b1ab; }

.pg-n {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.pg-n b { color: var(--ink); font-weight: 600; }

/* ---------- 记录列表（申请单等可操作条目） ---------- */
.recs { margin: 0; padding: 0; list-style: none; }

.rec {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.rec:last-child { border-bottom: 0; }
.rec:hover { background: var(--surface-2); }

.rec-main { flex: 1; min-width: 0; }

.rec-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-title .id { font-size: 12.5px; }

.rec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.rec-meta b { color: var(--ink-soft); font-weight: 500; }
.rec-side { display: flex; flex: none; align-items: center; gap: 8px; }

/* ---------- 状态 / 记号 ---------- */
.st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.st::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.st-ok { color: var(--ok); }
.st-warn { color: var(--warn); }
.st-bad { color: var(--bad); }
.st-mute { color: var(--muted); }

.kind,
.lvl {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 18px;
}

.lvl { font-family: var(--font-mono); }
.lvl-L0 { border-color: #b9d2c6; background: var(--accent-tint); color: var(--accent-deep); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.btn:hover { border-color: #aeb6a9; background: var(--surface-2); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #f6faf7; }
.btn.primary:hover { border-color: var(--accent-deep); background: var(--accent-deep); }
.btn.danger { border-color: #dcc3bf; background: transparent; color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: #fbf1ef; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { border-color: var(--line); background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { display: flex; align-items: center; justify-content: center; width: 100%; padding: 13px 18px; font-size: 15px; font-weight: 600; }

form.inline { display: inline; }

.field { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.field input {
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.field input::placeholder { color: #97a09a; }
.field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-tint); }

/* 审批决定：桌面内联，手机变成吸底操作条 */
.decision {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.decision .field { flex: 1 1 240px; }
.decision .actions { display: flex; flex: none; gap: 8px; margin-left: auto; }

/* ---------- 杂项 ---------- */
.empty { padding: 26px 18px; color: var(--muted); font-size: 13px; }
.empty a { color: var(--accent); }

.notice {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--warn);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12.5px;
}
.notice.bad { border-left-color: var(--bad); }
.notice code { background: transparent; border: 0; padding: 0; }
.notice-line { margin: 0 0 6px; }
.notice-line.last { margin-bottom: 0; }

pre.detail {
  margin: 0;
  padding: 14px 16px;
  max-height: 340px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

ul.lines { margin: 0; padding-left: 18px; }
ul.lines li { margin: 2px 0; font-size: 13px; }

details.panel > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chev { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
details.panel[open] > summary .chev::before { content: "收起"; }
details.panel:not([open]) > summary .chev::before { content: "展开"; }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
details.panel[open] > summary + .panel-body { border-top: 0; }

/* ---------- 登录页（独立页面，不套管理台外壳） ---------- */
.login-shell {
  display: grid;
  grid-template-columns: minmax(340px, .9fr) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 44px;
  padding: 38px 42px 30px;
  background-color: var(--accent-deep);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 27px,
    rgba(255, 255, 255, .045) 27px 28px
  );
  color: #e8f0eb;
}

.login-brand .brand { padding: 0; color: #f2f7f3; }
.login-brand .brand .mark { color: #a9c9bc; }
.login-brand .brand small { color: #97b5a9; }

.login-claim .claim-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 37px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .01em;
  color: #f4f8f4;
}

.login-steps { display: grid; gap: 0; max-width: 36ch; margin: 26px 0 0; padding: 0; list-style: none; }

.login-steps li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: #c3d5cb;
  font-size: 12.5px;
  line-height: 1.5;
}

.login-steps .n { font-family: var(--font-mono); font-size: 11px; color: #9dbdb0; padding-top: 1px; }
.login-steps b { display: inline; margin-right: 6px; color: #f0f6f1; font-weight: 600; font-size: 13px; }

.login-foot { margin: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: #8fb0a3; }

.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

.login-card { width: 100%; max-width: 392px; }
.login-card h1 { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin-bottom: 24px; }

/* ---------- 响应式 ---------- */

/* 侧栏 → 吸顶条 */
@media (max-width: 959px) {
  .rail {
    position: sticky;
    width: auto;
    height: auto;
    grid-template-columns: 1fr auto;
    grid-template-areas: "head foot" "nav nav";
    align-items: center;
    padding: 0;
    background: rgba(253, 253, 251, .95);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }

  .rail-head { grid-area: head; padding: 10px 16px; }
  .rail-foot { grid-area: foot; padding: 10px 16px 10px 0; border-top: 0; }
  .rail-foot .btn { min-height: 32px; }
  .who { display: none; }

  .rail-nav {
    grid-area: nav;
    flex-direction: row;
    gap: 0;
    margin: 0;
    padding: 0 8px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail-nav::-webkit-scrollbar { display: none; }

  .rail-nav a {
    padding: 9px 11px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    font-size: 13px;
  }
  .rail-nav a.on { border-bottom-color: var(--accent); background: transparent; }

  .main { margin-left: 0; padding: 22px 16px 72px; }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(odd) { border-left: 0; }
  .metric:last-child { grid-column: span 2; border-left: 0; }

  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv > div:nth-child(-n+3) { border-top: 1px solid var(--line); }
  .kv > div:nth-child(-n+2) { border-top: 0; }
  .kv .wide { grid-column: span 2; }
  .kv .full { grid-column: 1 / -1; }

  .page-head h1 { font-size: 23px; }
}

/* 数据表折成记录块 */
@media (max-width: 719px) {
  .tbl.stack thead { display: none; }
  .tbl.stack,
  .tbl.stack tbody,
  .tbl.stack tr,
  .tbl.stack td { display: block; width: 100%; }

  .tbl.stack tr { padding: 11px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack tr:hover { background: transparent; }

  .tbl.stack td {
    display: flex;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    line-height: 1.55;
  }

  .tbl.stack td::before {
    content: attr(data-label);
    flex: 0 0 76px;
    color: var(--muted);
    font-size: 11.5px;
    letter-spacing: .04em;
    padding-top: 1px;
  }

  .tbl.stack td.num { text-align: left; }
  .tbl.stack td.act { padding-top: 8px; text-align: left; }
  .tbl.stack td.act::before { content: none; }
  /* 手机上操作按钮做成整行、够高，避免误触旁边的信息 */
  .tbl.stack td.act .btn { min-height: 38px; padding: 6px 18px; }

  .tbl.stack td.code-cell::before { padding-top: 2px; }
  .tbl.stack td.code-cell code { flex: 1; }

  /* 标签组在 stack 表格里占满标签右侧的剩余宽度 */
  .tbl.stack td .chips { flex: 1 1 auto; }

  /* 分页：手机上按钮撑到 40px 高，页码数字缩一号 */
  .pager { padding: 10px 16px; }
  .pg { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 14px; font-size: 13px; }
  .pg-n { font-size: 11px; }

  /* 确认页：按钮竖排撑满，取消在上、危险操作在下（拇指更远，少误触） */
  .confirm-actions { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px; }
  .confirm-actions .btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }

  .rec { flex-wrap: wrap; padding: 12px 16px; }
  .rec-side { width: 100%; justify-content: flex-end; }
  .rec-side .btn { min-height: 36px; padding-left: 14px; padding-right: 14px; }

  /* 手机上放大点击目标 */
  .btn.sm { min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
  .panel-head .more { display: inline-block; padding: 5px 2px; line-height: 1.4; }
  .crumbs a { display: inline-block; padding: 6px 0; }

  .kv { grid-template-columns: 1fr; }
  .kv .wide { grid-column: auto; }
  .kv .full { grid-column: auto; }
  .kv > div:nth-child(n) { border-top: 1px solid var(--line); }
  .kv > div:first-child { border-top: 0; }

  .decision {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(253, 253, 251, .97);
    border-top: 1px solid var(--line-strong);
    backdrop-filter: blur(10px);
  }

  .decision .field { flex: 1 1 auto; }
  .decision .field span { flex: 0 0 64px; }
  .decision .field input { padding: 9px 10px; font-size: 14px; }

  .decision .actions { gap: 10px; margin-left: 0; }
  .decision .actions .btn { flex: 1; min-height: 46px; font-size: 14.5px; }

  /* 吸底操作条会压住内容，给正文留出足够的下边距 */
  body:has(.decision) .main { padding-bottom: 148px; }

  /* ---- 手机：导航落到屏幕底部，顶部只留品牌与退出 ---- */
  .rail {
    grid-template-columns: 1fr auto;
    grid-template-areas: "head foot";
    /* 注意：祖先上的 backdrop-filter 会给 fixed 后代造出包含块，
       这里必须去掉，否则底部标签条会贴在 .rail 上而不是视口底部。 */
    background: var(--surface);
    backdrop-filter: none;
  }

  .rail-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-strong);
    background: rgba(253, 253, 251, .97);
    backdrop-filter: blur(10px);
    overflow: visible;
  }

  .rail-nav a {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 48px;
    padding: 8px 2px;
    border: 0;
    border-radius: 0;
    box-shadow: inset 0 2px 0 transparent;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;
  }

  .rail-nav a:hover { background: transparent; }

  /* 当前页：标签上方一道 verdigris 细线，和桌面侧栏的左边线同一个记号 */
  .rail-nav a.on {
    border: 0;
    box-shadow: inset 0 2px 0 var(--accent);
    background: transparent;
    color: var(--accent-deep);
    font-weight: 600;
  }

  /* 底部标签条会压住正文 */
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* 审批页优先展示审批操作条：收起底部导航，操作条独占底部 */
  body:has(.decision) .rail-nav { display: none; }
  body:has(.decision) .main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* 登录页堆叠 */
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }

  .login-brand {
    gap: 22px;
    padding: 22px 22px 20px;
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0 23px,
      rgba(255, 255, 255, .04) 23px 24px
    );
  }

  .login-claim .claim-title { font-size: 24px; }
  .login-steps { display: none; }
  .login-foot { display: none; }

  .login-main { align-items: flex-start; padding: 26px 22px 48px; }
  .login-card { max-width: 480px; margin: 0 auto; }
}

@media (max-width: 400px) {
  .main { padding: 18px 12px calc(80px + env(safe-area-inset-bottom)); }
  .panel-head, .panel-body, .panel-foot { padding-left: 14px; padding-right: 14px; }
  .kv > div { padding-left: 14px; padding-right: 14px; }
  .metrics { grid-template-columns: 1fr; }
  .metric:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .metric:first-child { border-top: 0; }
  .metric:last-child { grid-column: auto; }
}

@media (max-width: 359px) {
  /* 极窄屏（320px 级）：底部六个标签要挤进一行，缩一号字 */
  .rail-nav a { padding: 9px 0; font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
