:root {
  --pine: #17241e;
  --pine-2: #24382e;
  --paper: #f3eee4;
  --sheet: #fbf8f2;
  --ink: #1c1915;
  --muted: #5e584e;
  --faint: #8a8174;
  --line: #e3d7c6;
  --line-strong: #d3c3ad;
  --cinnabar: #8d3b30;
  --gold: #8a6230;
  --ok: #1d5a40;
  --side: 220px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 2px; }

.app { min-height: 100vh; }
aside {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--side);
  background: var(--pine);
  color: #f3ecdf;
  overflow: auto;
  z-index: 3;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 22px 18px 16px;
}
.seal {
  width: 36px;
  height: 36px;
  border: 1px solid #c4a574;
  color: #f3ecdf;
  display: grid;
  place-items: center;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 18px;
}
.brand strong { display: block; font-size: 18px; letter-spacing: .08em; font-weight: 650; }
.brand em { display: block; margin-top: 1px; font-style: normal; color: #cbbfa8; font-size: 12px; letter-spacing: .12em; }
.nav-group { margin: 14px 18px 4px; color: #b5a790; font-size: 11px; letter-spacing: .16em; }
.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  color: #efe6d6;
  padding: 7px 16px 7px 16px;
}
.nav-btn.on { background: var(--pine-2); border-left-color: #c45a4a; color: #fff; }
.nav-btn:hover { background: rgba(255,255,255,.04); }
.side-foot { padding: 18px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #e7d7b8; font-size: 13px; }

.workspace { margin-left: var(--side); min-height: 100vh; }
.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(243, 238, 228, .94);
  border-bottom: 1px solid var(--line);
}
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-label { color: var(--muted); font-size: 13px; }
select, .btn {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  padding: 6px 8px;
}
.btn { background: transparent; }
.btn.solid { background: var(--pine); color: #f6f1e8; border-color: var(--pine); }
.pills { display: flex; gap: 6px; }
.pill {
  border: 1px solid var(--line-strong);
  padding: 3px 8px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
.pill.warn { color: var(--cinnabar); border-color: #e2b2aa; background: #f8eeeb; }

main { padding: 26px 28px 72px; }
.kicker { margin: 0; color: var(--cinnabar); font-size: 12px; letter-spacing: .14em; }
h1 {
  margin: 4px 0 6px;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.15;
}
.lede { margin: 0 0 18px; max-width: 720px; color: var(--muted); }

.figures { display: flex; border: 1px solid var(--line-strong); background: var(--sheet); margin: 8px 0 18px; }
.figures button {
  flex: 1;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 12px 14px;
}
.figures button:first-child { border-left: 0; }
.figures button:hover { background: #f3ecdf; }
.figures span { display: block; color: var(--muted); font-size: 12px; }
.figures strong {
  display: block;
  margin-top: 2px;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.block { margin: 0 0 16px; }
.block h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
}
.todo { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.todo li { border-bottom: 1px solid var(--line); }
.todo button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 2px;
}
.todo button:hover { color: var(--cinnabar); }

.sheet, .paper {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
}
.paper { padding: 18px 18px 14px; margin: 0 0 14px; }
.paper-head, .cust-head, .split-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.paper-head h2, .cust h2, .cat h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 26px;
  font-weight: 600;
}
.doc-label { margin: 0; letter-spacing: .18em; font-size: 12px; color: var(--gold); }
.sign { margin: 12px 0 0; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0e6d4; font-weight: 650; font-size: 13px; color: #3d3428; white-space: nowrap; }
.num, th.num { text-align: right; }
tr.bad td { background: #f8eeeb; }
tr.on td { background: #f7f1e4; }
tr.btn-row { cursor: pointer; }
caption { text-align: left; caption-side: bottom; padding-top: 8px; color: var(--faint); font-size: 12px; }

.stamp {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: .04em;
  white-space: nowrap;
}
.stamp.bad { color: var(--cinnabar); }
.stamp.ok { color: var(--ok); }
.stamp.wait { color: var(--gold); }
.stamp.mute { color: var(--faint); }

.totalbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--pine);
  font-variant-numeric: tabular-nums;
}
.totalbar b { font-family: "Palatino Linotype", "Songti SC", serif; font-size: 22px; font-weight: 600; }

.modes, .tabs { display: flex; gap: 0; margin: 0 0 12px; }
.modes button, .tabs button {
  background: transparent;
  border: 1px solid var(--line-strong);
  margin-left: -1px;
  padding: 6px 12px;
}
.modes button:first-child, .tabs button:first-child { margin-left: 0; }
.modes button.on, .tabs button.on { background: var(--pine); color: #f6f1e8; border-color: var(--pine); }

.cust { margin: 0 0 12px; }
.cust-head h2 { font-size: 20px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0; }
.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  background: rgba(255,255,255,.35);
}

.layout-2 { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.pick { display: flex; flex-direction: column; border: 1px solid var(--line-strong); background: var(--sheet); }
.pick button { text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.pick button.on { background: #f3e4d4; }

.quote { margin: 0 0 6px; }
.money-lg {
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 40px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.market-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.market-card { background: var(--sheet); border: 1px solid var(--line-strong); padding: 14px; }
.market-card .px {
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 28px;
  margin: 6px 0;
}
.flow td { background: #fffdf8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--pine);
  color: #f6f1e8;
  padding: 10px 14px;
  z-index: 5;
  max-width: min(520px, calc(100% - 32px));
}
.noscript { padding: 24px; }

.check { display: flex; gap: 14px; }
.master-grid { display: grid; gap: 16px; }
.master-grid h2 { margin: 18px 0 8px; font-size: 18px; }

@media (max-width: 860px) {
  aside { position: sticky; top: 0; width: 100%; height: auto; bottom: auto; }
  .brand { padding: 10px 12px; }
  .nav-group, .side-foot { display: none; }
  #side { display: flex; align-items: stretch; overflow: auto; }
  #side nav { display: flex; flex: 1; overflow: auto; }
  .nav-btn { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; padding: 10px; }
  .nav-btn.on { border-bottom-color: #c45a4a; }
  .workspace { margin-left: 0; }
  .top { position: static; }
  .top, main { padding-left: 14px; padding-right: 14px; }
  .figures, .layout-2 { display: block; }
  .figures button { display: block; width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .figures button:first-child { border-top: 0; }
  h1 { font-size: 28px; }
  .scroll { overflow-x: auto; }
}
