:root {
  --bg: #f4f1eb;
  --paper: #fff;
  --ink: #1f1b16;
  --muted: #6b6560;
  --line: #e6e2dc;
  --subtle: #f7f5f1;
  --warn: #8a5a12;
  --warn-bg: #f8efe2;
  --warn-line: #ead7b8;
  --ok: #1f6b3a;
  --ok-bg: #e7f5ec;
  --danger: #9b1c1c;
  --danger-bg: #fdecec;
  --accent: #1f4f8a;
  --accent-soft: #e8eef6;
  --shadow: 0 10px 30px rgba(0,0,0,.06);
  --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.55 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button[disabled] { opacity: .55; cursor: default; }

.demo-banner {
  position: sticky; top: 0; z-index: 40;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn);
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 650;
}

.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: calc(100vh - 38px);
}
.side {
  background: #1b2a22;
  color: #eef4ee;
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand .app-name { font-size: 12px; opacity: .75; }
.brand h1 { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: #fff; }
.brand .sub { margin-top: 4px; font-size: 12px; opacity: .7; }
.nav { display: grid; gap: 6px; }
.nav button {
  border: 0;
  background: transparent;
  color: #d5ddd6;
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
}
.nav button.on { background: #2c4a38; color: #fff; font-weight: 700; }
.nav button:hover { background: #24382d; }
.side-foot { margin-top: auto; font-size: 12px; color: #b7c3b9; }
.side-foot .linkish { color: #cfe0d4; margin-top: 8px; }

.main { padding: 18px 22px 40px; min-width: 0; }
.top {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-end;
  margin-bottom: 16px; flex-wrap: wrap;
}
.batch-lab { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.batch-lab select { min-width: 320px; }
.top-note { color: var(--muted); font-size: 13px; max-width: 640px; }

.view { display: none; }
.view.on { display: block; }

input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
textarea { min-height: 72px; resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6560' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.btn, .btn2, .btn3 {
  border: 0; border-radius: 10px; padding: 8px 14px;
}
.btn { background: var(--accent); color: #fff; }
.btn2 { background: var(--subtle); border: 1px solid var(--line); }
.btn3 { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c8c8; }
.btn-ok { background: var(--ok); color: #fff; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi b { display: block; font-size: 12px; color: var(--muted); font-weight: 650; }
.kpi .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.kpi.ok { background: var(--ok-bg); }
.kpi.acc { background: var(--accent-soft); }

.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.panel + .panel, .card + .card { margin-top: 12px; }
.panel h2, .card h2 { margin: 0 0 8px; font-size: 16px; }
.note, .muted { color: var(--muted); font-size: 13px; }
.alert, .okbox, .dangerbox, .neutral {
  border-radius: 10px; padding: 8px 10px; font-size: 13px; margin: 8px 0;
}
.alert { background: var(--warn-bg); color: var(--warn); }
.okbox { background: var(--ok-bg); color: var(--ok); }
.dangerbox { background: var(--danger-bg); color: var(--danger); }
.neutral { background: var(--subtle); }

.tag {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--subtle); font-weight: 650; white-space: nowrap;
}
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.tag.demo { background: var(--warn-bg); color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 12px; }
td.money, th.money { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--subtle); }
tr.on { background: var(--accent-soft); }

.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.split-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.people-list { display: grid; gap: 8px; }
.people-list button.card {
  width: 100%; text-align: left; box-shadow: none; padding: 10px 12px;
}
.people-list button.card.on { border-color: var(--accent); background: var(--accent-soft); }

.ticket-grid { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
.preview {
  border: 1px solid var(--line); border-radius: 10px; background: var(--subtle);
  min-height: 180px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.preview img, .preview object { width: 100%; height: auto; display: block; }
.kv { display: grid; gap: 6px; }
.kv div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; font-size: 13px; }
.kv b { color: var(--muted); font-weight: 600; }

.field { display: grid; gap: 4px; margin-bottom: 8px; }
.field b, .lab { font-size: 12px; font-weight: 700; }
.locked { background: #f3f1ee; }

.guide { display: grid; gap: 6px; }
.guide li { margin: 0; }

.rule-list { display: grid; gap: 10px; }
.rule-item h3 { margin: 0 0 6px; font-size: 15px; color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 60; max-width: 80%; text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.dlg-mask {
  position: fixed; inset: 0; background: rgba(31,27,22,.4);
  z-index: 70; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.dlg-mask.on { display: flex; }
.dlg {
  background: var(--paper); width: min(560px, 100%);
  border-radius: 16px; padding: 18px 20px 20px;
}
.dlg h3 { margin: 0 0 8px; font-size: 18px; }
.dlg .btns { justify-content: flex-end; }

.sheet-block { margin-top: 14px; }
.sheet-block h3 { margin: 0 0 8px; font-size: 15px; }

@media print {
  .demo-banner, .side, .top, .btns, .toast, .dlg-mask { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .view { display: none !important; }
  #view-sheet.view.on { display: block !important; }
  .card, .panel { box-shadow: none; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { grid-auto-flow: column; overflow-x: auto; }
  .split, .ticket-grid, .split-wide { grid-template-columns: 1fr; }
  .batch-lab select { min-width: 0; width: 100%; }
}

a.ticket-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
a.ticket-link:hover { color: var(--ink); }


/* 登录页（不含业务数据） */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #1b2a22;
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
.login-brand .app-name { font-size: 13px; color: var(--muted); }
.login-brand h1 { margin: 4px 0 8px; font-size: 22px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 10px 14px; }
.login-card #loginMsg { min-height: 1.4em; margin-top: 10px; color: var(--danger); }

.who { margin-bottom: 10px; }
.who #whoText { color: #eef4ee; font-weight: 650; }
.who-actions { display: flex; gap: 12px; margin-top: 4px; }
.nav button[hidden], .side-foot button[hidden] { display: none !important; }

.split-table { max-width: 420px; margin: 10px 0 8px; }
.split-table th.subhead, h3.subhead { font-size: 14px; margin: 12px 0 6px; }
.type-ticket-table { width: 100%; margin: 8px 0 10px; }
.type-assign { min-width: 7em; }
