:root {
  --ink: #17211c;
  --ink-soft: #5c564c;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #e4dccb;
  --jade: #0f6e56;
  --jade-deep: #0b4f3e;
  --brass: #8a6232;
  --red: #8e1b1b;
  --ok: #0f6e56;
  --warn: #8a4b08;
  --sidebar: #14211c;
  --sidebar-text: #e7f3ec;
  --shadow: 0 12px 30px rgba(23, 33, 28, 0.06);
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1200px 500px at 10% -10%, #efe4cf 0%, transparent 50%), var(--paper);
  min-height: 100vh;
}
a { color: var(--jade-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 16px; }
.mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(160deg, #e7c98a, #8fd0b4);
  color: #14211c; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700;
}
.brand strong { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -0.03em; }
.brand span { display: block; color: #b7c9bf; font-size: 12px; }
.company {
  margin: 0 8px 14px; padding: 10px 12px; border: 1px solid rgba(231, 243, 236, 0.14);
  border-radius: 12px; font-size: 13px;
}
.company b { display: block; }
.company small { color: #b7c9bf; }
.nav-group { margin: 8px 0 4px; color: #8ea497; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; padding: 8px; }
.sidebar a.nav {
  display: block; color: var(--sidebar-text); text-decoration: none;
  padding: 7px 10px; border-radius: 8px; font-size: 14px;
}
.sidebar a.nav:hover, .sidebar a.nav.active { background: rgba(255, 255, 255, 0.08); }
.sidebar a.nav.active { color: #f2e2bc; }
.side-foot { margin-top: auto; padding: 12px 8px 0; font-size: 13px; color: #c5d5cc; }
.side-foot form { margin-top: 8px; }
.sidebar .logout {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: #e7f3ec;
  border: 1px solid rgba(231, 243, 236, 0.28);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
}
.sidebar .logout:hover,
.sidebar .logout:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #f2e2bc;
  outline: none;
}
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 18px 28px 0;
}
.topbar h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; margin: 0; letter-spacing: -0.03em; }
.muted { color: var(--ink-soft); }
.crumb { color: var(--ink-soft); font-size: 13px; margin-bottom: 4px; }
.content { padding: 18px 28px 48px; }
.nav-burger {
  display: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1.3fr 0.7fr; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px 18px;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 16px; }
.stat b { display: block; font-variant-numeric: tabular-nums; font-size: 22px; margin-top: 6px; }
.stat span { color: var(--ink-soft); font-size: 13px; }
.ok-pill, .pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; border: 1px solid var(--line); background: #f7f1e6; }
.ok-pill { background: #e5f4ee; color: var(--jade-deep); border-color: #b7dfd0; }
.pill.warn { background: #fff1dc; color: var(--warn); }
.pill.bad { background: #fde8e8; color: var(--red); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.neg { color: var(--red); }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-bottom: 12px; }
label.field span { color: var(--ink-soft); }
input, select, textarea {
  background: white; border: 1px solid #d9d0c2; border-radius: 10px; padding: 9px 10px; width: 100%;
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b7dfd0; border-color: var(--jade); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .btn {
  background: var(--jade); color: white; border: 0; border-radius: 999px; padding: 9px 14px;
  text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger, .btn.danger { background: var(--red); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.banner, .flash { border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.flash.ok { background: #e5f4ee; color: var(--jade-deep); }
.flash.err { background: #fde8e8; color: var(--red); }
.flash.warn, .banner { background: #fff6e8; color: #6d3b05; border: 1px solid #f0d7b0; }
.empty { color: var(--ink-soft); padding: 12px 0; }
.sheet {
  background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px;
  max-width: 860px;
}
.sheet-head { display: flex; justify-content: space-between; gap: 20px; }
.lines input { min-width: 0; }
.balance-hint { font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; }
.guest {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr;
}
.guest-story { padding: 56px 48px; background: var(--sidebar); color: var(--sidebar-text); }
.guest-story h1 { font-family: var(--serif); font-weight: 560; font-size: 48px; line-height: 1.05; margin: 12px 0; }
.guest-panel { padding: 48px 36px; display: flex; align-items: center; }
.guest-card { width: min(440px, 100%); }
.demo-box { background: #f7f1e6; border-radius: 12px; padding: 12px; margin-top: 16px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.check input { width: auto; }
.note { font-size: 13px; color: var(--ink-soft); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
@media (max-width: 980px) {
  .stats, .cols-2, .guest { grid-template-columns: 1fr; }
  .nav-burger { display: inline-flex; }
  .sidebar { position: fixed; z-index: 5; transform: translateX(-105%); transition: transform 0.2s ease; }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }
  .content, .topbar, .guest-story, .guest-panel { padding-left: 16px; padding-right: 16px; }
  .guest-story h1 { font-size: 36px; }
}
@media print {
  .sidebar, .topbar, .no-print, .nav-burger { display: none !important; }
  body, .card, .sheet { background: white; box-shadow: none; }
  .content { padding: 0; }
  .shell { display: block; }
}
