:root {
  --ink: #1e1814;
  --muted: #74685c;
  --line: #e7dccb;
  --paper: #f4efe7;
  --sheet: #fcfaf6;
  --rail: #221c17;
  --bronze: #8d6240;
  --seal: #8d4038;
  --moss: #35624c;
  --sand: #f4e6d4;
  --shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 16px 40px rgba(55, 36, 18, 0.05);
  --serif: "Iowan Old Style", Palatino, "Songti SC", "Noto Serif SC", serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 280px at 80% -40px, rgba(255,255,255,0.7), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 120px),
    var(--rail);
  color: #f6efe6;
  padding: 26px 16px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.mark {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(232, 205, 168, 0.55);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 20px;
  background: radial-gradient(circle at 35% 30%, #4a3b2e, #2a231c 70%);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; }
.brand b { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: 0.14em; font-weight: 600; }
.brand span { color: #cbbba6; font-size: 12px; letter-spacing: 0.18em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; justify-content: space-between; align-items: center;
  text-align: left; background: transparent; color: #f3e7da;
  border: 0; border-radius: 12px; padding: 11px 12px;
}
.nav button.active { background: #f7f1e8; color: var(--ink); }
.nav button:hover:not(.active) { background: rgba(247,241,232,0.08); }
.nav i { font-style: normal; font-size: 11px; letter-spacing: 0.12em; opacity: 0.55; }
.rail .foot { margin-top: auto; color: #b5a594; font-size: 12px; line-height: 1.7; padding: 12px 8px 0; }
.main { padding: 22px 28px 48px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; gap: 18px; align-items: flex-end;
  margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage { display: flex; flex-direction: column; gap: 14px; }
.kicker { margin: 0 0 6px; color: var(--bronze); letter-spacing: 0.22em; font-size: 11px; }
.top h1 { margin: 0; font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: 0.04em; }
.top p { margin: 8px 0 0; color: var(--muted); max-width: 46em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat, .panel, .day, .pipe, .quote-paper {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.stat { padding: 16px 18px 14px; position: relative; overflow: hidden; }
.stat::after {
  content: "";
  position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--bronze), transparent);
  opacity: 0.45;
}
.stat em { display: block; font-style: normal; color: var(--muted); font-size: 12px; letter-spacing: 0.12em; }
.stat strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 32px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; }
.panel h2, .sheet-head {
  margin: 0; padding: 16px 18px 8px;
  font-size: 12px; letter-spacing: 0.16em; font-weight: 650; color: var(--muted);
}
.list { display: flex; flex-direction: column; }
.item, .chip-card {
  width: 100%; text-align: left; background: transparent; border: 0;
  border-top: 1px solid var(--line); padding: 13px 18px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.chip-card {
  display: block; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 8px; background: white; padding: 10px 12px;
}
.item:hover, .chip-card:hover, tr.clickable:hover td { background: #faf6ef; }
.item b, .chip-card b { font-weight: 650; }
.muted, small { color: var(--muted); }
.tag {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 9px; font-size: 12px; background: var(--sand); color: #6d4b2b;
  letter-spacing: 0.04em;
}
.tag.seal { background: #f6e4e1; color: var(--seal); }
.tag.moss { background: #e5f0e9; color: var(--moss); }
.btn, .btn-ghost, .btn-seal {
  border-radius: 999px; padding: 9px 16px; border: 1px solid transparent;
  letter-spacing: 0.04em;
}
.btn { background: var(--ink); color: #f8f3ec; }
.btn:hover { background: #3a3028; }
.btn-ghost { background: white; border-color: #e0d3c2; }
.btn-ghost:hover { border-color: #c9b59a; }
.btn-seal { background: var(--seal); color: white; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.search, .field input, .field select, .field textarea, td input {
  background: white; border: 1px solid #e4d7c6; border-radius: 11px; padding: 9px 11px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
td input { border-radius: 8px; padding: 7px 8px; }
.search:focus, .field input:focus, .field select:focus, .field textarea:focus, td input:focus {
  outline: none; border-color: #c4a27a; box-shadow: 0 0 0 3px rgba(141, 98, 64, 0.12);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.wide { grid-column: span 2; }
.full { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 650; background: #f8f3eb; letter-spacing: 0.06em; }
tr.clickable { cursor: pointer; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.money { font-variant-numeric: tabular-nums; font-family: var(--serif); font-size: 16px; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 18px 16px; }
.photos img, .photo-ph {
  width: 128px; height: 96px; object-fit: cover; border-radius: 14px;
  border: 1px solid var(--line); background: var(--sand);
  box-shadow: 0 8px 18px rgba(48, 32, 18, 0.08);
}
.empty { padding: 32px 16px; color: var(--muted); text-align: center; }
.notice, .error { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.notice { background: #fbf6ee; border: 1px solid #ead9c2; color: #6d4e2e; }
.error { background: #f8e8e6; color: var(--seal); }
.pipes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.pipe { padding: 12px; min-height: 168px; background: rgba(255,255,255,0.45); border-style: dashed; }
.pipe h3 { margin: 2px 4px 10px; font-size: 12px; letter-spacing: 0.12em; color: var(--muted); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { min-height: 156px; padding: 10px; }
.day strong { display: block; font-size: 12px; margin-bottom: 8px; letter-spacing: 0.04em; }
.day.today { outline: 2px solid var(--bronze); }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 16px; }
.stepper li {
  padding: 6px 11px; border-radius: 999px; background: white;
  border: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.stepper li.on { background: var(--ink); color: white; border-color: var(--ink); }
.stepper li.done { background: #e7f1ea; color: var(--moss); border-color: #d3e4da; }
.quote-paper { background: white; padding: 26px; }
.quote-paper header {
  display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 8px;
}
.quote-paper h2 { font-family: var(--serif); font-size: 30px; margin: 0; letter-spacing: 0.16em; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px; }
  .nav { flex-direction: row; overflow: auto; }
  .rail .foot, .brand span { display: none; }
  .stats, .grid-2, .pipes, .split, .form-grid, .calendar { grid-template-columns: 1fr 1fr; }
  .main { padding: 16px; }
  .top h1 { font-size: 28px; }
}
@media (max-width: 680px) {
  .stats, .pipes, .calendar, .form-grid, .grid-2, .split { grid-template-columns: 1fr; }
}
@media print {
  .rail, .no-print, .toolbar { display: none !important; }
  .app { display: block; }
  body { background: white; }
}
