/* ============ 全局变量 ============ */
:root {
  --primary: #2557e8;
  --primary-d: #1b43bd;
  --primary-w: #eef3ff;
  --ink: #111a2e;
  --ink2: #5b6572;
  --ink3: #8b95a5;
  --line: #e6ebf4;
  --line2: #dfe5f0;
  --bg: #f5f7fb;
  --ok: #16a34a;
  --danger: #e5484d;
  --sidebar-w: 236px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* 防止个别长文本把页面撑出横向滚动条 */
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ============ 整体布局：左侧栏 + 右主体 ============ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ============ 侧栏 ============ */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
}

.logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2f66f5, #1b43bd);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(37, 87, 232, .28);
}

.logo.lg { width: 48px; height: 48px; flex-basis: 48px; font-size: 23px; border-radius: 13px; }

.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt b { font-size: 15.5px; letter-spacing: .5px; }
.brand-txt small { font-size: 11px; color: var(--ink3); letter-spacing: 1.5px; }

.nav {
  flex: 1;
  padding: 6px 10px;
  overflow-y: auto;
}

.nav-label {
  margin: 8px 8px 8px;
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: 1.2px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: var(--ink2);
  font-size: 14px;
  transition: background .16s, color .16s;
}

.nav-item .ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-item:hover { background: #f3f6fd; color: var(--ink); }

/* 选中态：浅蓝底 + 左侧 3px 竖条，比整块深蓝更耐看 */
.nav-item.active {
  background: var(--primary-w);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.side-foot {
  padding: 14px 20px 18px;
  font-size: 11.5px;
  color: var(--ink3);
  border-top: 1px solid #f2f5fa;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .14);
}

/* ============ 主体 ============ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 60px;
  flex: 0 0 60px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
}

.menu-btn {
  display: none;
  border: 1px solid var(--line2);
  background: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  color: var(--ink2);
  cursor: pointer;
}

.crumb {
  font-size: 13px;
  color: var(--ink3);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.crumb i { font-style: normal; color: #c9d2e2; }
.crumb b { color: var(--ink); font-weight: 600; }

.user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.avatar {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  border-radius: 50%;
  background: var(--primary-w);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.uname { font-size: 13.5px; }

.urole {
  font-size: 11px;
  color: var(--ink3);
  background: #f4f6fa;
  border-radius: 999px;
  padding: 2px 8px;
}

.logout {
  font-size: 12.5px;
  color: var(--ink3);
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.logout:hover { color: var(--danger); }

.content {
  padding: 24px 28px 40px;
  max-width: 1460px;
  width: 100%;
}

/* ============ 页头 ============ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .3px;
}

.page-head p {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.7;
}

.tag-ghost {
  font-size: 11.5px;
  color: var(--ink3);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}

/* ============ 提示条 ============ */
.notice {
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--primary-w);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12.8px;
  color: #33456b;
  line-height: 1.7;
}

.notice-ico {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  display: grid;
  place-items: center;
}

/* ============ 指标卡（总览看板） ============ */
.metrics {
  margin-top: 18px;
  display: grid;
  /* 8 个指标，4 列正好两行；窄屏由下面的断点降列 */
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 16px 14px;
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s;
}

.metric:hover {
  border-color: #cfdcfe;
  box-shadow: 0 8px 22px rgba(37, 87, 232, .07);
}

/* 顶部 3px 色条区分指标类型：蓝=库存、橙=出库、绿=入库、紫=周转、青=占用、红=风险 */
.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}
.metric.m-in::before { background: var(--ok); }
.metric.m-out::before { background: #f59e0b; }
.metric.m-turn::before { background: #6366f1; }
.metric.m-occ::before { background: #0ea5e9; }
.metric.m-risk::before { background: var(--danger); }

.m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.m-name {
  font-size: 12.5px;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-unit {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink3);
}

.m-num {
  margin-top: 9px;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.4px;
  color: var(--ink);
  /* 等宽数字，五个卡片的数字竖直方向能对齐 */
  font-variant-numeric: tabular-nums;
}

.m-foot {
  /* margin-top:auto 让五张卡的脚注都贴底，卡片等高时看着才齐 */
  margin-top: auto;
  padding-top: 7px;
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.55;
}

.m-foot span { display: block; }

/* 有风险时把数字标红，一眼能看到；没风险保持默认颜色 */
.m-num.is-danger { color: var(--danger); }

/* ============ 风险明细（看板下方） ============ */
.risk-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid #e2e8f4;
  border-radius: 10px;
  padding: 11px 14px;
}

/* 左边这道色条 + 极浅底色，让"严重"和"关注"不用读字也能分出来 */
.risk-item.r-danger { border-left-color: var(--danger); background: #fff9f9; }
.risk-item.r-warn { border-left-color: #f59e0b; background: #fffdf7; }
.risk-item.r-info { border-left-color: var(--primary); }

.risk-tag {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 11px;
  border-radius: 4px;
  padding: 2px 6px;
  background: #f1f4fa;
  color: var(--ink3);
}
.risk-item.r-danger .risk-tag { background: #fdecec; color: #c0353a; }
.risk-item.r-warn .risk-tag { background: #fdf3e2; color: #a86a08; }

.risk-item b { font-size: 13px; font-weight: 600; }

/* 告警状态小标签：贴在标题后面，一眼分出"新冒出来的"和"挂了很久的" */
.alert-chip {
  margin-left: 7px;
  font-size: 11px;
  font-weight: 400;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  background: #f1f4fa;
  color: var(--ink3);
}
.alert-chip.a-new { background: #fdecec; color: #c0353a; }      /* 刚冒出来，要马上看 */
.alert-chip.a-again { background: #fdf3e2; color: #a86a08; }    /* 还在，已经提醒过 */
.alert-chip.a-acked { background: #eef7f0; color: #2f7a46; }    /* 人已确认 */
.alert-chip.a-pending { background: #f1f4fa; color: var(--ink3); }

/* 风险明细标题行：左边标题、右边告警统计 */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 28px;
}
/* 上边距由 .sec-head 统一给，避免标题和统计各加一份导致间距翻倍 */
.sec-head .sec-title { margin-top: 0; }
.alert-sum {
  font-size: 12px;
  color: var(--ink3);
}
.alert-none { color: #b06a10; }

.risk-item p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.65;
}

.sec-title {
  margin: 28px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
}

/* ============ 占位卡片网格 ============ */
.grid {
  margin-top: 16px;
  display: grid;
  /* 容器宽度自适应，不依赖窗口断点：宽屏多列、窄屏自动落成一列 */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.ph-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px 19px;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}

.ph-card:hover {
  border-color: #cfdcfe;
  box-shadow: 0 8px 22px rgba(37, 87, 232, .07);
  transform: translateY(-1px);
}

.ph-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ph-card h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}

.ph-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--ink3);
  background: #f5f7fb;
  border: 1px solid #edf1f7;
  border-radius: 999px;
  padding: 2px 8px;
}

.ph-card p {
  margin: 9px 0 0;
  font-size: 12.5px;
  color: var(--ink2);
  line-height: 1.78;
}

/* ============ 错误页 ============ */
.err-box {
  margin: 12vh auto 0;
  text-align: center;
  max-width: 420px;
}

.err-code {
  margin: 0;
  font-size: 64px;
  font-weight: 700;
  color: #dde5f5;
  letter-spacing: 2px;
}

.err-msg { margin: 6px 0 22px; font-size: 13.5px; color: var(--ink2); }

.btn-ghost {
  display: inline-block;
  font-size: 13px;
  color: var(--primary);
  border: 1px solid #cfdcfe;
  background: #fff;
  border-radius: 9px;
  padding: 9px 18px;
}
.btn-ghost:hover { background: var(--primary-w); }

/* ============ 登录页 ============ */
.login-body {
  background:
    radial-gradient(900px 500px at 15% 8%, rgba(90, 140, 255, .5), transparent 62%),
    radial-gradient(700px 500px at 88% 92%, rgba(24, 60, 160, .6), transparent 60%),
    linear-gradient(140deg, #24479f 0%, #16307f 55%, #0e1f52 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 384px;
  background: #fff;
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: 0 26px 70px rgba(6, 16, 46, .38);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .logo { margin: 0 auto 14px; }
.login-brand h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.login-brand p { margin: 8px 0 0; font-size: 12px; color: var(--ink3); }

.login-form label { display: block; margin-bottom: 14px; }
.login-form label span {
  display: block;
  font-size: 12.5px;
  color: var(--ink2);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  height: 43px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 87, 232, .13);
}

.login-err {
  margin: 2px 0 10px;
  font-size: 12.5px;
  color: var(--danger);
}

.login-ok {
  margin: 2px 0 10px;
  font-size: 12.5px;
  color: var(--ok);
}

.btn-primary {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  font-family: inherit;
  cursor: pointer;
  transition: background .16s;
}
.btn-primary:hover { background: var(--primary-d); }

.login-hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink3);
}

.login-hint code {
  background: #f4f6fa;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink2);
  font-size: 11px;
}

/* ============ 响应式：窄屏把侧栏收成抽屉 ============ */
@media (max-width: 1240px) {
  /* 4 列在中等屏幕上放不下，落成 3 列（8 个卡会排成 3+3+2） */
  .metrics { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 40px rgba(16, 30, 60, .16);
  }

  .menu-btn { display: block; }
  .topbar { padding: 0 14px; gap: 10px; }
  .content { padding: 18px 14px 32px; }
  .urole { display: none; }
  .page-head h1 { font-size: 19px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .m-num { font-size: 22px; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .uname { display: none; }
  /* 窄屏下这个标签与下方提示条信息重复，先让位给标题 */
  .tag-ghost { display: none; }
}

/* ============ 告警表：人工处理（确认 / 撤回 / 删除） ============ */
/* 操作回执：确认完给一句"已确认，不再提醒"，否则点完没反应会以为没生效 */
.flash-wrap { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  font-size: 13px;
  line-height: 1.55;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.f-ok { background: #eef7f0; border-color: #cfe8d8; color: #22683c; }
.flash.f-warn { background: #fdf7ec; border-color: #f2e0c2; color: #8a5a08; }

/* 三个视图切换：日常只看未关闭，查旧账才点已恢复 */
.alert-tabs { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.alert-tabs a {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink2);
  text-decoration: none;
}
.alert-tabs a.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 表格外层滚动：列多，窄屏横向滑动，别让页面整体撑出滚动条 */
.alert-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.alert-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 12.5px;
}
.alert-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink3);
  background: #f7f9fd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.alert-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid #f1f4fa;
}
.alert-table tr:last-child td { border-bottom: none; }
.alert-table b { font-weight: 600; color: var(--ink); }
.alert-table p { margin: 3px 0 0; color: var(--ink2); line-height: 1.6; }
.alert-table .ta-r { text-align: right; }
.alert-table .nowrap { white-space: nowrap; color: var(--ink2); }

/* 已恢复的整行压暗：翻旧账时一眼分清"过去的"和"还在的" */
.alert-table tr.at-closed b { color: var(--ink3); font-weight: 400; }

/* 表格里的等级标签：.risk-tag 原本只在风险列表里上色，这里单独给色 */
.alert-table .risk-tag.rt-danger { background: #fdecec; color: #c0353a; }
.alert-table .risk-tag.rt-warn { background: #fdf3e2; color: #a86a08; }
.alert-table .risk-tag.rt-info { background: var(--primary-w); color: var(--primary-d); }

/* 状态徽标 */
.st { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: #f1f4fa; color: var(--ink3); }
.st-open { background: #fdecec; color: #c0353a; }
.st-acked { background: #eef7f0; color: #2f7a46; }
.st-closed { background: #f1f4fa; color: #8b95a7; }
.st-by { margin-left: 4px; font-size: 11px; font-style: normal; color: var(--ink3); }

/* 操作按钮：一行三个也不换行 */
.ops { display: flex; gap: 6px; justify-content: flex-end; }
.ops form { margin: 0; }
.btn-mini {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line2);
  background: #fff;
  color: var(--ink2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-mini:hover { background: var(--primary-w); border-color: #c9d8ff; color: var(--primary-d); }
.btn-del { color: #c0353a; border-color: #f2d6d7; }
.btn-del:hover { background: #fdecec; border-color: #f0c3c5; color: #a52a2f; }
.ops-none { font-size: 12px; color: var(--ink3); }

/* 空表提示 */
.alert-empty {
  margin-top: 10px;
  padding: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink3);
  background: #fff;
  border: 1px dashed var(--line2);
  border-radius: var(--radius);
}
.alert-empty code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  background: #f1f4fa;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink2);
}

/* 手机宽度：首次发现/持续/推送 三列先让位，保证「操作」按钮在屏幕内 */
@media (max-width: 760px) {
  .alert-table { min-width: 0; }
  .alert-table th:nth-child(4), .alert-table td:nth-child(4),
  .alert-table th:nth-child(5), .alert-table td:nth-child(5),
  .alert-table th:nth-child(6), .alert-table td:nth-child(6) { display: none; }
  .alert-table td, .alert-table th { padding: 8px; }
}

/* ============ 设备台账（设备管理） ============ */
/* 汇总条：只强调"要处理几台"，正常多少台不占版面 */
.eq-sum { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.eq-sum .chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink2);
}
.eq-sum .chip b { color: var(--ink); font-weight: 600; }
.eq-sum .chip.c-warn { background: #fdf7ec; border-color: #f2e0c2; color: #8a5a08; }
.eq-sum .chip.c-warn b { color: #8a5a08; }

.ledger-wrap {
  margin-top: 12px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.ledger { width: 100%; min-width: 960px; border-collapse: collapse; font-size: 12.5px; }
.ledger th {
  padding: 9px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink3);
  background: #f7f9fd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ledger td {
  padding: 9px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f4fa;
  color: var(--ink2);
}
.ledger tr:last-child td { border-bottom: none; }
.ledger .eq-name { font-size: 13px; font-weight: 600; color: var(--ink); }
/* 编号用等宽字体：现场核对时一位一位照着念，等宽不容易串行 */
.ledger .eq-code {
  margin-top: 2px;
  font-family: Consolas, Monaco, monospace;
  font-size: 11.5px;
  color: var(--ink3);
}
.ledger .ta-r { text-align: right; }
.ledger .unit { font-size: 12px; color: var(--ink3); }

/* 日期/数字输入框做得紧凑些，别把表格撑太宽 */
.ledger input[type="date"],
.ledger input[type="number"] {
  font: inherit;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.ledger input[type="date"] { width: 132px; }
.ledger input[type="number"] { width: 58px; }
.ledger input:focus {
  outline: none;
  border-color: #a9c2ff;
  box-shadow: 0 0 0 2px var(--primary-w);
}

/* 到期状态标签：和看板风险同一套颜色语义 */
.due-tag {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f4fa;
  color: var(--ink3);
  white-space: nowrap;
}
.due-tag.d-danger { background: #fdecec; color: #c0353a; }
.due-tag.d-warn { background: #fdf3e2; color: #a86a08; }
.due-tag.d-ok { background: #eef7f0; color: #2f7a46; }

.eq-tip {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink3);
}
.eq-tip code {
  font-family: Consolas, Monaco, monospace;
  font-size: 11.5px;
  background: #f1f4fa;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink2);
}

/* 窗口不宽时（含侧栏占位的笔记本屏）：类别位置和责任人不是编辑项，先让位，
   否则 960px 的完整表会把「保存」挤到横向滚动条外面 */
@media (max-width: 1260px) {
  .ledger { min-width: 720px; }
  .ledger th:nth-child(2), .ledger td:nth-child(2),
  .ledger th:nth-child(3), .ledger td:nth-child(3) { display: none; }
  .ledger input[type="date"] { width: 118px; }
}

/* 台账里这三处一律不换行：设备名断成两行、日期断成两截、按钮竖排都很难看 */
.ledger .eq-name { white-space: nowrap; }
.ledger td:nth-child(6), .ledger td:nth-child(7) { white-space: nowrap; }
.ledger .btn-mini { white-space: nowrap; }
.ledger td:first-child, .ledger th:first-child { min-width: 112px; }

/* ============ 设备管理：模块内页签（台账 / 点检记录） ============ */
/* 两个页面共用一条页签，不靠侧栏再加二级菜单——设备这块就两页，不值得占侧栏 */
.mod-tabs {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;      /* 四个页签在窄屏上换行，别撑出横向滚动条 */
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.mod-tabs a {
  padding: 8px 14px 9px;
  margin-bottom: -1px;
  font-size: 13px;
  color: var(--ink2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.mod-tabs a:hover { color: var(--primary); }
.mod-tabs a.on {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ============ 点检记录 ============ */
/* 单条登记卡：现场是"一边看设备一边填"，字段必须一眼找得到，所以挤在一屏内 */
.chk-card {
  margin-top: 12px;
  padding: 14px 16px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chk-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink); }

.chk-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.chk-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chk-form label > span { font-size: 12px; color: var(--ink3); }
.chk-form .sp-2 { grid-column: span 2; }

/* 输入框统一高度：一行里日期框和下拉框高低不齐最显乱 */
.chk-form input,
.chk-form select,
.chk-filter input,
.chk-filter select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 7px;
}
.chk-form input:focus,
.chk-form select:focus,
.chk-filter input:focus,
.chk-filter select:focus {
  outline: none;
  border-color: #a9c2ff;
  box-shadow: 0 0 0 2px var(--primary-w);
}

.chk-submit { grid-column: span 2; display: flex; justify-content: flex-end; }
.btn-solid {
  height: 32px;
  padding: 0 20px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s;
}
.btn-solid:hover { background: var(--primary-d); }

.chk-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--ink3); }

/* 筛选 + 导入导出条：左筛选右批量，中间自动换行，窄屏上下堆 */
.chk-tools {
  margin-top: 12px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chk-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chk-filter input,
.chk-filter select { width: auto; height: 30px; font-size: 12px; }
.chk-filter input[type="date"] { width: 128px; }
.chk-filter select[name="code"] { max-width: 172px; }
.chk-sep { font-size: 12px; color: var(--ink3); }

.chk-io { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-line {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--primary);
  background: #fff;
  border: 1px solid #cfdcfe;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-line:hover { background: var(--primary-w); }
.btn-plain { font-size: 12px; color: var(--ink3); padding: 0 4px; white-space: nowrap; }
.btn-plain:hover { color: var(--primary); }

/* 导入控件：原生 file 输入框就够了，不套假按钮——现场电脑装什么浏览器都得能用 */
.chk-up { display: flex; align-items: center; gap: 6px; margin: 0; }
.chk-up input[type="file"] {
  font: inherit;
  font-size: 11.5px;
  max-width: 186px;
  color: var(--ink2);
}

/* 点检表：比台账多两列长文本，宽度单独定，别套台账的 960 */
.chk-table { min-width: 1080px; }
.chk-table .nowrap { white-space: nowrap; }
.chk-table td.chk-issue { max-width: 240px; white-space: normal; line-height: 1.55; }
.chk-table form { margin: 0; }

/* ≤1260px 时台账会藏掉第 2/3 列（类别、责任人），点检表不能跟着藏
   ——「设备」「点检人」是这张表的主干，藏了就没法看了。
   点检表让「备注」先让位：它是选填项，挤掉「操作」才是真麻烦 */
@media (max-width: 1260px) {
  .chk-table th:nth-child(2), .chk-table td:nth-child(2),
  .chk-table th:nth-child(3), .chk-table td:nth-child(3) { display: table-cell; }
  .chk-table th:nth-child(7), .chk-table td:nth-child(7) { display: none; }
  .chk-table { min-width: 780px; }
}

/* 窄屏：让「点检项目」「备注」先让位，保住日期-设备-结果-异常描述四列 */
@media (max-width: 900px) {
  .chk-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chk-table { min-width: 660px; }
  .chk-table th:nth-child(5), .chk-table td:nth-child(5),
  .chk-table th:nth-child(7), .chk-table td:nth-child(7) { display: none; }
  .chk-tools { padding: 10px; }
}

@media (max-width: 620px) {
  .chk-form { grid-template-columns: 1fr; }
  .chk-form .sp-2, .chk-submit { grid-column: span 1; }
  .chk-filter input[type="date"] { width: 118px; }
  .chk-up input[type="file"] { max-width: 150px; }
  /* 手机上「点检人」也先让位：日期 / 设备 / 结果 / 异常描述 + 删除 才是要看的 */
  .chk-table th:nth-child(3), .chk-table td:nth-child(3) { display: none; }
  .chk-table { min-width: 540px; }
}

/* ============ 单据识别（设备管理第三页） ============ */
.rec-card {
  margin-top: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rec-title {
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.rec-tip,
.rec-src { font-size: 11.5px; font-weight: 400; color: var(--ink3); }

.rec-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rec-upload input[type="file"] {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink2);
  max-width: 100%;
}
.rec-hint { margin: 8px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--ink3); }

/* 猜出来的身份信息（编号/名称/类别/匹配结果），一眼确认"这是哪台设备" */
.rec-found { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.rec-found .chip,
.rec-dates .chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink2);
}
.rec-found .chip b { color: var(--ink); font-weight: 600; }
.rec-found .chip.c-warn { background: #fdf7ec; border-color: #f2e0c2; color: #8a5a08; }
.rec-found .chip.c-warn b { color: #8a5a08; }

.rec-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: start;
}
.rec-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rec-field label { font-size: 12px; color: var(--ink3); }
.rec-form input,
.rec-form select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 8px;
}
.rec-form input:focus,
.rec-form select:focus {
  outline: none;
  border-color: #a9c2ff;
  box-shadow: 0 0 0 2px var(--primary-w);
}

/* 每个字段下面那行小字：值是从哪句抽的。绿=抽到了，灰=没抽到，橙=要人管 */
.rec-hit {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: #2f7a46;
  /* 长原文在这里折行；用 anywhere 而不是 break-all，免得把 EQ-001 从中间劈开 */
  overflow-wrap: anywhere;
}
.rec-hit.warn { color: #a86a08; }
.rec-hit.none { color: var(--ink3); }

.rec-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding-top: 2px;
}
.rec-note { font-size: 11.5px; color: var(--ink3); }

.rec-dates {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--ink3);
}

.rec-detail { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rec-detail summary { font-size: 12.5px; color: var(--primary); cursor: pointer; }
/* 原文用等宽字体：核对编号/日期时一位一位看，等宽不容易串行 */
.rec-text {
  margin: 10px 0 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.85;
  color: var(--ink2);
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .rec-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .rec-form { grid-template-columns: 1fr; }
  .rec-card { padding: 12px; }
}

/* 1050~1260px 这一档（笔记本 + 侧栏展开）点检表最容易溢出：
   把单元格内边距收窄到 8px，省下来的宽度刚好够「操作」列的删除按钮完整露出来 */
@media (max-width: 1260px) {
  .chk-table th, .chk-table td { padding-left: 8px; padding-right: 8px; }
  .chk-table { min-width: 700px; }
}

/* ============ 设备建档 ============ */
/* 用 <details> 折叠：不占版面、不依赖 JS，点开就是九个字段的一行行 */
.eq-new {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.eq-new > summary {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.eq-new > summary::-webkit-details-marker { display: none; }
.eq-new > summary:hover { background: var(--primary-w); border-radius: var(--radius); }
.eq-new[open] > summary {
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.eq-new-form { padding: 14px 16px 0; }
.eq-new .chk-hint { padding: 0 16px 14px; margin-top: 10px; }
/* 校验失败时按钮和「取消」并排，别让取消单独掉到下一行 */
.eq-new .chk-submit { gap: 10px; align-items: center; }

/* 行内两个按钮：保存 + 编辑，宽度不够也不竖排 */
.row-ops { display: flex; gap: 6px; justify-content: flex-end; }
.row-ops .btn-mini { text-decoration: none; display: inline-block; }

/* ============ 维修保养 ============ */
/* 表格底子借用 .ledger（表头底色、行线、等宽编号），这里只定列宽与让位顺序。
   九列比台账宽，窄屏靠"备件 → 承修 → 费用"依次让位，
   日期、设备、内容、状态、操作这五列始终保住。 */
.mt-table { min-width: 1020px; }
.mt-table td.nowrap { white-space: nowrap; }
.mt-table td.mt-items { max-width: 260px; white-space: normal; line-height: 1.55; }
.mt-table td.mt-parts,
.mt-table td.mt-vendor { max-width: 150px; }
.mt-table form { margin: 0; }

/* 类型标签：保养=绿（例行、正常），维修=橙（非计划、要留意） */
.mt-kind {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.mt-kind.k-maint { background: #eef7f0; color: #2f7a46; }
.mt-kind.k-fix { background: #fdf3e2; color: #a86a08; }

@media (max-width: 1260px) {
  .mt-table { min-width: 800px; }
  /* .ledger 在窄屏会藏掉第 2/3 列（台账那边是类别和责任人），
     维保表里这两列是「设备」和「类型」，必须显式恢复，否则一眼看不出是哪台设备 */
  .mt-table th:nth-child(2), .mt-table td:nth-child(2),
  .mt-table th:nth-child(3), .mt-table td:nth-child(3) { display: table-cell; }
  .mt-table th:nth-child(5), .mt-table td:nth-child(5),
  .mt-table th:nth-child(7), .mt-table td:nth-child(7) { display: none; }
  .mt-table th, .mt-table td { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 900px) {
  .mt-table { min-width: 620px; }
  .mt-table th:nth-child(6), .mt-table td:nth-child(6) { display: none; }
  .mt-table td.mt-items { max-width: 200px; }
}
@media (max-width: 620px) {
  .mt-table { min-width: 520px; }
  .mt-table th:nth-child(3), .mt-table td:nth-child(3) { display: none; }
  .mt-table th, .mt-table td { padding-left: 7px; padding-right: 7px; }
}

/* 「进行中」用琥珀色而不是红色：这不是危险，是"还没收尾"，红色会跟告警抢注意力 */
.st-doing { background: #fdf3e2; color: #a86a08; }

/* 窄屏下「进行中」被挤成两行（进行/中）很难看，状态标签一律不换行 */
.mt-table .st { white-space: nowrap; }

/* ============ 校准到期（设备管理第四页） ============ */
/* 汇总条里的数字本身就是筛选入口，所以是可点的 <a>：
   鼠标悬停给底色，"当前筛的就是它"用 on 描一圈蓝边 */
.eq-sum a.chip { text-decoration: none; transition: background .15s, border-color .15s; }
.eq-sum a.chip:hover { background: var(--primary-w); border-color: #c9d8ff; }
.eq-sum .chip.on { border-color: #a9c2ff; box-shadow: 0 0 0 2px var(--primary-w); color: var(--primary-d); }
.eq-sum .chip.c-danger { background: #fdecec; border-color: #f2d6d7; color: #c0353a; }
.eq-sum .chip.c-danger b { color: #c0353a; }

/* 校准状态表：八列，窄屏让「类别/位置」「最近证书」先走，
   设备、上次校准、周期、下次校准、状态、操作必须一直在——那是这张表的全部意义 */
.cal-table { min-width: 1060px; }
.cal-table td.cal-cert { max-width: 180px; }
.cal-table .due-tag { white-space: nowrap; }

/* 校准流水折叠区：和建档卡同一套外观，点开才占版面 */
.cal-hist {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cal-hist > summary {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.cal-hist > summary::-webkit-details-marker { display: none; }
.cal-hist > summary:hover { background: var(--primary-w); border-radius: var(--radius); }
.cal-hist[open] > summary { border-bottom: 1px solid var(--line); }
.cal-hist .cal-filter { padding: 12px 16px 0; }
.cal-hist .ledger-wrap { margin: 12px 16px 16px; }

.cal-hist-table { min-width: 900px; }
.cal-hist-table .nowrap { white-space: nowrap; }
.cal-hist-table td.cal-cert { max-width: 180px; }

@media (max-width: 1260px) {
  .cal-table { min-width: 760px; }
  /* 台账的通用规则会藏第 2/3 列，这里第 3 列是「上次校准」，不能藏 */
  .cal-table th:nth-child(3), .cal-table td:nth-child(3) { display: table-cell; }
  .cal-table th:nth-child(2), .cal-table td:nth-child(2),
  .cal-table th:nth-child(7), .cal-table td:nth-child(7) { display: none; }
  .cal-table th, .cal-table td { padding-left: 7px; padding-right: 7px; }

  .cal-hist-table { min-width: 700px; }
  .cal-hist-table th:nth-child(2), .cal-hist-table td:nth-child(2),
  .cal-hist-table th:nth-child(3), .cal-hist-table td:nth-child(3) { display: table-cell; }
  .cal-hist-table th:nth-child(5), .cal-hist-table td:nth-child(5),
  .cal-hist-table th:nth-child(8), .cal-hist-table td:nth-child(8) { display: none; }
}

@media (max-width: 900px) {
  .cal-table { min-width: 700px; }
  .cal-table th:nth-child(4), .cal-table td:nth-child(4) { display: none; }
  .cal-hist-table { min-width: 620px; }
  .cal-hist-table th:nth-child(7), .cal-hist-table td:nth-child(7) { display: none; }
}

@media (max-width: 620px) {
  .cal-table { min-width: 560px; }
  .cal-table th, .cal-table td { padding-left: 7px; padding-right: 7px; }
  .cal-table input[type="date"] { width: 112px; }
  .cal-hist .ledger-wrap { margin: 10px 10px 12px; }
}

/* ============ 备件库存（设备管理第五页） ============ */
/* 八列：备件 / 规格 / 库存 / 最低 / 状态 / 货位 / 单价·金额 / 操作。
   窄屏先让「规格」「货位」走——库存和最低库存是这一页的判断依据，不能藏。 */
.pt-table { min-width: 900px; }
.pt-table .pt-stock { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pt-table .due-tag { white-space: nowrap; }
.pt-table form { margin: 0; }

.pt-move-table { min-width: 860px; }
.pt-move-table .nowrap { white-space: nowrap; }
.pt-move-table td.pt-target { max-width: 200px; white-space: normal; line-height: 1.55; }
.pt-move-table form { margin: 0; }

@media (max-width: 1260px) {
  .pt-table { min-width: 640px; }
  /* 台账通用规则藏第 2/3 列，这里第 3 列是「库存」，必须留下 */
  .pt-table th:nth-child(3), .pt-table td:nth-child(3) { display: table-cell; }
  .pt-table th:nth-child(2), .pt-table td:nth-child(2),
  .pt-table th:nth-child(6), .pt-table td:nth-child(6) { display: none; }
  .pt-table th, .pt-table td { padding-left: 7px; padding-right: 7px; }

  .pt-move-table { min-width: 700px; }
  .pt-move-table th:nth-child(2), .pt-move-table td:nth-child(2),
  .pt-move-table th:nth-child(3), .pt-move-table td:nth-child(3) { display: table-cell; }
  .pt-move-table th:nth-child(7), .pt-move-table td:nth-child(7) { display: none; }
}

@media (max-width: 900px) {
  .pt-table { min-width: 560px; }
  .pt-table th:nth-child(7), .pt-table td:nth-child(7) { display: none; }
  .pt-move-table { min-width: 560px; }
  .pt-move-table th:nth-child(5), .pt-move-table td:nth-child(5) { display: none; }
}

@media (max-width: 620px) {
  .pt-table { min-width: 480px; }
  .pt-table th, .pt-table td { padding-left: 7px; padding-right: 7px; }
  .pt-table th:nth-child(4), .pt-table td:nth-child(4) { display: none; }
}

/* ============ 现场作业（入库 / 出库 / 移库 / 盘点 / 温湿度） ============ */
/* 首页两栏：左边库区结存、右边温湿度。1100px 以下自动叠成一栏 */
.ops-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  align-items: start;
}
.ops-grid > .chk-card { margin-bottom: 0; }
@media (max-width: 1100px) {
  .ops-grid { grid-template-columns: 1fr; }
}

.ops-sub { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--ink3); }
.ops-num { font-variant-numeric: tabular-nums; }
.ops-note { color: var(--ink2); max-width: 220px; white-space: normal; line-height: 1.55; }
.ops-arrow { white-space: nowrap; color: var(--ink2); }

/* 小表：首页的库区结存、温湿度、可出批次。信息密度高，用不着大字号 */
.ledger.ops-mini { min-width: 0; }
.ledger.ops-mini th, .ledger.ops-mini td { padding: 8px 10px; font-size: 12.5px; }

/* 作业表（入库 / 出库 / 移库）：日期 / 单号 / 客户名称 / 品类 / 品种 / 品名 /
   规格 / 库区 / 库位 / 批次 / 包数 / 实重 / 备注 / 操作，十四列。
   列多、而且字段还会加，所以每个单元格都挂了语义类（c-date / c-no / …），
   窄屏按类藏列。以前按 nth-child 藏，一加字段就整体错位，
   曾把「操作」按钮那一列整列藏掉——这种坑不想再踩第四次。 */
.ops-table { min-width: 1080px; }
/* 十四列，每列左右各 12px 的话光留白就吃掉三百多像素——收到 8px，
   表格正好能塞进 1440 屏的正文区，不用为了看备注去拖滚动条 */
.ops-table th, .ops-table td { padding-left: 8px; padding-right: 8px; }
/* 每列给一个宽度。不给的话浏览器会把"允许换行"的备注、客户名称压成一条缝，
   其它列却一个比一个宽——自动布局在列多的时候就是这么不讲道理。 */
/* 通用台账给首列留了 112px（设备名要两位一行），作业表首列是日期，
   10 个字符就够，省下的 24px 在 1000px 窗口上正好够用 */
.ops-table th:first-child, .ops-table td:first-child { min-width: 0; }
.ops-table th.c-date { width: 88px; }
.ops-table th.c-no { width: 106px; }
.ops-table th.c-owner { width: 146px; }
.ops-table th.c-cat { width: 50px; }
.ops-table th.c-var { width: 50px; }
.ops-table th.c-prod { width: 128px; }
.ops-table th.c-wh { width: 48px; }
.ops-table th.c-loc { width: 78px; }
.ops-table th.c-from { width: 76px; }
.ops-table th.c-to { width: 76px; }
.ops-table th.c-batch { width: 94px; }
.ops-table th.c-pkg { width: 50px; }
.ops-table th.c-qty { width: 74px; }
.ops-table th.c-spec { width: 74px; }
.ops-table th.c-note { width: 104px; }
.ops-table th.c-act { width: 58px; }
/* 除了客户名称和备注，一律不换行：品类「化肥」被折成两行、库位断成两截，
   看着比横向滚动还难受。不换行 + 表格自身撑宽，比硬压列宽诚实。 */
.ops-table th, .ops-table td { white-space: nowrap; }
.ops-table form { margin: 0; }
/* 客户名称、备注允许折行：一长串公司名能把整张表撑出屏幕。
   但只给 max-width 不够——中文没有空格，浏览器会把这两列压到一字一行，
   所以再给一个下限，宁可整体横向滚一点，也别把备注挤成豆腐块。 */
.ops-table td.c-owner, .ops-table td.c-note { white-space: normal; }
/* 「操作」列钉在右边：十四列本来就宽，滚动条一拖删除按钮就看不见了，
   钉住之后无论横向滚到哪都能点 */
.ops-table th.c-act, .ops-table td.c-act {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}
.ops-table th.c-act { background: #f7f9fd; }

/* 库位：库区下面一行小字，一眼知道货在哪个垛位 */
.ops-slot {
  display: block;
  margin-top: 2px;
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
  color: var(--ink3);
}
/* 移库原因：做成小标签，和备注区分开，不占一列。
   用 display: table 让它独占一行——写成 inline-block 的话，
   备注文字会挤在标签右边一个字符、剩下的掉到下一行，看着像个错字 */
.ops-tag {
  display: table;
  margin: 0 0 2px;
  padding: 1px 5px;
  font-size: 11px;
  border-radius: 4px;
  background: #f1f4fa;
  color: var(--ink3);
  white-space: nowrap;
}

/* 盘点表：实盘数是行内输入；diff 用红绿区分盘亏盘盈 */
.ops-count-table { min-width: 900px; }
.ops-fill { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.ops-fill input {
  width: 78px; padding: 4px 6px; font-size: 12.5px; text-align: right;
  border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink);
}
.ops-fill input:focus { outline: none; border-color: #a9c2ff; box-shadow: 0 0 0 2px var(--primary-w); }
.ops-diff { font-weight: 600; font-variant-numeric: tabular-nums; }
.ops-diff.plus { color: #1c7a4b; }
.ops-diff.minus { color: #c0353a; }

/* 温湿度表：超限整行淡黄底，扫一眼就知道哪条要处理 */
.ops-temp-table { min-width: 880px; }
.ops-temp-table tr.row-bad td { background: #fffaf0; }
.ops-temp-table tr.row-bad td:first-child { box-shadow: inset 3px 0 0 #e0a63a; }
.ops-temp-table .ops-why { font-size: 11.5px; color: #8a5a08; margin-left: 6px; }
.ops-temp-table th:nth-child(6), .ops-temp-table td:nth-child(6) { min-width: 210px; }

/* 首页的温湿度小结列：只放一个短标签，详细原因在温湿度页看 */
.ops-mini .due-tag { white-space: nowrap; }

/* 待盘状态的灰标签：不是错误，只是"还没轮到"，别用警示色 */
.due-tag.d-mute { background: #f2f4f7; border-color: #e2e6ee; color: var(--ink3); }

@media (max-width: 1260px) {
  /* 台账的通用规则会藏第 2/3 列，但这几张小结表总共就五六列，
     藏掉「批次」「结存」「温度」等于把表废掉——全部恢复，改成横向滚动 */
  .ledger.ops-mini th:nth-child(2), .ledger.ops-mini td:nth-child(2),
  .ledger.ops-mini th:nth-child(3), .ledger.ops-mini td:nth-child(3) {
    display: table-cell;
  }
  .ledger.ops-mini { min-width: 520px; }

  .ops-table { min-width: 760px; }
  /* 台账通用规则会藏第 2 / 3 列，那是「单号」和「客户名称」，必须留 */
  .ops-table th:nth-child(2), .ops-table td:nth-child(2),
  .ops-table th:nth-child(3), .ops-table td:nth-child(3) {
    display: table-cell;
  }
  .ops-table th, .ops-table td { padding-left: 8px; padding-right: 8px; }

  /* 1260 下正文区约 760px：入库 / 出库 / 移库先让出品类、品种、规格、备注，
     留下 日期 / 单号 / 客户 / 品名 / 库区 / 库位 / 批次 / 包数 / 实重 / 操作 */
  .ops-io-table, .ops-move-table { min-width: 820px; }
  .ops-io-table .c-cat, .ops-io-table .c-var,
  .ops-io-table .c-spec, .ops-io-table .c-note,
  .ops-move-table .c-cat, .ops-move-table .c-var,
  .ops-move-table .c-spec, .ops-move-table .c-note { display: none; }

  /* 1100px 下正文区只有约 575px：盘点表七列要压进这个宽度，
     否则「存」按钮和操作列会被推到屏幕外，反而要点横向滚动条才能用 */
  .ops-count-table { min-width: 560px; }
  /* 盘点表只有 8 列，第 8 列正是「操作」——上面按 9 列表写的隐藏规则会误伤它，
     这里显式恢复；第 3 列（货主）可以藏，对账不看货主 */
  .ops-count-table th:nth-child(8), .ops-count-table td:nth-child(8) {
    display: table-cell;
  }
  .ops-count-table th:nth-child(3), .ops-count-table td:nth-child(3) { display: none; }
  .ops-count-table th, .ops-count-table td { padding-left: 6px; padding-right: 6px; }
  .ops-count-table .ops-fill input { width: 62px; }

  .ops-temp-table { min-width: 700px; }
  /* 第 3 列是库区，藏了这张表就没意义 */
  .ops-temp-table th:nth-child(3), .ops-temp-table td:nth-child(3) {
    display: table-cell;
  }
  .ops-temp-table th:nth-child(8), .ops-temp-table td:nth-child(8) { display: none; }
}

/* 1000~1120 的窗口最尴尬：侧栏还占着位置，正文区只剩 700 上下，
   十四列怎么排都塞不下，先把库位、包数让出去，字号也收半号 */
@media (max-width: 1120px) {
  /* 上面 820 的 min-width 在这个档位反而成了负担：列已经少了，
     还硬撑 820 就会多出一截横向滚动条 */
  .ops-io-table, .ops-move-table { font-size: 11.5px; min-width: 0; }
  .ops-io-table .c-loc, .ops-io-table .c-pkg,
  .ops-move-table .c-pkg { display: none; }
  /* 移库比入库多一组库区（原 → 目标），这个档位再挤就把客户名称让出去：
     搬的是什么、从哪到哪、多少吨，比货主是谁更要紧。
     选择器要写到 th/td 上——上面那条 `.ops-table th:nth-child(3)` 恢复
     客户名称的规则权重更高，只写两个类会被它盖回去 */
  .ops-move-table th.c-owner, .ops-move-table td.c-owner { display: none; }
}

@media (max-width: 900px) {
  /* 再让一轮：库位、包数走，留下的都是对账离不开的
     日期 / 单号 / 客户 / 品名 / 库区（移库是原→目标）/ 批次 / 实重 / 操作 */
  .ops-io-table { min-width: 640px; }
  .ops-move-table { min-width: 680px; }
  .ops-io-table .c-loc, .ops-io-table .c-pkg,
  .ops-move-table .c-pkg { display: none; }

  .ops-count-table { min-width: 580px; }
  /* 第 7 列在九列表里是备注、在盘点表里是状态，状态必须留 */
  .ops-count-table th:nth-child(7), .ops-count-table td:nth-child(7) {
    display: table-cell;
  }
  .ops-temp-table { min-width: 560px; }
  .ops-temp-table th:nth-child(7), .ops-temp-table td:nth-child(7) { display: none; }
}

@media (max-width: 700px) {
  /* 600 出头这个宽度最先撑爆：客户名称先让位，实重和删除按钮不能挤没 */
  .ops-io-table th.c-owner, .ops-io-table td.c-owner { display: none; }
}

@media (max-width: 620px) {
  /* 手机上只留「什么货、在哪、多少、能不能删」：日期 / 单号 / 品名 /
     库区（移库是原→目标）/ 批次 / 实重 / 操作 */
  .ops-io-table { min-width: 540px; }
  .ops-move-table { min-width: 560px; }
  .ops-io-table th.c-owner, .ops-io-table td.c-owner,
  .ops-move-table th.c-owner, .ops-move-table td.c-owner { display: none; }
  .ops-table th, .ops-table td { padding-left: 6px; padding-right: 6px; }
  .ops-fill input { width: 66px; }
}

/* ============ 排班调度：人班 / 人时 / 方案 ============ */

.sched-card { margin-top: 12px; }
.sched-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sched-sub { margin: 4px 0 10px; font-size: 11.5px; color: var(--ink3); line-height: 1.6; }
.sched-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.sched-jump { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.sched-jump input {
  height: 30px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line2);
  border-radius: 7px;
}

/* 排班矩阵：人员 × 七天。首列钉住，横向滚动时人名不跟着跑 */
.sched-matrix { min-width: 940px; }
.sched-matrix th.c-name, .sched-matrix td.c-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 96px;
}
.sched-matrix thead th.c-name { background: #f7f9fc; }
.sched-matrix th.c-post, .sched-matrix td.c-post { width: 74px; }
.sched-matrix th.c-day, .sched-matrix td.c-day { width: 86px; text-align: center; }
.sched-matrix th.c-num, .sched-matrix td.c-num { width: 58px; text-align: right; }
.sched-matrix th.c-act, .sched-matrix td.c-act {
  width: 62px;
  text-align: right;
  /* 保存钉在右边：表格横向滚动时不用先拖到底才能存 */
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
}
.sched-matrix thead th.c-act { background: #f7f9fc; }
.sched-date { font-size: 10.5px; color: var(--ink3); font-weight: 400; }
.sched-name { font-size: 13px; font-weight: 600; color: var(--ink); }

/* 今天那一列淡蓝：一眼知道排在星期几 */
.sched-matrix .col-today { background: #f3f8ff; }

/* 一行一个表单，下拉做窄一点，七个才排得下 */
.sched-sel {
  width: 100%;
  height: 28px;
  padding: 0 2px;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 6px;
}
.sched-sel:focus { outline: none; border-color: #a9c2ff; box-shadow: 0 0 0 2px var(--primary-w); }
.sched-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11.5px;
  border-radius: 4px;
  background: var(--primary-w);
  color: var(--primary-d);
}
.sched-multi { margin-left: 2px; font-size: 10.5px; color: var(--danger); }

/* 排超上限标黄、离岗整行变灰：两种都不该出现在"正常"的排班里 */
.sched-matrix tr.row-over td { background: #fffaf0; }
.sched-matrix tr.row-over td.c-name { box-shadow: inset 3px 0 0 #e0a63a; }
.sched-matrix tr.row-off td { color: var(--ink3); }

.is-up { color: #c0353a; }
.is-down { color: #2f7a46; }

/* ---------- 方案分析 ---------- */
.sched-note {
  margin: 0 0 12px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.7;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--ink2);
}
.sched-note.is-warn { background: #fdf7ec; border-color: #f2e0c2; color: #8a5a08; }
.sched-note.is-ok { background: #f3faf5; border-color: #d6ecdc; color: #2f7a46; }

.sched-plan-table { min-width: 720px; }
.sched-plan-table th:nth-child(6), .sched-plan-table td:nth-child(6) { white-space: nowrap; }
.sched-plan-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.sched-plan-note { font-size: 11.5px; color: var(--ink3); }
.sched-plan-table tr.row-best td { background: #f6fbf8; }
.sched-plan-table tr.row-best td:first-child { box-shadow: inset 3px 0 0 var(--ok); }

.sched-gap { color: #c0353a; font-weight: 600; }
.sched-over { color: var(--ink2); }

/* ---------- 业务量与人力配置 ---------- */
.sched-workload {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.sched-workload label { display: flex; flex-direction: column; gap: 4px; }
.sched-workload label > span { font-size: 11.5px; color: var(--ink3); line-height: 1.5; }
.sched-workload input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--line2);
  border-radius: 7px;
}
.sched-workload input:focus { outline: none; border-color: #a9c2ff; box-shadow: 0 0 0 2px var(--primary-w); }
.sched-rate { width: 132px; }
.sched-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; flex: 1; min-width: 420px; }
.sched-days input { text-align: right; }
.sched-save { display: flex; justify-content: flex-end; }

.sched-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 12px; }
.sched-mini-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}
.sched-mini-name { display: block; font-size: 11.5px; color: var(--ink3); }
.sched-mini-card b {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sched-mini-unit { margin-left: 3px; font-size: 11px; color: var(--ink3); }

/* ---------- 缺口分析 ---------- */
.sched-gap-table { min-width: 720px; }
.sched-gap-table tr.row-bad td { background: #fffaf0; }
.sched-gap-table tr.row-bad td:first-child { box-shadow: inset 3px 0 0 #e0a63a; }
.sched-gap-table tr.row-today td { background: #f3f8ff; }
/* 判定是「人手富余/不足」，自动布局会把最后一列压成两个字宽，得钉住不换行 */
.ledger.sched-gap-table th:last-child,
.ledger.sched-gap-table td:last-child { white-space: nowrap; }
.ledger.sched-shift-table th:last-child,
.ledger.sched-shift-table td:last-child,
.ledger.sched-roster-table th:last-child,
.ledger.sched-roster-table td:last-child { white-space: nowrap; }
.sched-total td { font-weight: 600; color: var(--ink); background: #f7f9fc; }

/* ---------- 班次表 / 人员表 ---------- */
.sched-shift-table { min-width: 820px; }
.sched-shift-table th:nth-child(2), .sched-shift-table td:nth-child(2) { white-space: nowrap; }
.sched-roster-table { min-width: 720px; }
.sched-acts { white-space: nowrap; }
.sched-acts form { display: inline; }
.sched-shift-form { margin-top: 12px; }

/* 行内表单排成一行：删除、改状态都是小动作，不该各占一行 */
form.inline { display: inline; }

.sched-foot {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink3);
  background: #fbfcfe;
  border: 1px dashed var(--line2);
  border-radius: 8px;
}

@media (max-width: 1260px) {
  /* 五张小时卡在 1000 上下排两列会剩一张孤零零的，三列 3+2 更整齐 */
  .sched-mini { grid-template-columns: repeat(3, 1fr); }
  /* 人效与七天业务量挤一行时，日期标签和输入框会错位成一团：
     改成上下两段，人效占一行、七天网格占一行，输入框永远在标签正下方 */
  .sched-workload { flex-direction: column; align-items: stretch; }
  .sched-rate { width: 160px; }
  .sched-save { justify-content: flex-start; }
  /* 通用台账规则会藏第 2、3 列（那是"类别/责任人"，排班表里是岗位和第 1 天）。
     排班的每一列都是要用的，全部恢复，靠横向滚动解决宽度 */
  .ledger.sched-table th:nth-child(2), .ledger.sched-table td:nth-child(2),
  .ledger.sched-table th:nth-child(3), .ledger.sched-table td:nth-child(3) {
    display: table-cell;
  }
  /* 八列的表在 1000 上下只剩 700 出头，列内边距收一半才排得下判定列 */
  .ledger.sched-table th, .ledger.sched-table td { padding-left: 6px; padding-right: 6px; }
  /* 七天的业务量在窄屏挤成一团，改成 4 列两行 */
  /* 列成 column 后 flex:1 只管高，宽度得显式 100%，否则网格按内容撑出卡片 */
  .sched-days { grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; width: 100%; }
}

@media (max-width: 1120px) {
  /* 「折算人班」「编制人班」是需求人班的两个来源，窄屏先让它们走，
     需求人班已经写着取大后的结果，判定列才留得下 */
  .ledger.sched-gap-table th:nth-child(4),
  .ledger.sched-gap-table td:nth-child(4),
  .ledger.sched-gap-table th:nth-child(5),
  .ledger.sched-gap-table td:nth-child(5) { display: none; }
  /* 藏掉两列后剩 8 列，720 的硬最小宽度反而把「判定」推出卡片，放开按内容排 */
  .ledger.sched-gap-table { min-width: 0; }
  /* 方案表同病：「说明」是最长的一列，不让它走，「采用」按钮就被推到屏幕外——
     那是这一屏唯一的动作，宁可先不显示说明文字 */
  .ledger.sched-plan-table th:nth-child(7),
  .ledger.sched-plan-table td:nth-child(7) { display: none; }
  .ledger.sched-plan-table { min-width: 0; }
  /* 班次表七天都是同一个数，列可以窄到 38px；把宽度让给操作列 */
  .ledger.sched-shift-table th:nth-child(n+5),
  .ledger.sched-shift-table td:nth-child(n+5) { width: 38px; }
  .ledger.sched-shift-table th:last-child,
  .ledger.sched-shift-table td:last-child { width: 104px; }
}

@media (max-width: 900px) {
  .sched-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sched-matrix { min-width: 760px; }
}

@media (max-width: 700px) {
  /* 手机上排班表只留人员 + 今天前后：先让岗位和汇总列走，保证下拉能点 */
  .ledger.sched-matrix th.c-post, .ledger.sched-matrix td.c-post,
  .ledger.sched-matrix th.c-num, .ledger.sched-matrix td.c-num { display: none; }
  .sched-matrix { min-width: 560px; }
  .ledger.sched-matrix th.c-name, .ledger.sched-matrix td.c-name { min-width: 82px; width: 82px; }
  /* 手机上一格只剩 60 多像素：格子内边距收到 2px，下拉才有地方写完整"白班" */
  .ledger.sched-matrix th, .ledger.sched-matrix td { padding-left: 2px; padding-right: 2px; }
  /* 手机留 日期/业务量/需求人班/已排人班/缺口/判定 六列：
     需求人时和利用率是"为什么缺"的推导，判定和缺口才是要下的决定 */
  .ledger.sched-gap-table th:nth-child(3),
  .ledger.sched-gap-table td:nth-child(3),
  .ledger.sched-gap-table th:nth-child(9),
  .ledger.sched-gap-table td:nth-child(9) { display: none; }
  /* 减到 6 列后 720 的最小宽度反而是负担，放开才能一屏放下判定 */
  .ledger.sched-gap-table { min-width: 0; }
  .sched-matrix th.c-day, .sched-matrix td.c-day { width: 62px; }
  .sched-matrix th.c-act, .sched-matrix td.c-act { width: 54px; }
  .sched-sel { font-size: 11px; padding: 0 1px; }
  .sched-mini { grid-template-columns: repeat(2, 1fr); }
  .sched-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sched-workload { gap: 8px; }
  .sched-rate { width: 110px; }
}

/* ============ 单据式录入（入库 / 出库 / 移库） ============ */
/* 现场要的是一张能对着抄的纸单：抬头居中、字段带格线、数量靠右、
   输入框长成"填空线"。字段名和提交逻辑跟原表单完全一致，只换版式。 */
.doc-sheet {
  margin-top: 12px;
  background: #fff;
  border: 1px solid #d5dbe6;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  overflow: hidden;
}
.doc-head {
  padding: 14px 18px 10px;
  text-align: center;
  background: linear-gradient(#fcfdff, #f7f9fc);
  border-bottom: 2px solid #c9d1de;
}
.doc-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .45em;
  text-indent: .45em;
  color: var(--ink);
}
.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--ink3);
}
.doc-meta label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.doc-meta input {
  height: 26px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed #c3ccdb;
  border-radius: 0;
}
.doc-meta input:focus { outline: none; border-bottom-color: var(--primary); }
/* 日期框在 Chrome/Edge 下自带边框和图标，单独压掉，跟单号保持同一条填空线 */
.doc-meta input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-bottom: 1px dashed #c3ccdb;
  background: transparent;
  padding: 0 4px;
}
.doc-meta input[type="date"]:focus { border-bottom-color: var(--primary); }
.doc-meta input[name="order_no"] { width: 170px; }

/* 表头信息：label 灰底在左，值填在格子里；桌面三列、手机一列 */
.doc-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  font-size: 12.5px;
}
.doc-cell {
  display: flex;
  align-items: stretch;
  min-height: 38px;
  border-bottom: 1px solid #e2e7ef;
  border-right: 1px solid #e2e7ef;
}
.doc-cell > span {
  display: flex;
  align-items: center;
  flex: none;
  width: 84px;
  padding: 0 10px;
  color: var(--ink3);
  background: #fafbfd;
  border-right: 1px solid #e2e7ef;
  white-space: nowrap;
}
.doc-cell > span .req { color: #e5484d; font-style: normal; margin-left: 2px; }
.doc-cell input,
.doc-cell select {
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.doc-cell input:focus,
.doc-cell select:focus { outline: none; background: #f5f8ff; }
.doc-cell-wide { grid-column: 1 / -1; }
.doc-cell-span2 { grid-column: span 2; }
/* 每行最后一个格子不画右线，否则和单据外框叠成双线 */
.doc-cell:nth-child(3n) { border-right: 0; }

/* 明细行：像纸单上的表格，只有一条也要有"合计"压住 */
.doc-body {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.doc-body th,
.doc-body td {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e2e7ef;
  text-align: left;
}
.doc-body thead th {
  font-weight: 500;
  color: var(--ink3);
  background: #fafbfd;
}
.doc-body tbody input {
  width: 100%;
  height: 34px;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: transparent;
  border: 0;
}
.doc-body tbody input:focus { outline: none; background: #f5f8ff; }
.doc-body tfoot td {
  font-weight: 600;
  background: #fafbfd;
  color: var(--ink);
}
.doc-idx { width: 56px; text-align: center !important; color: var(--ink3); }
.doc-body .ta-r { text-align: right; }

.doc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: #fcfdff;
  border-top: 1px solid #e2e7ef;
}
.doc-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink3);
}
.doc-foot .btn-solid { flex: none; }
.doc-actions { display: flex; gap: 8px; flex: none; }
.doc-actions .btn-solid,
.doc-actions .btn-line { height: 32px; }

/* 移库单的「移出 / 移入」两行：左边一个竖标签，右边库区+库位 */
.doc-route { border-top: 1px solid #e2e7ef; }
.route-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) minmax(0, 1fr);
}
.route-row:first-child { border-bottom: 1px solid #e2e7ef; }
.route-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
  background: #f2f5fa;
  border-right: 1px solid #e2e7ef;
}
.route-row .doc-cell { border-right: 0; }
.doc-move-hint { font-size: 12px; color: var(--ink3); }

/* 改口令页：单列、窄卡，跟单据页的大表格区分开 */
.pwd-card { max-width: 520px; }
/* 自己的列布局：不复用 .chk-form 的四列网格，否则窄屏媒体查询会把它拆成两列 */
.pwd-form { display: flex; flex-direction: column; gap: 12px; }
.pwd-form label { display: flex; flex-direction: column; gap: 4px; }
.pwd-form label > span { font-size: 12px; color: var(--ink3); }
.pwd-form input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 7px;
}
.pwd-form input:focus {
  outline: none;
  border-color: #a9c2ff;
  box-shadow: 0 0 0 2px var(--primary-w);
}
.pwd-form .chk-submit { display: flex; justify-content: flex-end; gap: 8px; }
.pwd-form .chk-submit .btn-line { height: 32px; }

/* 登录成员：状态胶囊 + 操作按钮并排 */
.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
}
.pill-ok { background: #e8f7ee; color: #15803d; }
.pill-off { background: #f1f3f7; color: var(--ink3); }
.staff-acts { display: inline-flex; gap: 6px; align-items: center; }
.staff-acts form { margin: 0; }
/* 四个字段恰好占满一行，按钮单独起一行靠右，别挤进字段中间 */
.staff-newform .chk-submit { grid-column: 1 / -1; justify-content: flex-end; }

/* 成员表：通用 .ledger 在 ≤1260 会藏第 2/3 列（那里是姓名、角色），
   可成员表恰恰要看角色，所以显式恢复；改成就近藏「最后更新」 */
@media (max-width: 1260px) {
  .ledger.staff-user-table th:nth-child(2), .ledger.staff-user-table td:nth-child(2),
  .ledger.staff-user-table th:nth-child(3), .ledger.staff-user-table td:nth-child(3) {
    display: table-cell;
  }
  .ledger.staff-user-table { min-width: 600px; }
}
@media (max-width: 720px) {
  .ledger.staff-user-table th:nth-child(5),
  .ledger.staff-user-table td:nth-child(5) { display: none; }
  .ledger.staff-user-table { min-width: 0; }
  .staff-acts { flex-direction: column; align-items: flex-end; gap: 4px; }
}

/* ============ 角色权限矩阵 ============ */
.ledger .ta-c { text-align: center; }
.role-matrix .role-mod {
  font-weight: 600;
  color: var(--ink2);
  background: #fafbfd;
  vertical-align: top;
  white-space: nowrap;
}
.role-matrix .role-perm { line-height: 1.6; }
.role-matrix .role-perm code {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--ink3);
  background: #f3f5fa;
  border-radius: 4px;
}
.role-box { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.role-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .role-actions { flex-direction: column; align-items: stretch; }
  .role-actions .btn-solid { width: 100%; }
}

/* ============ 操作日志 ============ */
.pill-warn { background: #fdecec; color: #b42318; }
/* 「30 天内到期」要和「已过期」区分开：琥珀色提醒，红色才是已经过期 */
.pill-soon { background: #fdf3e2; color: #a86a08; }
.log-acc { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--ink3); }
.log-table .c-detail { color: var(--ink2); }
.log-table .c-ip { color: var(--ink3); font-size: 11.5px; }

/* ============ 员工档案 ============ */
.eq-sum .chip.c-danger { background: #fdecec; border-color: #f2d6d7; color: #b42318; }
.eq-sum .chip.c-danger b { color: #b42318; }
.pill-danger { background: #fdecec; color: #b42318; }
.staff-acts .btn-mini {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.big-form { row-gap: 12px; }

/* 档案表第 2/3 列是姓名和岗位，正是要找的东西，
   别让通用 .ledger 的窄屏规则把它们藏掉 */
@media (max-width: 1260px) {
  .ledger.staff-emp-table th:nth-child(2), .ledger.staff-emp-table td:nth-child(2),
  .ledger.staff-emp-table th:nth-child(3), .ledger.staff-emp-table td:nth-child(3) {
    display: table-cell;
  }
  .ledger.staff-emp-table { min-width: 760px; }
}
@media (max-width: 720px) {
  /* 手机上只留工号、姓名、岗位、状态、操作 */
  .ledger.staff-emp-table th:nth-child(4), .ledger.staff-emp-table td:nth-child(4),
  .ledger.staff-emp-table th:nth-child(5), .ledger.staff-emp-table td:nth-child(5),
  .ledger.staff-emp-table th:nth-child(6), .ledger.staff-emp-table td:nth-child(6),
  .ledger.staff-emp-table th:nth-child(7), .ledger.staff-emp-table td:nth-child(7) {
    display: none;
  }
  .ledger.staff-emp-table { min-width: 0; }
}

/* 人员管理首页上的"登录成员管理"入口卡 */
.staff-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.staff-entry .btn-solid {
  display: inline-flex;
  align-items: center;
  flex: none;
  text-decoration: none;
}
@media (max-width: 720px) {
  .staff-entry { flex-direction: column; align-items: stretch; }
  .staff-entry .btn-solid { justify-content: center; }
}

/* 人员管理首页：三个已落地功能的入口卡 */
.staff-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.staff-link {
  display: block;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.staff-link b {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
  color: var(--ink);
}
.staff-link span { font-size: 12px; color: var(--ink3); }
.staff-link:hover { border-color: #c9d8ff; box-shadow: 0 2px 10px rgba(37, 87, 232, .08); }

@media (max-width: 720px) {
  .doc-head { padding: 12px 12px 9px; }
  .doc-title { font-size: 17px; }
  .doc-meta { flex-wrap: wrap; gap: 8px; }
  .doc-meta input[name="order_no"] { width: 130px; }
  /* 手机上表头信息改单列，标签与值仍左右并排 */
  .doc-info { grid-template-columns: 1fr; }
  .doc-cell > span { width: 76px; }
  .doc-cell { border-right: 0; }
  .doc-cell-span2 { grid-column: auto; }
  .doc-body { font-size: 12px; }
  .doc-body th, .doc-body td { padding: 0 6px; }
  .doc-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .doc-foot .btn-solid { width: 100%; }
}

/* ============ 成员角色下拉 / 单独授权 ============ */
.role-select {
  height: 26px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--ink);
  border: 1px solid #dfe4ee;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.role-select:hover { border-color: #c9d8ff; }

/* 有单独加减项的成员，角色后面挂个小标记：+1 是额外授予、−2 是单独收回 */
.perm-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  color: #a86a08;
  background: #fdf3e2;
  border-radius: 4px;
  vertical-align: 1px;
}

.perm-select {
  height: 26px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--ink);
  border: 1px solid #dfe4ee;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.perm-select:hover { border-color: #c9d8ff; }
.up-table .role-perm { max-width: 420px; }

/* 角色列的 select 外面套着 form，默认块级会把「+1−1」标记顶到下一行 */
.staff-user-table td form { display: inline-block; margin: 0; }
