/* 纬沃维修 ERP —— 网页端样式（唯一一份）
 *
 * 设计取向：**厂里的工具**。要的是"一眼看清、手指点得准"，不是花哨：
 *   - 大字号、大点击区（仓管戴手套也要点得到）
 *   - 数字右对齐、等宽，方便竖着比
 *   - 状态用色块，扫一眼就知道哪些单卡住了
 *   - 桌面与手机同一套模板，窄屏靠媒体查询折成卡片（不维护第二套）
 */

:root {
  --ink: #17212b;
  --ink-2: #4a5561;
  --muted: #7b8794;
  --line: #e3e7ec;
  --line-2: #eef1f5;
  --surface: #ffffff;
  --bg: #f4f6f9;
  --brand: #1f6feb;
  --brand-dark: #1657bd;
  --brand-soft: #eaf1ff;
  --ok: #17803d;
  --ok-soft: #e7f5ec;
  --warn: #a15c00;
  --warn-soft: #fdf3e2;
  --bad: #c22a35;
  --bad-soft: #fdecee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

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

/* ---------------- 页头 ---------------- */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
header.top .bar {
  max-width: 1180px; margin: 0 auto; padding: 12px 18px 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
header.top .brand {
  font-size: 17px; font-weight: 700; letter-spacing: .2px;
  margin-right: 4px;
}
header.top .brand span { color: var(--brand); font-weight: 800; }
header.top .badge-role {
  background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600;
}
header.top .who { color: var(--muted); font-size: 13.5px; }
header.top .spacer { flex: 1 1 auto; }

nav.menu {
  max-width: 1180px; margin: 0 auto; padding: 8px 18px 10px;
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
}
nav.menu::-webkit-scrollbar { display: none; }
nav.menu a, nav.menu button.link {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--ink-2);
  font: inherit; font-size: 14.5px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
nav.menu a:hover, nav.menu button.link:hover { background: var(--line-2); text-decoration: none; }
nav.menu a.on {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}
nav.menu form.inline { display: inline; margin: 0; }

/* ---------------- 正文 ---------------- */
main { max-width: 1180px; margin: 0 auto; padding: 20px 18px 48px; }

h1 { font-size: 21px; margin: 0 0 16px; letter-spacing: .2px; }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--ink-2); }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 16px;
}

ul.flash {
  list-style: none; margin: 0 0 16px; padding: 12px 14px;
  background: var(--ok-soft); border: 1px solid #bfe3cb; border-left: 4px solid var(--ok);
  border-radius: 8px; color: #125c2d;
}
p.error {
  color: var(--bad); background: var(--bad-soft);
  border: 1px solid #f5c2c7; border-left: 4px solid var(--bad);
  border-radius: 8px; padding: 10px 12px; margin: 10px 0;
}
p.hint { color: var(--muted); font-size: 13.5px; margin: 8px 0; }

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

table.list {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
table.list thead th {
  position: sticky; top: 0;
  background: #fafbfc; color: var(--muted);
  font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
  text-align: left; padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.list td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: #fbfcfe; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td .mono { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
table.list tr.low { background: #fffaf1; }
table.list tr.low:hover { background: #fff5e6; }

/* ---------------- 状态色块 ---------------- */
.badge {
  display: inline-block; border-radius: 999px;
  padding: 3px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-wait { background: #eef1f5; color: var(--ink-2); }         /* 待维修 */
.badge-doing { background: var(--brand-soft); color: var(--brand-dark); } /* 维修中 */
.badge-todo { background: var(--warn-soft); color: var(--warn); }  /* 待确认 */
.badge-done { background: var(--ok-soft); color: var(--ok); }      /* 已确认完成 */
.badge-dead { background: var(--bad-soft); color: var(--bad); }    /* 已放弃 */

/* ---------------- 按钮 ---------------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
a.btn, button, input[type=submit] {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
a.btn:hover, button:hover { background: var(--line-2); text-decoration: none; }
a.btn.primary, button.primary, button[type=submit] {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}
a.btn.primary:hover, button.primary:hover, button[type=submit]:hover {
  background: var(--brand-dark); border-color: var(--brand-dark);
}
a.btn.danger, button.danger {
  border-color: #f0b7bd; color: var(--bad); background: #fff;
}
a.btn.danger:hover, button.danger:hover { background: var(--bad-soft); }
form.inline { display: inline; margin: 0; }

/* ---------------- 表单 ---------------- */
form.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 20px 24px; max-width: 620px;
}
form.card label {
  display: block; margin: 16px 0 6px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
form.card label:first-of-type { margin-top: 0; }
form.card input, form.card select, form.card textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
form.card input:focus, form.card select:focus, form.card textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .16);
}
form.card textarea { min-height: 84px; resize: vertical; }
form.card button { margin-top: 22px; width: 100%; }

/* 筛选条 */
form.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 16px;
}
form.filters label { font-size: 13px; color: var(--muted); display: block; }
form.filters select, form.filters input {
  margin-top: 4px; padding: 9px 10px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 130px;
}
form.filters button { margin-top: 0; width: auto; }
form.filters a { padding: 10px 4px; }

/* ---------------- 详情页 ---------------- */
dl.detail {
  display: grid; grid-template-columns: 120px 1fr;
  gap: 0; margin: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
dl.detail dt {
  padding: 12px 14px; background: #fafbfc;
  color: var(--muted); font-size: 13.5px; font-weight: 600;
  border-bottom: 1px solid var(--line-2);
}
dl.detail dd {
  margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line-2);
  word-break: break-word;
}
dl.detail dt:last-of-type, dl.detail dd:last-of-type { border-bottom: 0; }

/* ---------------- 面板指标 ---------------- */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 8px; }
.metrics > div {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.metrics span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.metrics b {
  display: block; font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
}
@media (min-width: 780px) { .metrics { grid-template-columns: repeat(4, 1fr); } }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin: 20px 0 8px;
}
.pager a, .pager span {
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
.pager span { color: var(--muted); border-color: transparent; background: transparent; }

/* ---------------- 登录 / 改密（独立布局，不套页头） ---------------- */
body.auth {
  display: grid; place-items: center; min-height: 100vh;
  background: linear-gradient(160deg, #eef3fb 0%, var(--bg) 55%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 8px 28px rgba(16, 24, 40, .10);
  padding: 30px 28px 26px;
}
.auth-card h1 { font-size: 19px; margin: 0 0 4px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.auth-card label {
  display: block; margin: 14px 0 6px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.auth-card input {
  width: 100%; padding: 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.auth-card input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .16);
}
.auth-card button {
  width: 100%; margin-top: 22px; padding: 12px;
  background: var(--brand); border-color: var(--brand); color: #fff;
  font-weight: 600; font-size: 15px;
}
.auth-card button:hover { background: var(--brand-dark); }
.auth-card p.error { margin-top: 16px; }

/* ---------------- 手机 ---------------- */
@media (max-width: 640px) {
  main { padding: 14px 12px 40px; }
  header.top .bar { padding: 10px 12px 0; }
  nav.menu { padding: 6px 12px 8px; }

  /* 表格折成"标签：值"的卡片 —— 桌面端看不出来，手机上每行一叠 */
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list thead { display: none; }
  table.list {
    border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible;
  }
  table.list tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; padding: 6px 14px;
  }
  table.list td { border: 0; padding: 7px 0; text-align: left; }
  table.list td.num { text-align: left; }
  table.list td::before {
    content: attr(data-label);
    display: inline-block; min-width: 76px;
    color: var(--muted); font-size: 12.5px;
    content: attr(data-label) "";
  }
  table.list td::after { content: ""; }
  table.list td:not(:empty)::before { content: attr(data-label) "  "; }

  /* 详情表在手机上单列 */
  dl.detail { grid-template-columns: 1fr; }
  dl.detail dt { padding-bottom: 2px; border-bottom: 0; background: transparent; }
  dl.detail dd { padding-top: 0; }

  /* 按钮撑满，拇指好点 */
  .actions a, .actions button, .actions form,
  form.card button, input[type=submit] {
    display: block; width: 100%; text-align: center;
  }
  .actions > * { margin: 0 0 8px; }
  form.card { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

/* 一组色块（面板的状态分布） */
p.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
p.chips .badge { font-size: 13px; padding: 5px 12px; }

/* 可点排序的表头 */
table.list thead th a {
  color: inherit; text-decoration: none;
  border-bottom: 1px dashed var(--line);
}
table.list thead th a:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* "共 N 条"那一行 */
p.count { margin: -4px 0 12px; }
p.count b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* 筛选条里的搜索框宽一点 */
form.filters label:first-child input { min-width: 240px; }

/* ================= 看板与图表 ================= */
.charts { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 18px 0 8px; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px 10px;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h2 { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-2); }

svg.chart, svg.bars { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line-2); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; }
svg.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dots circle { stroke: #fff; stroke-width: 1.4; }
svg.chart .c1, .legend .c1 { stroke: #1f6feb; } svg.chart .dots.c1 circle { fill: #1f6feb; }
svg.chart .c2, .legend .c2 { stroke: #17803d; } svg.chart .dots.c2 circle { fill: #17803d; }
svg.chart .c3, .legend .c3 { stroke: #a15c00; } svg.chart .dots.c3 circle { fill: #a15c00; }
svg.chart .c4, .legend .c4 { stroke: #8b5cf6; } svg.chart .dots.c4 circle { fill: #8b5cf6; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 4px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.legend .key i { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.legend .key .c1 { color: #1f6feb; } .legend .key .c2 { color: #17803d; }
.legend .key .c3 { color: #a15c00; } .legend .key .c4 { color: #8b5cf6; }

/* 环形图 */
svg.donut { width: 168px; height: 168px; display: block; margin: 4px auto 8px; }
svg.donut .track { stroke: var(--line-2); }
svg.donut .seg { stroke-linecap: butt; }
svg.donut .seg.badge-wait { stroke: #b9c2cc; }
svg.donut .seg.badge-doing { stroke: #1f6feb; }
svg.donut .seg.badge-todo { stroke: #e0a425; }
svg.donut .seg.badge-done { stroke: #17803d; }
svg.donut .seg.badge-dead { stroke: #c22a35; }
svg.donut .donut-total { fill: var(--ink); font-size: 26px; font-weight: 700; }
svg.donut .donut-cap { fill: var(--muted); font-size: 12px; }

ul.donut-legend { list-style: none; margin: 6px 0 0; padding: 0; }
ul.donut-legend li a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-size: 14px;
}
ul.donut-legend li a:hover { background: var(--line-2); text-decoration: none; }
ul.donut-legend li b { margin-left: auto; font-variant-numeric: tabular-nums; }
ul.donut-legend .dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
ul.donut-legend .dot.wait { background: #b9c2cc; }
ul.donut-legend .dot.doing { background: #1f6feb; }
ul.donut-legend .dot.todo { background: #e0a425; }
ul.donut-legend .dot.done { background: #17803d; }
ul.donut-legend .dot.dead { background: #c22a35; }

/* 条形图 */
svg.bars .bar { fill: #1f6feb; }
svg.bars .bars-label { fill: var(--ink-2); font-size: 13px; }
svg.bars .bars-value { fill: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* 账龄 */
.aging { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .aging { grid-template-columns: repeat(4, 1fr); } }
.aging-cell {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  background: #fcfdff;
}
.aging-cell span { display: block; color: var(--muted); font-size: 13px; }
.aging-cell b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.aging-cell em { color: var(--muted); font-size: 12.5px; font-style: normal; }
.aging-cell.total { background: var(--brand-soft); border-color: #c7dbff; }

/* ================= 操作轨迹（时间线） ================= */
ol.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 18px; position: relative; }
ol.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
ol.timeline li {
  position: relative; padding: 6px 0 10px 12px; font-size: 14px;
}
ol.timeline li::before {
  content: ""; position: absolute; left: -18px; top: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-soft);
}
ol.timeline .when {
  color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; font-size: 13px;
}
ol.timeline .who { color: var(--ink-2); margin-right: 8px; font-weight: 600; }
ol.timeline .detail { color: var(--muted); margin-left: 8px; }

/* 批量操作条 */
form.batch { margin: 0 0 12px; }
.batch-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 14px;
}
.batch-bar > span { color: var(--muted); font-size: 13.5px; }
.batch-bar label { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.batch-bar input[type=date] {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font: inherit;
}
.batch-bar button { margin: 0; }
table.list th.pick, table.list td.pick { width: 34px; padding-right: 0; }
table.list td.pick input { width: 18px; height: 18px; }

/* ================= 浏览器实测（Edge 390px）后的修正 ================= */
/* P1 手机上面板图表被 viewBox 等比缩到 332px，坐标轴文字实渲染只有 6px（"看得见读不出"）。
   不再整体缩放：给图一个可读的最小宽度，窄屏时**横向滚动**看。 */
.chart-card { overflow-x: auto; }
svg.chart { min-width: 560px; }
svg.bars { min-width: 420px; }
/* P7 只有一个人时条形图被压得很扁 */
svg.bars { min-height: 52px; }
/* P3 列表勾选框 18px 太小（批量操作全靠它先点一下） */
table.list td.pick input { width: 22px; height: 22px; }
/* P4 详情页次要操作原来是没有按钮外观的 24px 裸链接，低于拇指下限 */
.actions a:not(.btn), .actions button:not(.primary) {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  min-height: 40px; display: inline-flex; align-items: center;
}
/* P9 手机导航可横滑但没提示：给右缘一点渐隐，暗示"还有" */
@media (max-width: 640px) {
  nav.menu { mask-image: linear-gradient(to right, #000 88%, transparent 100%); }
}

/* 站内消息 */
a.bell { position: relative; }
a.bell b {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  background: var(--bad); color: #fff; border-radius: 9px;
  font-size: 12px; line-height: 18px; text-align: center;
}
table.list tr.unread { background: #f6f9ff; }
table.list tr.unread td b { color: var(--brand-dark); }
.dot-unread {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
}
h1 small { font-size: 14px; color: var(--muted); font-weight: 400; }


/* 底部备案号（工信部要求：网站底部展示 ICP 备案号，并链接到 beian.miit.gov.cn） */
footer.beian {
  max-width: 1180px; margin: 0 auto; padding: 18px 18px 28px;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--line-2);
}
footer.beian a { color: var(--muted); text-decoration: none; }
footer.beian a:hover { color: var(--brand); text-decoration: underline; }
body.auth footer.beian { border-top: 0; padding-top: 4px; }


/* ================= Logo ================= */
header.top .brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
header.top .brand img.logo {
  height: 34px; width: auto; display: block; border-radius: 6px;
}
header.top .brand .brand-text {
  font-size: 16px; font-weight: 700; letter-spacing: .2px; color: var(--ink-2);
}
.auth-card img.logo-full {
  width: 100%; max-width: 300px; height: auto; display: block;
  margin: 0 auto 18px; border-radius: 10px;
}
