:root {
  --bg: #efece6;
  --panel: #fffefb;
  --ink: #1c1915;
  --muted: #6b655c;
  --line: #e3ddd3;
  --side: #1e2a28;
  --side-text: #d5e0dc;
  --accent: #0f6b5c;
  --warn-bg: #f8f1df;
  --bad: #8f2d2d;
  --ok: #1d6b45;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  background: #fff;
  border: 1px solid #d9d3c8;
  border-radius: 6px;
  padding: 6px 8px;
  height: 32px;
}
textarea { height: auto; min-height: 64px; width: 100%; resize: vertical; }
input.w-num { width: 96px; }
input.search { width: 220px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid #e0dbd2;
  border-radius: 12px;
  padding: 28px 26px 18px;
}
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 18px;
}
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.field input { height: 36px; }
.form-error { min-height: 22px; margin: 0 0 8px; color: var(--bad); font-size: 13px; }
.login-card .btn.primary { width: 100%; height: 36px; }
.fine { margin: 12px 0 0; text-align: center; color: #8a847a; font-size: 12px; }
.demo-note {
  width: min(400px, 100%);
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
}
.demo-note strong { color: var(--ink); font-weight: 600; }
.demo-note table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.demo-note td { padding: 3px 0; vertical-align: top; }
.demo-note td:first-child { width: 72px; color: var(--ink); }

.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 16px 14px 10px; color: #fff; }
.brand strong { display: block; font-size: 16px; font-weight: 600; }
.brand span { display: block; margin-top: 2px; color: #9fb2ad; font-size: 12px; }
.nav { overflow: auto; padding: 6px 0 12px; flex: 1; }
.navbtn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--side-text);
  border: 0;
  border-left: 3px solid transparent;
  padding: 8px 12px 8px 14px;
}
.navbtn:hover { background: rgba(255, 255, 255, 0.05); }
.navbtn.active { background: rgba(255, 255, 255, 0.08); color: #fff; border-left-color: #8fd0c4; }
.side-foot { padding: 12px 14px 16px; color: #8aa199; font-size: 12px; white-space: nowrap; }

.workspace { min-width: 0; }
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumb { font-weight: 600; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--muted); font-size: 13px; white-space: nowrap; }
.content { padding: 16px 20px 48px; }
.page-desc { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.formula { margin: -2px 0 12px; color: var(--muted); font-size: 12px; }

.toolbar, .datebar, .row-actions, .modal-actions, .footlinks, .preview-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toolbar, .datebar { margin: 0 0 12px; }
.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.datebar button, .seg button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.datebar button.on, .seg button.on { background: #143f39; color: #fff; border-color: #143f39; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.kpi {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 78px;
  min-width: 0;
}
.kpi-label { display: block; color: var(--muted); font-size: 12px; }
.kpi-value { display: block; margin-top: 4px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-sub { display: block; margin-top: 2px; color: #8a847a; font-size: 12px; min-height: 16px; }
.kpi.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kpi.main { background: #143f39; border-color: #143f39; color: #f4fbf8; }
.kpi.main.on { box-shadow: inset 0 0 0 1px #8fd0c4; }
.kpi.main .kpi-label, .kpi.main .kpi-sub { color: #c9ddd8; }
.kpi .neg, .neg { color: var(--bad); }
.kpi.main .neg { color: #ffd0cc; }

.banner { border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: #6d4a10; }
.banner.info { background: #e7f0ee; color: #164e45; }
.banner.bad { background: #f8e8e6; color: #7a2424; }
.banner button, button.link {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap table { min-width: 720px; }
th {
  text-align: left;
  font-weight: 600;
  color: #5e584f;
  background: #f6f3ed;
  white-space: nowrap;
}
td, th { padding: 8px 10px; border-bottom: 1px solid #eeeae3; vertical-align: top; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.miss td { background: #fbf6ea; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f4ee; }
tr.miss.clickable:hover td { background: #f4ecd8; }
td.empty, .empty-block { text-align: center; color: var(--muted); }
.empty-block { padding: 48px 16px; }
.expand td { background: #fbfaf7; }

.tag {
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: 999px;
  background: #eeeae3;
  color: #514c45;
  white-space: nowrap;
}
.tag.ok { background: #e3f2ea; color: var(--ok); }
.tag.warn { background: #f8efd8; color: #8a5a12; }
.tag.bad { background: #f8e4e2; color: var(--bad); }
.tag.info { background: #e4eef8; color: #1e4f86; }

.btn {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 10px;
  line-height: 1.3;
  white-space: nowrap;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #e4c8c4; background: #fff; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.panel h2, h2 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; }
.panel h2 { margin: 0 0 8px; }
.statline { display: flex; flex-wrap: wrap; gap: 10px 16px; font-variant-numeric: tabular-nums; }
.statline span { color: var(--muted); }
.statline b { color: var(--ink); font-weight: 600; }

.staff { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; align-items: start; }
.staff-list { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.staff-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.staff-name { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 0; }
.staff-name:hover { color: var(--accent); }
.staff-ops { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-item:last-child { border-bottom: 0; }
.staff-item.on { background: #e7f2ef; }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.steps li.done { border-color: #b7d7cf; }
.steps li.current { border-color: var(--accent); }
.step-no { color: var(--accent); font-weight: 600; margin-right: 6px; }
.result { margin-top: 12px; border-radius: 8px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); }
.result.ok { border-color: #b7d7cf; background: #f3faf7; }
.result.wait { border-color: #ead7a6; background: #fbf8f0; }
.result.bad { border-color: #e7c4c0; background: #fdf6f5; }

.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 148px 88px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.timeline strong { font-weight: 600; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 21, 0.46);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 16px;
}
.modal {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid #e0dbd2;
  border-radius: 10px;
  padding: 16px;
}
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal ul { margin: 8px 0; padding-left: 18px; }
.modal-actions { justify-content: flex-end; margin-top: 14px; }
.preview-bar { justify-content: space-between; margin: 8px 0; }

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e2a28;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 30;
  font-size: 13px;
  max-width: min(560px, calc(100vw - 24px));
}

@media (max-width: 980px) {
  .split, .staff { grid-template-columns: 1fr; }
}
