:root {
  --nav-bg: #1F3A5F;
  --nav-active: #2C5282;
  --primary: #2F5597;
  --primary-dark: #24426F;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --border: #E3E8EF;
  --text: #1F2937;
  --muted: #6B7280;
  --danger: #A32D2D;
  --danger-bg: #FCEBEB;      /* 与 .badge.red 同底；台账加载失败提示条共用 */
  --danger-border: #F09595;  /* 与 .btn-danger 描边同色 */
  --success: #3B6D11;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 190px;
  flex: 0 0 190px;
  background: var(--nav-bg);
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  padding: 18px 16px 14px;
  font-size: 15px;
  font-weight: 500;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255,255,255,.1);
  letter-spacing: .5px;
}
.sidebar .brand small { display: block; font-size: 11px; color: #94A3B8; font-weight: 400; margin-top: 2px; }
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a {
  display: block;
  padding: 9px 18px;
  color: #CBD5E1;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--nav-active); color: #fff; border-left-color: #7FB3E8; }
.sidebar .group { padding: 12px 18px 4px; font-size: 11px; color: #7C8CA3; letter-spacing: 1px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 16px; font-weight: 500; margin: 0; }
.topbar .user { font-size: 13px; color: var(--muted); }
.topbar .user b { color: var(--text); font-weight: 500; }

.content { padding: 20px 22px 40px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card > h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card > h2 .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- 指标卡 ---------- */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 500; margin-top: 2px; line-height: 1.2; }
.stat .value.warn { color: var(--danger); }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 表格 ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: #FAFBFC;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 8px 10px;
  border-bottom: 1px solid #F0F2F5;
  vertical-align: top;
}
table.data tbody tr:hover { background: #FAFBFD; }
table.data td.num, table.data th.num { text-align: right; }
table.data .nowrap { white-space: nowrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #F1EFE8;
  color: #5F5E5A;
  white-space: nowrap;
}
.badge.red    { background: #FCEBEB; color: #A32D2D; }
.badge.orange { background: #FAEEDA; color: #854F0B; }
.badge.blue   { background: #E6F1FB; color: #185FA5; }
.badge.green  { background: #EAF3DE; color: #3B6D11; }
.badge.purple { background: #EEEDFE; color: #534AB7; }
.badge.gray   { background: #F1EFE8; color: #5F5E5A; }

/* ---------- 表单 ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-width: 120px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #B5D4F4; border-color: var(--primary); }
textarea { min-height: 70px; resize: vertical; }
.field.wide input, .field.wide select { min-width: 240px; }

button, .btn {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  display: inline-block;
  line-height: 1.5;
}
button:hover, .btn:hover { background: #F7F9FC; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #F09595; color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn.active, a.btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* .btn 自带的 display 会盖掉浏览器默认的 [hidden]{display:none}，补回这条，
   否则给按钮加 hidden 属性隐藏不掉（同 .cfpop[hidden] / .form-error[hidden] 的做法）。
   .filters > 两个变体是为了压过 @media(≤860px) 里的 `.filters > .btn{display:inline-flex}`，
   那条与 `.btn[hidden]` 同特异性 (0,2,0) 却声明更靠后，窄屏会把 hidden 再盖回去。 */
.btn[hidden], button[hidden], .filters > .btn[hidden], .filters > button[hidden] { display: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 提示横幅 ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert.err { background: #FCEBEB; color: #A32D2D; border: 1px solid #F09595; }
.alert.ok  { background: #EAF3DE; color: #3B6D11; border: 1px solid #BFD89A; }
/* 提醒类（不等于出错）：如「保养暂停中」。与 .badge.orange 同色系 */
.alert.warn { background: #FAEEDA; color: #854F0B; border: 1px solid #EFC98B; }
.alert.warn a.btn { color: #854F0B; border-color: #EFC98B; background: #fff; }

/* ---------- YAML 编辑框 ---------- */
.yaml-edit {
  width: 100%; min-height: 360px; box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px; background: #FBFAF6;
  color: #2b2b2b; white-space: pre; overflow: auto; tab-size: 2;
}

/* ---------- 详情 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 20px; }
.kv .item { display: flex; gap: 8px; font-size: 13px; }
.kv .item .k { color: var(--muted); min-width: 84px; flex: 0 0 84px; }
.kv .item .v { flex: 1; word-break: break-all; }

/* ---------- 分页 ----------
   分页条本体在文件后半段（台账分页条），这里只保留占位，避免两处规则打架 */

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 32px 34px; width: 340px; }
.login-box h1 { font-size: 18px; font-weight: 500; margin: 0 0 4px; }
.login-box .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.login-box .field { margin-bottom: 14px; }
.login-box input { width: 100%; }
.login-box button { width: 100%; padding: 8px; }
.err { background: #FCEBEB; color: var(--danger); padding: 7px 10px; border-radius: 6px; font-size: 12.5px; margin-bottom: 14px; }
.tip { font-size: 12px; color: var(--muted); margin-top: 16px; text-align: center; }

/* ---------- 其他 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.flash { background: #EAF3DE; color: var(--success); padding: 9px 12px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
/* 设置页反馈横幅（?ok= / ?err=） */
.banner { padding: 9px 12px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.banner.ok { background: #EAF3DE; color: var(--success); }
.banner.err { background: #FDECEC; color: var(--danger); }
/* 弹层内联错误提示：校验失败就地展示，不关闭弹层 */
.form-error { display: block; margin-top: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--danger); background: #FDECEC; border: 1px solid #F6C9C9; font-size: 13px; }
.form-error[hidden] { display: none; }
/* 设置页 tab 切换按钮 active 态 */
.tab-active,
.tab-active:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.row-ops { white-space: nowrap; }
.row-ops .btn { margin: 0 2px 2px 0; }
.confirm-text { font-size: 14px; margin: 4px 0 16px; }
/* 申请人点选组合框：输入框 + ▾ 按钮 + 下拉面板（选项来自用户显示名） */
.combo { position: relative; display: flex; align-items: stretch; }
.combo > input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.combo-btn {
  flex: none; width: 34px; padding: 0; font-size: 13px; line-height: 1;
  border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0;
  color: var(--muted); cursor: pointer;
}
.combo-list {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 30;
  max-height: 240px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 4px;
}
.combo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; font-size: 13.5px; cursor: pointer;
}
.combo-item:hover { background: #EEF2FF; }
.combo-role { flex: none; font-size: 12px; color: var(--muted); }
/* 新增/复制申购：申请人固定为当前登录账号，只读展示 */
.ro-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: #F3F4F6; border: 1px solid var(--border); border-radius: 8px; color: #374151; max-width: 100%; }
.ro-pill .ro-name { font-weight: 600; }
.ro-pill .ro-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* 面板定位高亮（点击 tab 后的视觉反馈） */
@keyframes panelFlash {
  from { box-shadow: 0 0 0 3px rgba(37, 99, 235, .30); }
  to   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.panel-flash { animation: panelFlash .75s ease; border-radius: 8px; }
.row-list { display: flex; flex-direction: column; gap: 8px; }
.row-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #FAFBFC; border-radius: 6px; font-size: 13px; }
.row-item .r { color: var(--muted); white-space: nowrap; }
.chart-box { position: relative; height: 260px; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table.data.wide-table { min-width: 1360px; }
.list-count { padding: 6px 2px; font-size: 13px; color: var(--muted); }
.list-count.filtering { color: var(--primary); font-weight: 600; }
.link-open { color: var(--primary); text-decoration: none; white-space: nowrap; }
.link-open:hover { text-decoration: underline; }

/* 采购单照片画廊 + 灯箱预览 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));  gap: 10px;
  margin-top: 6px;
}
.photo-thumb {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.photo-thumb:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(47,85,151,.18); }
.photo-thumb img {
  width: 100%; height: 120px; object-fit: cover; display: block; background: #f5f6f8;
}
.photo-thumb .photo-name {
  display: block; padding: 5px 7px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.86);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 94vw; max-height: 90vh; object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.55); background: #fff;
}
.lb-close {
  position: absolute; top: 12px; right: 22px; color: #fff; font-size: 40px;
  line-height: 1; cursor: pointer; user-select: none; opacity: .85;
}
.lb-close:hover { opacity: 1; }
.lb-cap {
  position: absolute; bottom: 16px; left: 0; right: 0; text-align: center;
  color: #eee; font-size: 13px; padding: 0 24px;
}

/* 照片弹窗（台账页内联，不跳转到资料库） */
.modal {
  position: fixed; inset: 0; background: rgba(20,28,45,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 900;
}
.modal.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 12px; width: min(880px, 92vw);
  max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,.28); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600;
}
.modal-close {
  font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted);
  user-select: none; padding: 0 4px;
}
.modal-close:hover { color: var(--primary); }
/* 保养/点检计划抽屉（Master-Detail）：右侧滑出，窄屏塌缩全屏 */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 950;
  width: min(640px, 96vw); background: var(--card);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, .18);
  transform: translateX(102%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
/* 作业单详情：设备明细 5 列，抽屉放宽些 */
.drawer.wide { width: min(880px, 96vw); }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600; flex: none;
}
.drawer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-nav { display: flex; gap: 6px; flex: none; }
.drawer-close {
  font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted);
  user-select: none; padding: 0 4px; flex: none;
}
.drawer-close:hover { color: var(--primary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.drawer-mask {
  position: fixed; inset: 0; z-index: 940;
  background: rgba(20, 28, 45, .35); display: none;
}
.drawer-mask.open { display: block; }
@media (max-width: 720px) {
  .drawer, .drawer.wide { width: 100%; }
  .drawer-head { padding: 10px 12px; }
}
/* 作业单抽屉内打印预览：iframe 是独立文档，打印时只输出它自己的 A4 横向记录表 */
.order-print-preview {
  margin: 0 0 12px; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fff;
}
.order-print-preview .opp-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--card);
}
.order-print-preview .opp-stage { position: relative; overflow: hidden; background: #fff; }
.order-print-preview iframe {
  display: block; border: 0; width: 1123px; height: 794px;
  transform-origin: top left; background: #fff;
}

.modal-grid {
  padding: 14px 16px; overflow-y: auto;
}
.modal-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.del-target { margin: 0 0 12px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px;
  font-size: 13px; color: var(--text, #1f2937); cursor: pointer; }
table.data th a { color: var(--muted); }
table.data th a:hover { color: var(--primary); text-decoration: none; }
table.data th .cur-mark { color: var(--primary); font-weight: 700; }

.primary-doc { background: #F7FAFF; border: 1px solid #D6E4F7; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.doc-name { font-size: 14px; font-weight: 500; margin: 2px 0; }

/* 共享资料库 */
.row-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-top:12px; }
td.num, th.num { text-align:right; }
details > summary { padding:6px 0; }
details[open] > summary { border-bottom:1px solid var(--line,#e5e7eb); margin-bottom:4px; }

/* 新增申购：粘贴/拖拽上传区 */
.dropzone {
  border: 2px dashed var(--border, #cbd5e1);
  border-radius: 10px;
  background: #fafafa;
  padding: 16px;
  min-height: 70px;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--primary, #2563eb); background: #eef4ff; }
.dz-hint { color: var(--muted, #6B7280); font-size: 13px; margin-bottom: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb {
  position: relative; width: 96px; border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px; overflow: hidden; background: #fff;
}
.thumb img { width: 100%; height: 72px; object-fit: cover; display: block; }
.thumb-name { display: block; font-size: 11px; color: var(--muted, #6B7280); padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px;
  text-align: center; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  cursor: pointer; font-size: 14px;
}
.thumb-del:hover { background: #dc2626; }

/* ---------- 固定框架页（申购台账）：顶栏/筛选不动，只有表格内容滚动 ---------- */
body.p-fixed .layout { height: 100vh; }
body.p-fixed .main { height: 100vh; overflow: hidden; }
body.p-fixed .content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 18px 10px;
  overflow: auto;   /* 极端小屏时兜底可滚动，避免内容被裁掉 */
}
.p-head { flex: 0 0 auto; }
.p-head .card { margin-bottom: 8px; padding: 10px 12px; }
.p-head .card > h2 { margin-bottom: 10px; padding-bottom: 8px; }
.p-table-wrap {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
/* 固定列宽：一次布局成型，避免首屏列宽反复调整造成的抖动 */
table.data.fixed { table-layout: fixed; width: 100%; }
/* 各台账的「自然宽度」= 该表 colgroup 各列宽度之和。
   意义：屏幕够宽时 width:100% 铺满舒展；屏幕不够宽时表格不再被压缩挤压，
   改由 .p-table-wrap 出现横向滚动条左右滑动看全部列。
   注：下面的数值不必手工维护 —— app.js 的 fitTableWidths() 会在加载时按 colgroup
   实算并取「max(CSS 值, 列宽合计)」覆盖，改列宽后不会失配。 */
#ptable { min-width: 1530px; }
#dtable { min-width: 1596px; }   /* 设备台账列宽合计（周期/等级/录入时间加宽后），窄屏横向滑动不挤压 */
#stable { min-width: 1630px; }   /* 备件台账：与设备/申购一致，避免窄屏下 sticky 表头与表体因滚动条错位 */
#ltable { min-width: 1358px; }   /* 保养计划：列宽合计，窄屏横向滑动 */
/* 计划日期格：日期徽章 + 逾期天数必须整行放得下，不能溢出压到「状态」列 */
#ltable td[data-col="next_date"] { overflow: hidden; white-space: nowrap; }
.od-days { white-space: nowrap; }
#otable { min-width: 1050px; }   /* 作业单列表：列少，别继承 .wide-table 的 1360 撑出横条 */

/* 当前生效的筛选条件（可逐个取消 / 一键清空） */
.afilters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 2px 0 8px; padding: 7px 10px;
  background: #EEF3FA; border: 1px solid #CFDCEF; border-radius: var(--radius);
}
.afilters .af-label { font-size: 12.5px; color: var(--primary); font-weight: 600; }
.aftag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #D3DEEE; border-radius: 12px;
  padding: 1px 2px 1px 9px; font-size: 12.5px; color: var(--text);
}
.aftag b { font-weight: 600; }
.af-x {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 5px; border-radius: 50%;
}
a.af-x { text-decoration: none; display: inline-flex; align-items: center; }
.af-x:hover { background: #E3E8EF; color: var(--text); }
.afilters .af-clear { margin-left: auto; }

/* 统计卡：当前正处于该筛选时高亮 */
.p-stats .stat.on { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47,85,151,.15); }
.p-stats .stat.on .label { color: var(--primary); font-weight: 600; }
.p-stats a.stat { text-decoration: none; color: inherit; }
.p-stats a.stat:hover { border-color: var(--primary); }

/* ---------- 台账顶部紧凑布局：尽量把纵向空间留给表格 ---------- */
.p-stats.compact { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.p-stats.compact .stat {
  min-height: 0; padding: 4px 12px; border-radius: 14px;
  display: flex; flex-direction: row; align-items: baseline; gap: 7px;
}
.p-stats.compact .stat .label { font-size: 12.5px; }
.p-stats.compact .stat .value { font-size: 16px; font-weight: 600; margin-top: 0; line-height: 1.35; }
.p-stats.compact .stat .hint { display: none; }
.p-stats.compact .stat.on .label::after { content: ' ✓'; color: var(--primary); font-weight: 700; }

/* 首行只放：关键字 + 按钮组 */
.filters.tight { gap: 8px; margin-bottom: 0; align-items: center; }
.filters.tight .field.grow { flex: 1 1 260px; min-width: 220px; }
.filters.tight .field.grow .q-wrap { display: block; }
.filters.tight .field.grow input { width: 100%; }

/* 「更多筛选」折叠区：默认收起，用到才展开 */
details.more { margin-top: 8px; }
details.more > summary {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: 12.5px; color: var(--primary); user-select: none; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸'; font-size: 10px; }
details.more[open] > summary::before { content: '▾'; }
details.more .filters { margin: 8px 0 0; }

/* 筛选标签条与计数同一行 */
.fmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; }
.fmeta .afilters { flex: 1 1 auto; margin: 0; }
.fmeta .list-count { flex: 0 0 auto; padding: 0; }

/* 台账分页条：左「上一页/页码/下一页」，中间总数与第几页，右侧每页条数 */
.pager {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 10px 2px 2px;
}
.pager .btn.is-disabled { opacity: .4; pointer-events: none; }
.pager-nums { display: inline-flex; align-items: center; gap: 2px; }
.pager-num, .pager-cur, .pager-gap {
  min-width: 30px; height: 28px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #E6E4DC); border-radius: 6px;
  font-size: 13px; color: var(--text, #2C2A26); background: #fff; text-decoration: none;
}
.pager-num:hover { border-color: var(--primary); color: var(--primary); }
.pager-cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager-gap { border: 0; background: none; }
.pager-info { margin-left: 4px; font-size: 12.5px; color: var(--muted); }
.pager-size { margin-left: auto; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.pager-size select {
  border: 1px solid var(--border, #E6E4DC); border-radius: 6px;
  padding: 3px 6px; font-size: 12.5px; background: #fff; color: var(--text, #2C2A26);
}

/* 带分页条的表格卡片：表体在 .p-scroll 里滚（表头 sticky），分页条固定在卡片底部。
   与设备台账/申购台账同一套外壳，只是它们用虚拟滚动、这里用服务端分页。 */
.p-table-wrap.has-pager { display: flex; flex-direction: column; overflow: hidden; }
.p-table-wrap.has-pager > .p-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.p-table-wrap.has-pager > .pager {
  flex: 0 0 auto; margin: 0; padding: 7px 12px;
  border-top: 1px solid var(--border); background: #FCFCFA;
}

/* 表头排序标记：未排序列淡灰双向箭头，当前列蓝色高亮 */
.s-mark { margin-left: 2px; font-size: 11px; color: #B4BCC8; }
.s-mark.on { color: var(--primary); font-weight: 700; }

/* 计划列表：勾选多台合并成作业单 */
table.data th.sel, table.data td.sel { width: 34px; padding: 0 4px 0 8px; text-align: center; }
table.data td.sel input { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
table.data td.sel input:disabled { cursor: not-allowed; opacity: .45; }
table.data tr.picked td { background: #F2F7FD; }
table.data tr.picked td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.p-table-wrap tbody tr.picked td:first-child { background: #F2F7FD; }

/* 站内待办提醒：导航角标 + 看板横幅 */
.nav-badge {
  margin-left: 6px; display: inline-block; min-width: 17px; height: 17px; line-height: 17px;
  padding: 0 4px; border-radius: 9px; background: #E24B4A; color: #fff;
  font-size: 11px; text-align: center; vertical-align: 1px;
}
.nav-badge.soon { background: #EF9F27; }
.todo-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.todo-bar .todo-links { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* 作业单：计划已变更、归档时被跳过的行 */
table.data tr.row-skip td { background: #FFFBF2; }
table.data tr.row-skip td:first-child { box-shadow: inset 3px 0 0 #EF9F27; }

/* 搜索语法说明：默认收起的一行小字 */
details.qhelp { margin-top: 6px; }
details.qhelp > summary {
  cursor: pointer; font-size: 12px; color: var(--muted);
  display: inline-block; list-style: none;
}
details.qhelp > summary::-webkit-details-marker { display: none; }
details.qhelp > summary::before { content: '? '; }
details.qhelp > summary:hover { color: var(--primary); }
details.qhelp .qhelp-body { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 关键字输入框右侧的清空按钮 */
.q-wrap { position: relative; display: inline-block; }
.q-wrap > input { padding-right: 26px; }
.q-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; line-height: 17px; text-align: center;
  border: 0; border-radius: 50%; background: #dcdfe4; color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; display: none;
}
.q-wrap.has-value .q-clear { display: block; }
.q-clear:hover { background: #b6bcc6; }

/* 轻提示 */
.eam-toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 10px);
  background: rgba(28, 33, 40, .92); color: #fff; padding: 8px 16px;
  border-radius: 6px; font-size: 13px; z-index: 9999; opacity: 0;
  pointer-events: none; transition: opacity .18s, transform .18s;
}
.eam-toast.show { opacity: 1; transform: translate(-50%, 0); }
table.data.fixed td { vertical-align: top; }
.p-table-wrap thead th {
  position: sticky; top: 0; z-index: 6;
  background: #FAFBFC;
  box-shadow: inset 0 -1px 0 var(--border);
}
.p-table-wrap thead th:first-child { z-index: 8; }
.p-table-wrap tbody td:first-child { position: sticky; left: 0; z-index: 4; background: #fff; }
.p-table-wrap thead th:first-child { left: 0; }
.p-table-wrap tbody tr:hover td:first-child { background: #FAFBFD; }
/* 计划列表首列是勾选框：横向滑动时让它跟着走，改吸附「设备编号」——设备再多也能对上号 */
#ltable thead th:first-child { left: auto; }
#ltable tbody td:first-child { position: static; }
#ltable thead th:nth-child(2) {
  position: sticky; top: 0; left: 0; z-index: 8;
  box-shadow: inset 0 -1px 0 var(--border), 1px 0 0 var(--border);
}
#ltable tbody td:nth-child(2) {
  position: sticky; left: 0; z-index: 4;
  background: #fff; box-shadow: 1px 0 0 var(--border);
}
#ltable tbody tr:hover td:nth-child(2) { background: #FAFBFD; }
#ltable tbody tr.picked td:nth-child(2) { background: #F2F7FD; }
td.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrapc { white-space: normal; word-break: break-word; }
/* 虚拟滚动行：统一行高（滚动条比例才准确），名称两行截断、其余单行省略；
   上下占位行（.vsp）撑出真实滚动高度，本身不显示 */
#vBody td { height: 36px; padding: 2px 10px; vertical-align: middle; overflow: hidden; }
/* 名称格最多两行。
   注意：截断（-webkit-line-clamp）必须落在这格的内层元素上。
   若直接给 td 设 display:-webkit-box，该 td 就不再是 table-cell，
   会导致它不随行高拉伸、文字被顶到行顶部——整行看起来"名称串行/错位"。 */
#vBody td.v-name { height: 36px; }
#vBody td.v-name > .v-ntxt {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal; word-break: break-all;
  line-height: 15px; max-height: 30px;
}
#vBody tr.vsp td { padding: 0; border: 0; }

/* ========== 表头：排序链接 + 列筛选箭头（类 Excel） ========== */
.p-table-wrap thead th .th-in { display: flex; align-items: center; gap: 1px; min-width: 0; }
.p-table-wrap thead th.num .th-in { justify-content: flex-end; }
/* 表头标题必须完整显示：列宽不够时换行（最多两行），不再用省略号截断。
   注意 table.data th 上是 white-space:nowrap，这里必须显式覆盖成 normal，
   否则「品牌/代理商」「交货情况（自动）」这类长标题会被压成「品牌/代…」。 */
.th-sort { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: break-word; line-height: 1.25; color: inherit; }
.th-sort:hover { color: var(--accent, #1a73e8); }
.th-nosort { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: break-word; line-height: 1.25; }
.th-f {
  flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
  color: #a8b0ba; font-size: 10px; line-height: 1; padding: 3px 2px 3px 3px;
  border-radius: 3px;
}
.th-f:hover { background: #E8EDF2; color: #41505f; }
th.th-on .th-f { color: #fff; background: #1a73e8; }
th.th-on .th-sort, th.th-on .th-nosort { color: #1a73e8; font-weight: 600; }

/* ========== 列筛选弹窗（cfpop） ========== */
.cfpop {
  position: fixed; z-index: 960; width: 272px; max-width: 92vw;
  background: #fff; border: 1px solid #D7DCE2; border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
  display: flex; flex-direction: column; font-size: 13px; color: #1f2933;
}
.cfpop[hidden] { display: none; }
.cfpop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid #ECEFF3; font-weight: 600; font-size: 13px;
}
.cfpop-x { border: 0; background: transparent; font-size: 16px; line-height: 1; cursor: pointer; color: #8A929C; padding: 0 2px; }
.cfpop-x:hover { color: #1f2933; }
/* 「当前生效」行：打开面板就看见本列已筛成什么样，可一键清除 */
.cf-cur {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; border-bottom: 1px solid #ECEFF3; background: #F7F9FC;
}
.cf-cur b { font-weight: 600; }
.cf-cur.muted { color: var(--muted); }
.cf-cur #cfCurClear { margin-left: auto; }
.cfpop-body { padding: 8px 10px; overflow: auto; max-height: 308px; }
.cf-search input, .cf-txt input, .cf-text input {
  width: 100%; box-sizing: border-box; padding: 5px 8px; margin-bottom: 6px;
  border: 1px solid #D7DCE2; border-radius: 5px; font-size: 13px; outline: none;
}
.cf-search input:focus, .cf-txt input:focus, .cf-text input:focus { border-color: #1a73e8; }
.cf-text { margin-bottom: 6px; }
.cf-list { display: flex; flex-direction: column; }
.cf-item { display: flex; align-items: center; gap: 7px; padding: 3px 3px; cursor: pointer; border-radius: 4px; }
.cf-item:hover { background: #F3F6F9; }
.cf-item input { margin: 0; flex: 0 0 auto; }
.cf-item .cf-v { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-item .cf-n { flex: 0 0 auto; color: #98A1AB; font-size: 11px; }
.cf-item.cf-allitem { font-weight: 600; border-bottom: 1px solid #ECEFF3; margin-bottom: 4px; padding-bottom: 5px; }
.cfpop-foot { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid #ECEFF3; }
.cf-flex { flex: 1 1 auto; }
/* 范围列（日期起止）：两个日期输入框 + 说明行 */
.cf-range { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.cf-range label { display: flex; align-items: center; gap: 8px; }
.cf-range label span { flex: 0 0 auto; color: #5b6672; font-size: 12px; }
.cf-range input {
  flex: 1 1 auto; min-width: 0; padding: 5px 8px;
  border: 1px solid #D7DCE2; border-radius: 5px; font-size: 13px; outline: none;
}
.cf-range input:focus { border-color: #1a73e8; }
.cf-hint { color: #98A1AB; font-size: 11.5px; line-height: 1.5; }

/* 统计卡紧凑排布 + 固定高度（防止加载时高度跳动） */
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.p-stats { gap: 10px; margin-bottom: 10px; }
.p-stats .stat { padding: 9px 12px; min-height: 76px; display: flex; flex-direction: column; justify-content: center; }
.p-stats .stat .value { font-size: 22px; }

/* 搜索范围多选 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 14px;
  padding: 3px 10px; font-size: 12.5px; background: #fff; cursor: pointer;
  user-select: none;
}
.chip input { margin: 0; }
.chip.on { border-color: var(--primary); background: #EEF4FD; color: var(--primary); }

/* 责任产线多选（用户管理）：25+ 条产线要能滚动，别把弹层顶开 */
.chips-box {
  max-height: 168px; overflow-y: auto; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 8px; background: #FCFCFD;
}
.chips-box .chips { gap: 5px; }
/* 列表里的产线徽章：一行放不下就换行，避免把表格撑出横向滚动条 */
/* 负责产线全部列出，不折叠成 +N：要看清某人到底管几条，靠 hover 猜不合适 */
.lines-cell { min-width: 190px; max-width: 380px; }
.lines-cell .badge { margin: 0 3px 3px 0; }
.users-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.users-filter input[type=text] { min-width: 200px; }

/* 产线负责人：折叠卡片 + 紧凑网格（一条产线一格，收起时只占一行高） */
.line-card { padding: 12px 16px; }
.line-card > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px;
  user-select: none;
}
.line-card > summary::-webkit-details-marker { display: none; }
.line-card > summary .line-title { font-size: 14px; font-weight: 500; }
.line-card > summary .sub { flex: 1; font-size: 12px; color: var(--muted); }
.line-card > summary .line-caret { color: var(--muted); font-size: 11px; transition: transform .15s; }
.line-card[open] > summary { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.line-card[open] > summary .line-caret { transform: rotate(180deg); }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 7px; }
.line-cell { border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px 7px; background: #fff; }
.line-cell.no-owner { border-color: #EFB3B3; background: #FDF8F8; }
/* 外协线：橙系标记，与「无人负责」的红区分开——外协是正常状态，无人是待办 */
.line-cell.outsourced { border-color: #EFC98B; background: #FFFCF6; }
.owner-vendor { color: #854F0B; font-weight: 600; }
.vendor-text { color: #854F0B; }
.assign-vendor { margin-top: 8px; }
.assign-vendor input[type=text] { width: 100%; box-sizing: border-box; font-size: 12px; margin-top: 4px; }
.vendor-tog { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.vendor-tog input { margin: 0; }
.lc-hd { display: flex; align-items: center; gap: 6px; }
.line-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-dev { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.line-flag { font-size: 10.5px; color: #854F0B; background: #FAEEDA; border-radius: 6px; padding: 0 4px; }
.line-edit { font-size: 11.5px; color: var(--primary); cursor: pointer; flex: none; }
.line-edit:hover { text-decoration: underline; }
.lc-bd { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; line-height: 1.5; }
.owner { color: #185FA5; }
.owner.off { color: var(--muted); text-decoration: line-through; }
.owner-none { color: #A32D2D; }

.assign-pop { position: relative; display: inline-block; flex: none; }
.assign-pop > summary { list-style: none; cursor: pointer; display: inline-block; }
.assign-pop > summary::-webkit-details-marker { display: none; }
.assign-pop[open] > summary { color: var(--primary); font-weight: 600; }
.assign-panel {
  position: absolute; right: 0; top: 24px; z-index: 40; width: 276px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 11px; box-shadow: 0 10px 28px rgba(0,0,0,.14); text-align: left;
}
.assign-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.assign-panel .chips-box { max-height: 176px; }
.assign-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.warn-text { color: #A32D2D; }
.qhelp { font-size: 12px; color: var(--muted); margin-top: 2px; }
.qhelp code { background: #F1F3F7; border-radius: 4px; padding: 0 4px; }

/* 详情弹窗（比删除弹窗低一层，保证删除弹窗盖在上面） */
#detailModal { z-index: 860; }
#photoModal { z-index: 900; }
#delModal { z-index: 920; }
/* 设备详情弹窗：全站通用（app.js 动态创建），加宽以容纳变更履历等表格 */
#detailModal .modal-box { width: min(1180px, 96vw); max-height: 88vh; }
#detailModal .modal-body table.data { font-size: 13px; }
#detailModal .kv { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
/* 长文件名/长串在单元格内断行，表格按容器宽度收缩，杜绝弹窗底部横向滚动条 */
#detailModal .modal-body { overflow-x: auto; }
#detailModal .modal-body table.data { width: 100%; table-layout: fixed; }
#detailModal .modal-body table.data th,
#detailModal .modal-body table.data td {
  word-break: break-word; overflow-wrap: anywhere; vertical-align: top;
}
#detailModal .modal-body .tdoc-name { max-width: 100%; }

/* ========== 变更履历 · 转移单关联 ========== */
.lnk {
  border: 0; background: none; padding: 0 2px; margin: 0;
  font-size: 12px; color: var(--primary); cursor: pointer; text-decoration: none;
}
.lnk:hover { text-decoration: underline; }
.lnk.danger { color: var(--danger); }
.tdoc-cell { vertical-align: top; }
.tdocs { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.tdoc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.tdoc-name {
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word; line-height: 1.4;
  font-size: 12px; color: var(--primary);
}
.tdoc-tag {
  font-size: 10.5px; color: var(--muted); border: 1px solid var(--border, #E6E4DC);
  border-radius: 4px; padding: 0 3px;
}
.tdoc-act { display: inline-flex; gap: 4px; align-items: baseline; }
.tdoc-act form { display: inline; }
.tdoc-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tdoc-btns form { display: inline; }
.tpick {
  margin-top: 6px; border: 1px solid var(--border, #E6E4DC); border-radius: 8px;
  background: #FAFAF7; padding: 8px 10px; max-height: 260px; overflow: auto;
}
.tpick-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tpick-head code { font-size: 11px; }
/* 筛选栏冻结：滚动时表头与筛选输入框固定在顶部 */
.tpick-bar {
  position: sticky; top: 0; z-index: 2;
  margin: -8px -10px 0; padding: 8px 10px 2px;
  background: #FAFAF7;
  border-bottom: 1px solid var(--border, #E6E4DC);
}
.tpick-list form { display: block; }
.tpick-item {
  display: flex; align-items: flex-start; gap: 6px; padding: 6px 0;
  font-size: 12px; cursor: pointer; border-bottom: 1px dashed var(--border, #EFEDE6);
}
.tpick-item:last-of-type { border-bottom: 0; }
.tpick-item:hover { background: #F3F2EC; }
.tpick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tpick-name { word-break: break-word; overflow-wrap: anywhere; line-height: 1.45; color: var(--text, #2C2A26); }
.tpick-meta { display: inline-flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tpick-hit { font-style: normal; font-size: 10.5px; color: #3B6D11; background: #EAF3DE; border-radius: 4px; padding: 0 4px; }
.tpick-submit { margin-top: 8px; text-align: right; }

/* 挑选器：筛选框 / 计数 / 提交栏两端布局 */
.tpick-count { margin-left: 6px; }
.tpick-q {
  width: 100%; box-sizing: border-box; margin-bottom: 6px;
  border: 1px solid var(--border, #E6E4DC); border-radius: 6px;
  padding: 5px 9px; font-size: 12px; background: #fff; color: var(--text, #2C2A26);
}
.tpick-q:focus { outline: none; border-color: var(--primary); }
.tpick-submit { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ========== 设备异动弹层（详情弹窗之上第二层） ========== */
#moveModal { z-index: 870; }
.mv-box { width: min(640px, 94vw); }
/* ========== 设备编辑弹窗（最上层；编辑中禁点遮罩关闭） ========== */
#editModal { z-index: 880; }
.edit-box { width: min(760px, 94vw); }
.mv-row { margin-bottom: 12px; }
.mv-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.mv-label em { font-style: normal; font-weight: 400; color: var(--muted);
  font-size: 12px; margin-left: 6px; }
.mv-label .mv-tip { color: var(--primary); }
.mv-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border, #E6E4DC); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; background: #fff; color: var(--text, #2C2A26);
}
.mv-input:focus { outline: none; border-color: var(--primary); }
textarea.mv-input { resize: vertical; min-height: 52px; }
.mv-grp { border-left: 3px solid #EEF4FD; padding-left: 12px; margin-bottom: 12px; }
.mv-sep { font-size: 13px; font-weight: 600; margin: 4px 0 10px; color: var(--primary); }
.mv-hint { font-size: 12px; color: var(--muted); margin: 2px 0 8px; line-height: 1.6; }
.mv-hint code { background: #F1F3F7; border-radius: 4px; padding: 0 4px; }
/* ========== 新增设备弹窗（两种模式：从零填写 / 沿用已有） ========== */
#newModal { z-index: 880; }
.nv-mode { display: flex; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; }
.nv-mode-i { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.nv-mode-i input { margin: 0; }
.nv-copy { border-left: 3px solid #EEF4FD; padding-left: 12px; margin-bottom: 14px; }
.nv-note { color: var(--success); }
.nv-code-hint { font-size: 12px; line-height: 1.5; margin-top: 4px; }
.nv-code-hint.ok { color: var(--success); }
.nv-code-hint.bad { color: var(--danger); }
.req { color: #D23B3B; font-style: normal; margin-left: 2px; }
.mv-fname {
  font-size: 12px; color: #3B6D11; background: #F2F8EC;
  border-radius: 6px; padding: 6px 9px; margin: 4px 0 6px; word-break: break-all;
}
.mv-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border, #E6E4DC);
}
.mv-result {
  background: #F2F8EC; border: 1px solid #CFE6B8; color: #3B6D11;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
  word-break: break-all; line-height: 1.6;
}

/* ========== 台账数据加载失败提示条 ==========
   用处：purchases / devices / spares 三个台账页的数据接口失败时，由 showLoadError()
   动态插到 #vWrap（表格区）上方，替代旧的「失败即自动跳 mode=full」。
   语义 = 就地提示 + 【重试】+ 用户主动【切换到整页模式（较慢）】。
   只新增这一条提示的外观，字色/描边全部取 :root 里的 --danger 系列，
   按钮复用 .btn / .btn-sm，观感与全站一致。 */
.load-error {
  flex: 0 0 auto;                 /* 父级 .content 是 flex 列，别被表格压扁 */
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 0 0; padding: 7px 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
}
.load-error .le-msg { flex: 1 1 240px; min-width: 0; line-height: 1.5; }
.load-error .le-msg b { font-weight: 600; }
.load-error .le-why { font-size: 12.5px; word-break: break-word; }  /* 不用 opacity 降级：--danger 对 --danger-bg 约 6.1:1，降透明度会掉到 4.2:1 不足 AA */
.load-error .le-acts { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.load-error .btn { color: var(--danger); border-color: var(--danger-border); background: var(--card); }
.load-error .btn:hover { background: var(--danger-bg); text-decoration: none; }
.load-error .btn:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
@media (max-width: 720px) {
  .load-error { padding: 8px 10px; gap: 8px; }
  .load-error .le-acts { width: 100%; flex-wrap: wrap; }   /* 窄屏：按钮移到下一行 */
  .load-error .le-acts .btn {
    flex: 1 1 100%;                 /* 各占一整行，长按钮文案不被挤成多行 */
    min-height: 34px;               /* 手指点得到 */
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* ===== 生成作业单确认弹窗：设备清单 + 执行信息，底栏 sticky ===== */
#orderModal { z-index: 890; }
/* min-width:0：.modal-box 是 flex 项，不写会被表格的 min-content 撑破窄屏 */
#orderModal .modal-box { width: min(920px, 94vw); max-height: 86vh; min-width: 0; }
#orderModal .modal-body { overflow-x: auto; }
#orderModal .filters { margin-bottom: 6px; }
#orderModal .field input[type=date] { min-width: 152px; }
#orderModal #ordExec { min-width: 190px; }
#ordTable { min-width: 640px; }
#ordTable td, #ordTable th { padding-top: 6px; padding-bottom: 6px; }
#ordTable .btn-sm { padding: 2px 8px; font-size: 12px; }

/* ===== 申购编辑弹层（M-02）：字段多，加宽到 960；底栏 sticky ===== */
#purchEditModal { z-index: 880; }
#purchEditModal .modal-box { width: min(960px, 94vw); max-height: 88vh; }
#delModal .modal-box { width: min(520px, 96vw); }
/* 负 margin 抵消 .modal-body 的 padding(14px 16px)：左右 -16 让底栏与内容区边界重合
   且不超出 padding box（无横向滚动条），底部 -14 抵掉 padding-bottom。 */
.edit-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  margin: 10px -16px -14px; padding: 10px 16px;
  background: #fff; border-top: 1px solid var(--border);
}

/* ===== 申购新增/编辑表单的横向自适应（窄屏不挤压、不溢出） ===== */
.inline-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-row input { flex: 1 1 220px; min-width: 0; }   /* 单号输入可收缩，按钮换行不撑破 */
.modal-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .modal-box { max-width: calc(100vw - 16px); }
  #orderModal .filters .field { flex: 1 1 100%; min-width: 0; }
  #orderModal .field input[type=date],
  #orderModal #ordExec { min-width: 0; width: 100%; }
  #orderModal #ordFootHint { flex: 1 1 100%; order: 2; }
  #ordTable { min-width: 560px; }
  #purchEditModal .modal-box, #detailModal .modal-box { width: 96vw; }
  .edit-foot { flex-wrap: wrap; }
  .edit-foot #peditHint { flex: 1 1 100%; order: 2; }
}

/* ===== 申购台账列宽（14 列；「操作」列已移除，改由详情弹层操作；
   「采购单照片」「附清单」两列也已移除，照片/清单改在详情弹层内查看） =====
   列序 1..14：采购单号/名称/规格/品牌/单价/数量/金额/商品链接/用途/申请日期/申请人/
               希望交期/到货日期/交货情况
   列宽之和 1225，与设备台账/备件台账同一套做法：窄屏一列都不收起，
   整表交给 .p-table-wrap 横向滑动（首列 sticky 跟手），14 列数据随时都能看到。

   历史：这里曾按视口逐档收起列（≤1600 收商品链接+申请人、≤1450 收品牌+申请日期、
   ≤1260 收用途+希望交期、≤960 收规格+单价、≤750 收数量+到货日期），
   且 ≤1919 把 min-width 归零——结果是 1366/1440 笔电上「既看不全也滑不动」，
   和设备台账（1460 定宽、可横滑）行为不一致，用户反馈后整段移除。 */

/* 表头：整格可点排序；有生效筛选时 ▾ 按钮高亮，避免"忘了自己筛过什么" */
#ptable thead th { cursor: pointer; }
#ptable thead th .th-f { cursor: pointer; }
#ptable .th-on .th-f { color: #fff; background: var(--primary); border-radius: 3px; }
#ptable .th-on .th-sort { color: var(--primary); }

/* ==========================================================================
   移动端适配（≤ 860px）
   --------------------------------------------------------------------------
   要点：侧栏 190px 在 390px 手机上占了近一半屏宽，正文只剩 150px 左右，
   统计卡被迫一行一个、顶栏账号信息折成三行。此段把侧栏改成左侧抽屉
   （点顶栏菜单键滑出、点遮罩/菜单项/Esc 收起），正文恢复满宽。

   桌面端零影响：媒体查询之外的唯一改动，是「菜单键 / 遮罩 / 抽屉内账号区
   默认 display:none」，桌面既看不到也点不到。
   ========================================================================== */
.nav-btn, .nav-close, .nav-user, .nav-mask { display: none; }
.sidebar .brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.topbar .u-role { color: var(--muted); }
.topbar .u-pwd, .topbar .u-out { margin-left: 12px; }

/* 手机地址栏会伸缩：能用 dvh 就用动态视口高度，避免底部被裁 */
@supports (height: 100dvh) {
  body.p-fixed .layout, body.p-fixed .main { height: 100dvh; }
}

@media (max-width: 860px) {

  /* ---------- 1. 侧栏 → 抽屉 ---------- */
  .layout { display: block; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: auto;
    width: 268px;
    max-width: 82vw;
    flex: none;
    z-index: 950;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .22s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .22s;
    box-shadow: 6px 0 24px rgba(15, 23, 42, .25);
    overscroll-behavior: contain;
  }
  .layout.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform .22s cubic-bezier(.4, 0, .2, 1), visibility 0s linear 0s;
  }
  body.nav-lock { overflow: hidden; }          /* 抽屉打开时锁住页面滚动 */

  .nav-mask {
    display: block;
    position: fixed; inset: 0;
    z-index: 940;
    background: rgba(17, 24, 39, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .layout.nav-open .nav-mask { opacity: 1; pointer-events: auto; }

  /* 抽屉里的字号/行高按手指来，别照搬桌面 */
  .sidebar .brand { padding: 14px 14px 12px; font-size: 15px; }
  .nav-close {
    display: block; flex: none;
    width: 28px; height: 28px; padding: 0; line-height: 1;
    border: 0; border-radius: 6px;
    background: rgba(255, 255, 255, .1); color: #CBD5E1; font-size: 20px;
  }
  .sidebar nav { padding: 6px 0 10px; }
  .sidebar nav a { padding: 12px 18px; font-size: 14.5px; }
  .sidebar .group { padding: 14px 18px 5px; }

  .nav-user {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, .1);
  }
  .nu-who { min-width: 0; }
  .nu-who b {
    display: block; color: #fff; font-weight: 500; font-size: 13.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .nu-who span { display: block; font-size: 11.5px; color: #94A3B8; }
  .nu-acts { display: flex; flex: none; gap: 6px; }
  /* .nu-out 同时用在 <a>（退出）和 <button>（改密码）上，按钮需清掉原生外观 */
  .nu-out {
    flex: none; color: #CBD5E1; border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 6px; padding: 5px 12px; font-size: 12.5px;
    background: none; font-family: inherit; cursor: pointer;
  }
  .nu-out:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }

  /* ---------- 2. 顶栏：菜单键 + 页面标题（账号信息移入抽屉） ---------- */
  .topbar { padding: 8px 10px; gap: 10px; }
  .topbar h1 {
    flex: 1 1 auto; min-width: 0;
    font-size: 15.5px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar .user { display: none; }
  .nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 34px; height: 34px; padding: 0;
    border-radius: 8px; color: var(--nav-bg); background: #fff;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-btn:active { background: #EDF2F9; }

  /* ---------- 3. 正文留白与卡片 ---------- */
  .content { padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px)); }
  body.p-fixed .content { padding: 10px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 12px; margin-bottom: 12px; }
  .card > h2 { font-size: 13.5px; margin-bottom: 10px; padding-bottom: 8px; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 10px 12px; }
  .stat .value { font-size: 22px; }
  .chart-box { height: 220px; }

  .kv { grid-template-columns: 1fr; gap: 8px; }
  .kv .item .k { flex: 0 0 76px; min-width: 76px; }
  .row-item { flex-wrap: wrap; gap: 4px 10px; }
  .row-item .r { white-space: normal; }

  /* ---------- 4. 统计卡：两列铺满，不再一行一个 ---------- */
  .p-stats.compact { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
  .p-stats.compact .stat { justify-content: space-between; padding: 6px 10px; border-radius: 10px; }
  .p-stats.compact .stat .label { font-size: 12px; }
  .p-stats.compact .stat .value { font-size: 17px; }

  /* ---------- 5. 筛选区：输入框整行、按钮等分一行 ---------- */
  .filters { gap: 8px; margin-bottom: 10px; }
  .filters .field { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filters .field.grow,
  .filters.tight .field.grow { flex: 1 1 100%; min-width: 0; }
  .filters input, .filters select { width: 100%; min-width: 0; }
  /* 只管表单里的按钮（> 直接子元素）；.q-clear 是输入框里的 18px 圆钮，别被撑大 */
  .filters > .btn, .filters > button {
    flex: 1 1 auto; min-height: 36px; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .q-wrap { display: block; }
  .fmeta { gap: 6px; }
  .afilters { padding: 6px 8px; }
  .p-head .card { padding: 10px; }
  .p-head .small { font-size: 12px; line-height: 1.55; }

  /* ---------- 6. 表格：卡片里的表原地横向滚动，不撑破页面 ---------- */
  .card table.data {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.data th, table.data td { padding: 7px 8px; }
  .p-table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  /* 台账首列 sticky：加一条右侧分隔线，提示「右边还有内容，可以横向滑」 */
  .p-table-wrap thead th:first-child { box-shadow: inset 0 -1px 0 var(--border), 1px 0 0 var(--border); }
  .p-table-wrap tbody td:first-child { box-shadow: 1px 0 0 var(--border); }

  /* ---------- 7. 抽屉 / 弹层铺满屏宽 ---------- */
  .drawer { width: 100%; }
  .drawer-head { padding: 10px 12px; }
  .drawer-body { padding: 12px; }
  .modal-box { max-width: calc(100vw - 16px); }
  .edit-foot { flex-wrap: wrap; }

  /* ---------- 8. 登录页 ---------- */
  .login-box { width: calc(100vw - 32px); max-width: 360px; padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-mask { transition: none; }
}

/* 只读台账整行可点：选择器必须用本页的表 id 限定，不能写共用 tbody id
   （三张台账的 tbody 都叫 vBody）——否则申购/设备台账的行也会变手型光标。 */
#ftable tr[data-id] { cursor: pointer; }
/* 与 #ptable/#dtable/#stable 一致地设最小宽度：9 列合计固定宽 880px + 弹性列，
   窄屏不设会让「异常情况」被压到不可读，且 sticky 首列与表体在极限宽度下错位。 */
#ftable { min-width: 1160px; }

/* ---------- 维修记录：固定表格 / 长文本段 / 过程时间线 ---------- */
#rtable { min-width: 1170px; }
#rtable tr[data-href] { cursor: pointer; }
/* 定宽表格里的长文本列：单行省略，完整内容看 title 或进详情 */
table.data td.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rtext { margin-top: 14px; }
.rtext .rt-k { font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.rtext .rt-k:first-child { margin-top: 0; }
.rtext .rt-v {
  white-space: pre-wrap; line-height: 1.7; padding: 9px 11px;
  background: #FBFBF9; border: 1px solid var(--border); border-radius: var(--radius);
}

/* 维修过程时间线：竖线 + 圆点，按时间正序读下来就是这台设备的维修经过 */
.rlog { list-style: none; margin: 4px 0 0; padding: 0; }
.rlog li { position: relative; margin-left: 5px; padding: 0 0 14px 18px; border-left: 2px solid #D8DFE9; }
.rlog li:last-child { border-left-color: transparent; padding-bottom: 2px; }
.rlog li::before {
  content: ''; position: absolute; left: -6px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.rlog .rl-h {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  font-size: 12.5px; color: var(--muted);
}
.rlog .rl-h b { font-size: 13px; color: var(--text); }
.rlog .rl-n { white-space: pre-wrap; line-height: 1.65; margin-top: 3px; }

/* 表单里的四字段一行：维修记录登记页的「日期/人/状态/停机」固定四列，
   比 auto-fit 更稳定（auto-fit 在 1160px 会排成 3 列 + 1 个孤零零的字段）。 */
.grid-4x { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid-4x { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-4x { grid-template-columns: 1fr; } }

/* 维修记录详情标题：窄屏时按钮组整体换到下一行，避免把设备名挤成一列字 */
@media (max-width: 620px) {
  .card > h2.r-head { flex-wrap: wrap; row-gap: 8px; }
  .card > h2.r-head .sub { width: 100%; justify-content: flex-start; }
}

/* ---------- 维修记录表单：设备编号联想（不强制选台账） ---------- */
.req { color: var(--danger); font-weight: 600; }
.code-wrap { position: relative; }
.code-wrap > input { width: 100%; }
.code-tips {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 30, 55, .12); padding: 4px; max-height: 268px; overflow: auto;
}
.code-tips[hidden] { display: none; }
.ct-row {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text); line-height: 1.45;
}
.ct-row:hover { background: #F2F6FC; }
.ct-row b { font-weight: 600; }
.ct-row span { color: var(--muted); }
.ct-row em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ct-none { font-size: 12px; color: var(--muted); padding: 7px 9px; }

/* 详情页内联改维修人（仅管理员可见）：一行输入 + 保存，不弹窗 */
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit select { width: auto; min-width: 132px; max-width: 190px; padding: 3px 6px; font-size: 13px; }
.inline-edit .btn-sm { padding: 3px 8px; }

/* ---------- 维修记录：异常照片（上传预览 / 详情图集） ---------- */
.ph-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ph-item {
  position: relative; width: 132px; height: 132px; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; background: #fff; display: block; flex: 0 0 auto;
}
.ph-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.ph-item:hover { border-color: var(--primary); }
.ph-item:has(input:checked) img { opacity: .35; }
.ph-del {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px;
  display: flex; gap: 4px; align-items: center; justify-content: center;
}
.ph-del input { margin: 0; }
.ph-x {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; line-height: 18px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff;
  cursor: pointer; font-size: 14px; padding: 0;
}
.ph-x:hover { background: #C0392B; }
/* 待上传照片的状态条（压缩中 / 上传 45% / 失败·点重试） */
.ph-state {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px;
  background: rgba(0, 0, 0, .58); color: #fff; font-size: 11px; line-height: 16px;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 内部联络书：照片上传 / 列表 / 详情 ---------- */
.lp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.lp-item {
  position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fff; padding: 0 0 22px; min-height: 130px;
}
.lp-item.done { border-color: #97C459; }
.lp-item.err { border-color: #F09595; }
.lp-item > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #F4F6F9; }
.lp-x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; line-height: 22px;
  padding: 0; border-radius: 50%; font-size: 16px; color: var(--muted);
  background: rgba(255,255,255,.94); border: 1px solid var(--border); cursor: pointer;
}
.lp-x:hover { color: var(--danger); border-color: #F09595; }
.lp-st {
  position: absolute; left: 0; right: 0; bottom: 6px; padding: 0 6px;
  font-size: 11px; color: var(--muted); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-item.done .lp-st { color: var(--success); }
.lp-item.err .lp-st { color: var(--danger); }
.lp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #EDF0F4; }
.lp-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s ease; }
.lp-item.done .lp-bar i { background: var(--success); }
.lp-msg { margin-top: 10px; font-size: 13px; line-height: 1.7; min-height: 1.4em; }
.lp-msg.ok { color: var(--success); }
.lp-msg.bad { color: var(--danger); }
.lt-kpi { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.lt-kpi .k {
  flex: 1 1 118px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; padding: 10px 12px; font-size: 12.5px; color: var(--muted);
}
.lt-kpi .k b { display: block; font-size: 21px; color: var(--text); font-weight: 600; margin-top: 3px; }
.lt-thumb {
  width: 54px; height: 54px; border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; display: block; background: #F4F6F9; cursor: pointer; padding: 0;
}
.lt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lt-nophoto {
  width: 54px; height: 54px; border: 1px dashed #E0B4B4; border-radius: 6px;
  background: #FDF3F3; color: #A32D2D; font-size: 11px; line-height: 1.3;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.lt-tip {
  border-left: 4px solid #BA7517; background: #FFF8E8; padding: 10px 12px;
  border-radius: 6px; margin-bottom: 14px; font-size: 13px;
}
.lt-tip.bad { border-left-color: #C0392B; background: #FCEBEB; }
.lt-lightbox {
  border: 0; padding: 0; border-radius: 10px; max-width: 92vw; max-height: 92vh;
  background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.lt-lightbox::backdrop { background: rgba(0,0,0,.55); }
.lt-lightbox img { display: block; max-width: 92vw; max-height: 78vh; object-fit: contain; }
.lt-lightbox .lb-bar {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 12.5px; color: var(--muted);
}
.lt-miss {
  display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px;
  background: #FCEBEB; color: #A32D2D; font-size: 11px;
}
@media (max-width: 760px) {
  .lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lt-kpi .k { flex-basis: 30%; }
}
