/* ==========================================================================
   IDC 配件快递收发记录 · 样式
   设计取向：信息密度高、移动端优先（机房现场用手机登记是主场景）
   ========================================================================== */

:root {
  --bg:        #f4f6f9;
  --card:      #ffffff;
  --text:      #1f2937;
  --muted:     #6b7280;
  --faint:     #9ca3af;
  --line:      #e5e7eb;
  --line-soft: #f1f3f5;
  --primary:   #2563eb;
  --primary-d: #1d4ed8;
  --primary-l: #eff4ff;
  --in:        #059669;   /* 收件 */
  --in-l:      #ecfdf5;
  --out:       #d97706;   /* 发件 */
  --out-l:     #fffbeb;
  --danger:    #dc2626;
  --danger-l:  #fef2f2;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.14);
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 顶栏 ───────────────────────────────────────────────── */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-in {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 8px; height: 56px;
}
.brand {
  font-weight: 700; font-size: 15px; color: var(--text);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.nav { display: flex; gap: 2px; margin-left: 12px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted);
  font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: var(--line-soft); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-l); color: var(--primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.userchip {
  display: flex; align-items: center; gap: 7px; padding: 5px 10px;
  border-radius: 999px; background: var(--line-soft); font-size: 13px; color: var(--muted);
}
.userchip b { color: var(--text); font-weight: 600; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ── 布局 ───────────────────────────────────────────────── */

.wrap { max-width: 1200px; margin: 0 auto; padding: 18px 16px 80px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-head h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.nopad { padding: 0; overflow: hidden; }
.card-title {
  font-size: 14px; font-weight: 700; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-title .hint { font-weight: 400; color: var(--faint); font-size: 12px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

/* ── 统计卡 ─────────────────────────────────────────────── */

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .k { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--faint); margin-left: 3px; }
.stat.in   .v { color: var(--in); }
.stat.out  .v { color: var(--out); }
.stat.warn .v { color: var(--danger); }

/* ── 按钮 ───────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.4;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--line-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { background: var(--card); border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-l); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 徽标 ───────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.dir-in   { background: var(--in-l);  color: var(--in);  border-color: #a7f3d0; }
.dir-out  { background: var(--out-l); color: var(--out); border-color: #fde68a; }
.st-pending  { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.st-shipping { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.st-signed   { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.st-stored   { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.st-done     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.st-error    { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.tag-del { background: #f3f4f6; color: var(--faint); border-color: var(--line); }

/* ── 表单 ───────────────────────────────────────────────── */

.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: #374151; margin-bottom: 5px;
}
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .tip { font-size: 12px; color: var(--faint); margin-top: 4px; }

input[type=text], input[type=password], input[type=date], input[type=tel],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--card); outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 68px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; margin-bottom: 13px; }

/* 单号输入（扫码枪焦点区） */
.scan-box {
  background: var(--primary-l); border: 1px solid #c7d9ff;
  border-radius: var(--radius); padding: 13px; margin-bottom: 14px;
}
.scan-box .scan-label {
  font-size: 12.5px; font-weight: 700; color: var(--primary-d);
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.scan-input { display: flex; gap: 8px; align-items: stretch; }
.scan-input input {
  font-size: 16px; font-weight: 600; letter-spacing: .06em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 11px 12px;
}
.scan-hint { font-size: 12px; margin-top: 6px; min-height: 18px; color: var(--muted); }
.scan-hint.ok  { color: var(--in); font-weight: 600; }
.scan-hint.warn{ color: var(--out); font-weight: 600; }
.scan-hint.err { color: var(--danger); font-weight: 600; }

/* 方向选择 */
.dir-pick { display: flex; gap: 10px; }
.dir-pick label {
  flex: 1; cursor: pointer; border: 1.5px solid var(--line); border-radius: 9px;
  padding: 11px; text-align: center; font-weight: 600; font-size: 14px;
  background: var(--card); transition: all .12s; margin: 0;
}
.dir-pick input { position: absolute; opacity: 0; pointer-events: none; }
.dir-pick input:checked + span { }
.dir-pick label:has(input:checked) { border-color: var(--primary); background: var(--primary-l); color: var(--primary-d); }
.dir-pick label.in:has(input:checked)  { border-color: var(--in);  background: var(--in-l);  color: var(--in); }
.dir-pick label.out:has(input:checked) { border-color: var(--out); background: var(--out-l); color: var(--out); }

/* 常用快递公司快捷按钮 */
.carrier-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.carrier-chips .chip {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); cursor: pointer; font-size: 13px; font-weight: 500;
}
.carrier-chips .chip:hover { border-color: var(--primary); color: var(--primary); }
.carrier-chips .chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── 明细行 ─────────────────────────────────────────────── */

.items-head, .item-row {
  display: grid; gap: 8px; align-items: start;
  grid-template-columns: 1.3fr 1.1fr 1.1fr 62px 58px 1.3fr 92px 36px;
}
.items-head {
  font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 0 2px 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px;
}
.item-row { margin-bottom: 8px; }
.item-row input, .item-row select { padding: 7px 9px; font-size: 13.5px; }
.item-row .del {
  border: 1px solid var(--line); background: var(--card); border-radius: 7px;
  color: var(--faint); cursor: pointer; height: 36px; font-size: 16px; line-height: 1;
}
.item-row .del:hover { color: var(--danger); border-color: #fecaca; background: var(--danger-l); }

/* ── 地址簿 ─────────────────────────────────────────────── */

.addr-pick { display: flex; gap: 8px; margin-bottom: 8px; }

/* 左：地址一行；右：三个按钮竖排三行 —— 横向只占约 100px，框能拿到更多宽度 */
.party-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.party-row .party-box { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.party-btns {
  display: flex; flex-direction: column; gap: 6px;
  flex: none; justify-content: center;
}
.party-btns .btn { white-space: nowrap; }
.party-btns .btn.btn-ghost { color: var(--faint); }

/* 「对方」一个框：未选时是入口，选中后直接显示详细信息 */
.party-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); cursor: pointer;
}
.party-box:hover { border-color: var(--primary); }
.party-box:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.party-box.filled { background: var(--primary-l); border-color: #c7d9ff; }
/* 单位/联系人 与 地址 排在同一行 */
.party-box .pb-main {
  min-width: 0; flex: 1;
  display: flex; gap: 8px; align-items: baseline; overflow: hidden;
}
.party-box .pb-l1 {
  flex: none; font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.party-box.filled .pb-l1 { font-size: 14px; font-weight: 700; color: var(--primary-d); }
.party-box .pb-l2 {
  min-width: 0; font-size: 13px; color: #4b5563;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.party-box .arrow { flex: none; color: var(--faint); }

/* 地址列表：每条完整显示，地址自动换行，绝不省略 */
.addr-list {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); margin-bottom: 8px; overflow: hidden;
  box-shadow: var(--shadow);
}
.addr-list-head {
  display: flex; gap: 8px; align-items: center; padding: 8px;
  border-bottom: 1px solid var(--line-soft); background: #fafbfc;
}
.addr-list-head input { flex: 1; min-width: 0; }
.addr-items { max-height: 340px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 地址列表：每条只显示地址，压成一行（名称/联系人/电话仍可搜，见 data-search） */
.addr-item {
  position: relative;
  display: block; width: 100%; text-align: left; padding: 9px 36px 9px 12px;
  border: none; border-bottom: 1px solid var(--line-soft);
  background: var(--card); cursor: pointer; font-family: inherit;
  font-size: 13px; color: var(--text); line-height: 1.5;
}
.addr-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.addr-item .ai-addr {
  display: block; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;   /* 单行，过长省略 */
}
/* 就地删除：右侧小圆叉 */
.addr-item .ai-del {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  color: var(--faint); font-size: 14px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.addr-item .ai-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.addr-item:last-child { border-bottom: none; }
.addr-item:hover { background: var(--primary-l); }
.addr-item.on { background: var(--primary-l); box-shadow: inset 3px 0 0 var(--primary); }
.addr-none { padding: 18px; text-align: center; color: var(--faint); font-size: 13px; }

.addr-new {
  margin-top: 10px; padding: 13px;
  border: 1px solid #c7d9ff; border-radius: var(--radius);
  background: var(--primary-l);
}
.addr-new .field { margin-bottom: 10px; }
.addr-new .row > .field { flex: 1 1 130px; }

/* 详情页的地址块：长地址要能自动折行 */
.dd.addr { line-height: 1.7; }

@media (max-width: 860px) {
  /* 窄屏：竖排按钮会让整块过高，改为横排落到框下方 */
  .party-row { flex-direction: column; }
  .party-row .party-box { width: 100%; }
  .party-btns { flex-direction: row; width: 100%; }
  .party-btns .btn { flex: 1 1 auto; }
  /* 一行放不下时允许换行，避免地址被省略 */
  .party-box .pb-main { flex-wrap: wrap; }
  .party-box .pb-l2 { white-space: normal; word-break: break-all; overflow: visible; }
}

@media (max-width: 720px) {
  .addr-pick { flex-direction: column; }
  .addr-pick .btn { width: 100%; }
  .addr-current { width: 100%; }
  .addr-items { max-height: 260px; }
}

/* ── 配件明细：批量粘贴识别 ─────────────────────────────── */

.paste-box { margin-bottom: 10px; }
.paste-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 12px; text-align: left;
  border: 1px dashed var(--line); border-radius: 8px;
  background: #fafbfc; color: var(--muted);
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.paste-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }
.paste-toggle .arrow { flex: none; color: var(--faint); }

.paste-body {
  margin-top: 8px; padding: 11px;
  border: 1px solid #c7d9ff; border-radius: var(--radius);
  background: var(--primary-l);
}
.paste-body textarea {
  width: 100%; min-height: 120px; margin-bottom: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.7; white-space: pre;
  overflow-wrap: normal; overflow-x: auto;
}
.paste-body .btn-row { align-items: center; }
#paste-hint { color: var(--muted); }
#paste-hint.ok  { color: var(--in); font-weight: 600; }
#paste-hint.err { color: var(--danger); font-weight: 600; }

@media (max-width: 720px) {
  .paste-body textarea { font-size: 12.5px; min-height: 140px; }
  .paste-body .btn-row .btn { flex: 1 1 auto; }
}

/* ── 表格 ───────────────────────────────────────────────── */

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc;
  white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; letter-spacing: .01em;
}
.tbl .nowrap { white-space: nowrap; }
.tbl .muted { color: var(--muted); }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--faint);
}
.empty .big { font-size: 32px; margin-bottom: 8px; opacity: .5; }

/* ── 筛选栏 ─────────────────────────────────────────────── */

.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.filters .field { margin-bottom: 0; }

/* 操作区独占一整行。
   之前它是网格里的一个窄格，塞了「筛选/重置/显示已删除」三个元素后宽度不够，
   而中文没有词边界 → 被逐字拆成竖排（"显示已删除" 变成一列单字）。 */
.filters .actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  grid-column: 1 / -1;
  padding-top: 2px;
}
.filters .actions .btn { flex: none; }
.filters .actions .chk {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 4px; cursor: pointer;
  white-space: nowrap;            /* ← 关键：中文标签不拆字换行 */
}
.filters .actions .chk input { width: auto; margin: 0; }

/* ── 分页 ───────────────────────────────────────────────── */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 14px; flex-wrap: wrap;
}
.pager .info { color: var(--muted); font-size: 13px; }
.pager .links { display: flex; gap: 6px; align-items: center; }

/* ── 图片 ───────────────────────────────────────────────── */

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb {
  position: relative; width: 88px; height: 88px; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line); background: var(--line-soft);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: rgba(17,24,39,.65); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.thumb .rm:hover { background: var(--danger); }
.thumb .tl {
  position: absolute; left: 0; bottom: 0; right: 0; font-size: 10.5px;
  background: rgba(17,24,39,.6); color: #fff; text-align: center; padding: 1px 0;
}

.uploader {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center; background: #fafbfc; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.uploader:hover, .uploader.drag { border-color: var(--primary); background: var(--primary-l); }
.uploader .ico { font-size: 22px; color: var(--faint); }
.uploader .t { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.uploader .s { font-size: 12px; color: var(--faint); margin-top: 2px; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; background: rgba(9,12,20,.92); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.lightbox.on { display: flex; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 8px; }
.lightbox .close {
  position: absolute; top: 16px; right: 20px; font-size: 30px; color: #fff;
  background: none; border: none; cursor: pointer; line-height: 1;
}
.lightbox .cap {
  position: absolute; bottom: 18px; left: 0; right: 0; text-align: center;
  color: #d1d5db; font-size: 13px;
}

/* ── 提示 ───────────────────────────────────────────────── */

.flash {
  padding: 11px 14px; border-radius: 9px; margin-bottom: 14px;
  font-size: 13.5px; border: 1px solid;
}
.flash.ok  { background: var(--in-l); border-color: #a7f3d0; color: #065f46; }
.flash.err { background: var(--danger-l); border-color: #fecaca; color: #991b1b; }

.alert {
  padding: 11px 13px; border-radius: 9px; font-size: 13px;
  border: 1px solid #fde68a; background: var(--out-l); color: #92400e; margin-bottom: 12px;
}
.alert.info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.alert.err  { border-color: #fecaca; background: var(--danger-l); color: #991b1b; }
.alert b { font-weight: 700; }

/* 提示条（JS 弹出的 toast） */
#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 88vw; text-align: center;
  box-shadow: var(--shadow-lg);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #991b1b; }
#toast.ok  { background: #065f46; }

/* ── 登录页 ─────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 18px;
  background: linear-gradient(160deg, #eef2ff 0%, var(--bg) 45%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px 26px;
}
.login-card .logo-lg {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 21px; font-weight: 700;
}
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* ── 详情页字段 ─────────────────────────────────────────── */

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px 20px; }
.dl .dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dl .dd { font-size: 14px; word-break: break-word; }
.dl .full { grid-column: 1 / -1; }

/* ── 工具类 ─────────────────────────────────────────────── */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mb14 { margin-bottom: 14px; }
.flex { display: flex; } .between { justify-content: space-between; }
.items-center { align-items: center; } .gap8 { gap: 8px; } .wrap-f { flex-wrap: wrap; }
.hidden { display: none !important; }

/* 迷你条形图（原生 CSS，不引图表库） */
.bar-row { display: grid; grid-template-columns: 92px 1fr 46px; gap: 10px; align-items: center; margin-bottom: 7px; font-size: 13px; }
.bar-row .lb { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line-soft); border-radius: 5px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa); border-radius: 5px; min-width: 2px; }
.bar-fill.alt { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.bar-fill.gray { background: linear-gradient(90deg, #64748b, #94a3b8); }
.bar-row .vl { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* 趋势柱状图 */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding: 8px 0 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; height: 100%; min-width: 0; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bar { width: 42%; max-width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bar.in  { background: var(--in); }
.chart .bar.out { background: var(--out); }
.chart .lb { font-size: 11px; color: var(--faint); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

/* ── 移动端（机房现场主场景） ───────────────────────────── */

@media (max-width: 720px) {
  .wrap { padding: 12px 11px 70px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c2.keep, .grid.c3.keep { grid-template-columns: 1fr; }
  .card { padding: 13px; border-radius: 9px; }
  .card.nopad { padding: 0; }
  .page-head h1 { font-size: 17px; }
  .stat .v { font-size: 22px; }

  /* 底部导航：管理员有 7 项（看板/收发记录/＋登记/统计/字典/用户/日志），
     必须全部塞得下 —— 否则手机上够不着「用户」「日志」。 */
  .nav { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; z-index: 60;
         background: var(--card); border-top: 1px solid var(--line);
         padding: 4px 2px calc(4px + var(--safe-b)); gap: 0; overflow: visible; }
  .nav a { flex: 1 1 0; min-width: 0; text-align: center; font-size: 10.5px;
           padding: 6px 0; border-radius: 6px; letter-spacing: -.02em; }
  .brand span.t { display: none; }
  .topbar-in { height: 50px; padding: 0 12px; }
  .userchip .name { display: none; }

  /* 表格 → 卡片 */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    border: 1px solid var(--line); border-radius: 9px; margin-bottom: 9px;
    padding: 10px 12px; background: var(--card); box-shadow: var(--shadow);
  }
  .tbl td { border: none; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; }
  .tbl td::before {
    content: attr(data-label); flex: 0 0 74px; color: var(--faint); font-size: 12px;
  }
  .tbl td.full-row::before { display: none; }
  .tbl td.actions-cell { padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--line-soft); }
  .tbl td.actions-cell::before { display: none; }

  /* 明细行 → 竖排卡片 */
  .items-head { display: none; }
  .item-row {
    grid-template-columns: 1fr 1fr; gap: 7px;
    border: 1px solid var(--line); border-radius: 9px; padding: 10px;
    margin-bottom: 10px; background: #fafbfc; position: relative;
  }
  .item-row input, .item-row select { font-size: 14px; }
  .item-row .del { position: absolute; top: 7px; right: 7px; height: 28px; width: 28px; }
  .item-row .f-part, .item-row .f-model, .item-row .f-sn, .item-row .f-fault { grid-column: 1 / -1; }

  .scan-input { flex-direction: column; }
  .scan-input .btn { width: 100%; }
  .dir-pick label { padding: 10px 6px; font-size: 13.5px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field.wide, .filters .actions { grid-column: 1 / -1; }
  .chart { height: 118px; gap: 5px; }
  .bar-row { grid-template-columns: 74px 1fr 40px; font-size: 12.5px; }
  .dl { grid-template-columns: 1fr 1fr; gap: 11px 14px; }
  .dl .full { grid-column: 1 / -1; }
  .thumb { width: calc((100% - 16px) / 3); height: auto; aspect-ratio: 1; }
  .login-card { padding: 24px 20px; }
}

@media (max-width: 380px) {
  .grid.c4 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .nav, .btn, .filters, .pager { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
}
