:root {
  --paper: #f3efe4;
  --ink: #1c1915;
  --muted: #6d6458;
  --line: #e0d6c6;
  --seal: #9c2f2f;
  --pine: #1f4d3a;
  --brass: #8a6a32;
  --card: #fffaf2;
  --bad: #9c2f2f;
  --ok: #1f4d3a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 "Avenir Next", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, .linkish {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
a { color: var(--seal); }
.app { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.side { padding: 1.2rem 1rem; border-right: 1px solid var(--line); background: #ebe4d6; }
.brand { font-family: "Iowan Old Style", Palatino, "Songti SC", serif; font-size: 1.8rem; margin: 0; }
.brand small { display: block; font-family: inherit; font-size: 0.78rem; color: var(--muted); font-weight: 400; }
nav { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 1rem; }
nav button { text-align: left; background: transparent; color: var(--ink); border-radius: 8px; }
nav button.active { background: var(--ink); color: var(--paper); }
.main { padding: 1rem 1.2rem 3rem; }
.top { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.55rem; color: var(--muted); background: var(--card); font-size: 0.82rem; }
.badge.warn { color: var(--seal); border-color: #e7c1c1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; margin-bottom: 0.8rem; }
h1, h2, h3 { font-family: "Iowan Old Style", Palatino, "Songti SC", serif; font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; }
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.45rem; }
input, select, textarea { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.45rem 0.55rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 0.4rem 0.3rem; vertical-align: top; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.error { color: var(--bad); background: #f8e8e4; border-radius: 10px; padding: 0.6rem 0.8rem; }
.ok { color: var(--ok); }
.muted { color: var(--muted); }
.chart { width: 100%; overflow-x: auto; }
.login { max-width: 420px; margin: 8vh auto; }
.steps { counter-reset: step; }
.step { counter-increment: step; }
.step h3::before { content: counter(step) "  "; color: var(--seal); }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  nav { flex-direction: row; overflow-x: auto; }
  nav button { white-space: nowrap; }
  .top { flex-direction: column; align-items: flex-start; }
}
