/* ===== VC 中台 v3 · 基础 / 外壳 / 工具栏 / KPI ===== */
:root {
  --ink: #16181d; --ink2: #4b5563; --dim: #8b93a1; --line: #e3e6ec; --line2: #f1f3f7;
  --bg: #f4f5f8; --panel: #fff; --acc: #14508c; --acc2: #0f766e; --warn: #b45309; --bad: #b91c1c; --ok: #15803d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); font-size: 13px; line-height: 1.5;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans", Meiryo, "Segoe UI", system-ui, sans-serif;
}
button, input, select, textarea { font-family: inherit; font-size: 13px; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--acc); }
.boot { padding: 40px; color: var(--dim); text-align: center; }
.boot.bad { color: var(--bad); }
.dim { color: var(--dim); }
.small { font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #0f172a; color: #e5e9f2; padding: 9px 16px;
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: .4px; }
.brand span { font-size: 11px; font-weight: 400; color: #94a3b8; margin-left: 8px; letter-spacing: 0; }
.topbar .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar .tag { background: #1e293b; color: #cbd5e1; padding: 3px 8px; border-radius: 4px; font-size: 11.5px; }
.topbar .tag b { color: #fff; font-weight: 600; }
.topbar .tag.warn { background: #78350f; color: #fed7aa; }
.topbar .tbtn { background: #1e293b; color: #e2e8f0; border-color: #334155; }
.topbar .tbtn:hover { background: #334155; }

/* ---------- 标签页 ---------- */
.tabs {
  display: flex; gap: 2px; overflow-x: auto; background: var(--panel);
  border-bottom: 1px solid var(--line); padding: 0 12px; position: sticky; top: 0; z-index: 30;
}
.tab {
  border: 0; background: none; padding: 11px 13px; cursor: pointer; white-space: nowrap;
  color: var(--ink2); border-bottom: 2px solid transparent; font-size: 13.5px;
}
.tab:hover { color: var(--ink); background: var(--line2); }
.tab.on { color: var(--acc); border-bottom-color: var(--acc); font-weight: 600; }
.tab .tn { font-style: normal; font-size: 11px; color: var(--dim); background: var(--line2); border-radius: 8px; padding: 0 5px; }
.wrap { padding: 14px 16px 40px; }

/* ---------- 板块头 / 按钮 ---------- */
.board { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; box-shadow: var(--shadow); }
.boardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.boardhead h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.boardhead .ic { font-size: 17px; }
.boardhead .cnt { font-size: 12px; font-weight: 400; color: var(--dim); margin-left: 4px; }
.acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tbtn {
  border: 1px solid var(--line); background: #fff; color: var(--ink2); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap;
}
.tbtn:hover { border-color: #c7cdd8; color: var(--ink); background: #fafbfd; }
.tbtn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.tbtn.pri:hover { background: #0f3f70; color: #fff; }
.tbtn.danger { color: var(--bad); border-color: #f3c8c8; }
.tbtn.gh { color: var(--dim); }
.lnk { border: 0; background: none; color: var(--acc); cursor: pointer; padding: 0 2px; text-decoration: underline dotted; }
.tag { background: var(--line2); color: var(--ink2); border-radius: 4px; padding: 2px 6px; font-size: 11.5px; }
.bnote { margin: 6px 0 10px; padding: 7px 10px; background: #f7f9fc; border-left: 3px solid #cfd8e6; color: var(--ink2); border-radius: 0 4px 4px 0; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; width: 260px; background: #fff;
}
.search.big { width: 100%; padding: 8px 10px; }
.search:focus { outline: 2px solid #cfe0f5; border-color: var(--acc); }
.datef { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding-left: 6px; border-left: 1px solid var(--line); }
.datef b { font-size: 12px; color: var(--ink2); font-weight: 600; }
.datef input[type=date] { border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; }
.datef i { color: var(--dim); font-style: normal; }
.datef .hint { font-size: 11.5px; color: var(--warn); background: #fff7ed; border-radius: 4px; padding: 2px 6px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink2); border-radius: 999px;
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: #c7cdd8; }
.chip.on { background: #e8f1fb; border-color: #b6d3f2; color: var(--acc); font-weight: 600; }
.chip i { font-style: normal; color: var(--dim); font-size: 11px; }
.fsel { border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; background: #fff; max-width: 190px; }
.fsel.on { border-color: #b6d3f2; background: #f3f8fe; color: var(--acc); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager .pl { font-style: normal; color: var(--dim); font-size: 11.5px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; }
.pager button:disabled { opacity: .45; cursor: default; }
.pager select { border: 1px solid var(--line); border-radius: 6px; padding: 4px 4px; }
.footline { color: var(--dim); font-size: 12px; margin-top: 8px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-left: 3px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; }
.kpi span { display: block; font-size: 12px; color: var(--ink2); }
.kpi b { display: block; font-size: 22px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi i { font-style: normal; font-size: 11.5px; color: var(--dim); }
.kpi[data-act] { cursor: pointer; }
.kpi[data-act]:hover { border-color: #b9c6d8; box-shadow: 0 3px 10px rgba(16, 24, 40, .08); }
.w-wait { border-left-color: #94a3b8; } .w-move { border-left-color: #2563eb; }
.w-inv { border-left-color: #7c3aed; } .w-pay { border-left-color: var(--warn); }
.w-ok { border-left-color: var(--ok); } .w-bad { border-left-color: var(--bad); }
.kpis.small .kpi b { font-size: 19px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cols2.reg { grid-template-columns: 1.15fr .85fr; }
@media (max-width: 1100px) { .cols2, .cols2.reg { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.card h3 { font-size: 13.5px; margin-bottom: 8px; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.todo button { border: 0; background: none; cursor: pointer; color: var(--ink); text-align: left; width: 100%; display: flex; justify-content: space-between; gap: 8px; }
.todo button:hover { color: var(--acc); }
.todo b { color: var(--bad); font-variant-numeric: tabular-nums; }
.howto { margin: 6px 0 0 18px; padding: 0; color: var(--ink2); }
.howto li { margin-bottom: 4px; }
/* ===== VC 中台 v3 · 表格 / 抽屉 / 表单 / SOP / 弹窗 ===== */

/* ---------- 表格 ---------- */
.tablebox { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; min-width: 100%; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line2);
  padding: 6px 8px; text-align: left; vertical-align: top; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
table.grid thead th {
  position: sticky; top: 0; z-index: 3; background: #f7f8fb; font-weight: 600; color: var(--ink2);
  font-size: 12px; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.grid thead th:hover { background: #eef1f7; color: var(--ink); }
table.grid thead th.on { color: var(--acc); background: #eaf2fc; }
table.grid thead th i { font-style: normal; font-size: 9px; margin-left: 3px; }
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:nth-child(even) td { background: #fcfdff; }
table.grid tbody tr:hover td { background: #f3f8fe; }
table.grid td.keycell, table.grid th:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
table.grid thead th:first-child { z-index: 4; }
table.grid tbody tr:nth-child(even) td.keycell { background: #fcfdff; }
table.grid tbody tr:hover td.keycell { background: #eaf2fc; }
table.grid td.der { color: var(--acc2); }
table.grid td.cal { color: #1f2937; }
table.grid td.empty { color: var(--dim); text-align: center; padding: 22px; white-space: normal; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; line-height: 1.35; }
.key { border: 0; background: none; color: var(--acc); cursor: pointer; padding: 0; font: inherit; text-decoration: underline dotted; font-weight: 600; }
.key:hover { color: #0b3a68; }
.badge { display: inline-block; border-radius: 4px; padding: 1px 6px; font-size: 11.5px; border: 1px solid transparent; }
.badge.ok { background: #e8f6ee; color: var(--ok); border-color: #c4e6d2; }
.badge.move { background: #e8f0fb; color: #1d4ed8; border-color: #c3d7f5; }
.badge.wait { background: #f3f4f6; color: #4b5563; border-color: #dfe2e8; }
.badge.warn { background: #fff7ed; color: var(--warn); border-color: #f6d9b0; }
.badge.bad { background: #fdecec; color: var(--bad); border-color: #f4c7c7; }
.badge.off { background: #f3f4f6; color: #9ca3af; }
.st-wait { background: #f3f4f6; color: #4b5563; border-color: #dfe2e8; }
.st-move { background: #e8f0fb; color: #1d4ed8; border-color: #c3d7f5; }
.st-inv { background: #f3e9fd; color: #7c3aed; border-color: #ddc7f7; }
.st-pay { background: #fff7ed; color: var(--warn); border-color: #f6d9b0; }
.st-ok { background: #e8f6ee; color: var(--ok); border-color: #c4e6d2; }
.st-bad { background: #fdecec; color: var(--bad); border-color: #f4c7c7; }
tr.frow { cursor: pointer; }
tr.frow.on td { background: #eaf2fc !important; }
tr.detrow td { background: #f8fafd !important; padding: 10px 12px; white-space: normal; }
tr.clickrow { cursor: pointer; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12px; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; white-space: nowrap; }
table.mini th { background: #f7f8fb; font-weight: 600; color: var(--ink2); }
table.grid.follow td:nth-child(13) { white-space: normal; }
table.cmp { border-collapse: collapse; width: 100%; font-size: 12.5px; margin-bottom: 12px; }
table.cmp th, table.cmp td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
table.cmp thead th { background: #eef3fb; }
table.cmp tbody th { background: #fafbfd; width: 150px; color: var(--ink2); font-weight: 600; }

/* ---------- 表单 / 抽屉 ---------- */
.modalwrap { display: none; }
.modalwrap.on { display: block; }
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 660px; max-width: 96vw; background: #fff;
  z-index: 61; display: flex; flex-direction: column; box-shadow: -8px 0 28px rgba(16, 24, 40, .18);
}
.drawer.wide { width: 880px; }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer header h3 { font-size: 15px; }
.drawer .x { border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--dim); }
.dbody { padding: 14px 16px; overflow: auto; flex: 1; }
.drawer footer { padding: 11px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #fbfcfe; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 12px; }
legend { font-size: 12.5px; font-weight: 600; color: var(--acc); padding: 0 6px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.fgrid label.f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fgrid label.f.wide { grid-column: 1 / -1; }
.fgrid label.f > span { font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 4px; }
.fgrid .req { color: var(--bad); font-style: normal; }
.fgrid .fh { color: var(--dim); background: var(--line2); border-radius: 50%; width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; cursor: help; }
.fgrid input, .fgrid select, .fgrid textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%; min-width: 0;
}
.fgrid textarea { resize: vertical; }
.fgrid input:focus, .fgrid select:focus, .fgrid textarea:focus { outline: 2px solid #cfe0f5; border-color: var(--acc); }
.fgrid .ro { border: 1px dashed var(--line); border-radius: 6px; padding: 6px 8px; color: var(--dim); background: #fafbfd; min-height: 30px; }
.fgrid .ro.cal { color: var(--acc2); }
.autosrc { display: block; font-style: normal; font-size: 10px; color: var(--dim); margin-top: 2px; }
.rel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: #fbfcfe; }
.rel h4 { font-size: 12.5px; margin-bottom: 7px; color: var(--ink2); }
.rel .kv { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 4px; }
.rel .kv span { font-size: 12px; }
.rel .kv i { font-style: normal; color: var(--dim); margin-right: 4px; }
.rel table.mini { background: #fff; }
.lkbox { margin: 6px 0 10px; font-size: 12.5px; line-height: 1.7; }
.lkbox .ok { color: var(--acc2); }
.regactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sw { font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 5px; }
.regchips, .sopnav { margin: 4px 0 12px; }
.prodres { display: grid; gap: 6px; margin: 8px 0; }
.prod { text-align: left; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 7px 10px; cursor: pointer; }
.prod:hover { border-color: #b6d3f2; background: #f6faff; }
.prod b { display: block; font-size: 12.5px; }
.prod i { font-style: normal; font-size: 11.5px; color: var(--dim); }

/* ---------- SOP 手册 ---------- */
.sopwrap { margin-top: 6px; }
.sopcard { border: 1px solid var(--line); border-left: 3px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.sopcard h4 { font-size: 13.5px; margin-bottom: 5px; }
.sopbody { color: #1f2937; white-space: normal; line-height: 1.75; }
.sopnote { margin: 6px 0 0; font-size: 12px; }
.sopcard footer { margin-top: 7px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.planbox { margin-bottom: 10px; }

/* ---------- 勾选多选 / 批量操作条 ---------- */
th.selcol, td.selcol { width: 34px; padding: 0 4px; text-align: center; }
th.selcol input, td.selcol input { cursor: pointer; margin: 0; }
table.grid tbody tr.on { background: #eef5fd; }
.batchbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #eef5fd; border: 1px solid #cfe0f5; border-radius: 8px; padding: 7px 10px; margin: 8px 0;
}
.batchbar b { font-size: 12.5px; color: var(--acc); }
.tbtn.danger { color: var(--bad); border-color: #f0c8c8; }
.tbtn.danger:hover { background: #fdf3f3; }
th.actcol, td.actcell { white-space: nowrap; }
td.actcell .lnk { margin-right: 8px; }
.lnk.danger { color: var(--bad); }

/* ---------- 请求书番号生成器 ---------- */
.drawer.mid { width: 620px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.invtools { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.invtools .search { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; }
.invlist { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.invlist table.grid { font-size: 12.5px; }
.invform { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.invform label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink2); }
.invform label.fw { flex: 1 1 100%; }
.invform input { border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 13px; }
.invout { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fbfcfe; }
.ivno { font-size: 19px; font-weight: 700; letter-spacing: .5px; color: var(--acc); word-break: break-all; }
.ivmeta { font-size: 12px; color: var(--ink2); margin: 6px 0 9px; }
.ivacts { display: flex; gap: 8px; flex-wrap: wrap; }
.pone { margin: 4px 0 8px; }
.pone .fl { font-size: 12px; color: var(--ink2); display: block; margin-bottom: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 18px; bottom: 18px; background: #111827; color: #fff; padding: 9px 14px;
  border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .18s; z-index: 90; max-width: 480px; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast.ok { background: #14532d; }
.toast.warn { background: #78350f; }
.toast.bad { background: #7f1d1d; }
