:root {
  --bg: #ebe4d6;
  --paper: #fffcf7;
  --ink: #221c18;
  --muted: #6e655c;
  --line: #e3d9cb;
  --rail: #241c19;
  --rail-text: #f4efe8;
  --burgundy: #7d2432;
  --burgundy-deep: #611824;
  --ok: #17653e;
  --ok-bg: #e6f3eb;
  --gap: #7d2432;
  --gap-bg: #f8ece8;
  --wait-bg: #f3ecdf;
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.45;
}
a { color: var(--burgundy-deep); }
h1, h2, .hero-num, .brand-name { font-family: var(--serif); font-weight: 560; }
h1 { font-size: 32px; line-height: 1.1; margin: 0; }
h2 { font-size: 18px; margin: 18px 0 8px; }
button, input, select { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--burgundy); color: white;
  font-family: var(--serif); font-size: 15px; letter-spacing: .04em;
}
.brand-name { display: block; font-size: 18px; line-height: 1.1; }
.brand-sub { display: block; color: #cfc4b8; font-size: 12px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.nav a {
  color: var(--rail-text); text-decoration: none;
  padding: 8px 10px; border-radius: 8px;
}
.nav a.on { background: var(--rail-text); color: var(--rail); }
.rail-user { margin-top: auto; display: grid; gap: 2px; font-size: 14px; }
.rail-user span { color: #cfc4b8; }
.main { padding: 28px 32px 64px; max-width: 1180px; }
.page-head { margin-bottom: 18px; }
.kicker {
  margin: 0 0 4px; letter-spacing: .08em; text-transform: uppercase;
  font-size: 11px; color: var(--muted);
}
.lede { margin: 8px 0 0; color: var(--muted); max-width: 62ch; }
.flash { padding: 10px 12px; border-radius: 8px; background: var(--ok-bg); }
.flash.bad { background: var(--gap-bg); }
.panel, .hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.stack { display: grid; gap: 14px; }
.split { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; align-items: start; }
.semana-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.semana-top, .toolbar, .inline-form, .link-row, .preset-row, .stat-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px;
}
.stat-row p { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 180px; }
.stat-row strong { display: block; font-family: var(--serif); font-size: 28px; }
.field { display: grid; gap: 4px; }
.field span, .switcher span { font-size: 12px; color: var(--muted); }
input::placeholder { color: #b3a89c; }
.field input, .field select, .tape-row input, .line-add input, .line-add select, .inline-form input, .inline-form select, .switcher select, .sheet input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 2px;
  min-width: 0;
}
.sheet input { width: 110px; text-align: right; }
.tape-row input { width: 140px; text-align: right; }
.btn, .text-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.btn-primary { background: var(--burgundy); border-color: var(--burgundy); color: white; }
.btn-ghost { background: transparent; }
.btn-ghost.light { color: var(--rail-text); border-color: #4a403b; }
.text-btn { border: 0; padding: 0; background: none; color: var(--burgundy); border-radius: 0; }
.tape-kicker { margin: 0; color: var(--muted); }
.tape-row, .tape-sum {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  align-items: center; margin: 0; padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.tape-sum { border-bottom: 0; margin-top: 6px; }
.tape-meta { margin: 0 0 0 12px; color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hero-num { font-size: 48px; line-height: 1; margin: 6px 0; letter-spacing: -0.03em; }
.hero-num.small { font-size: 36px; }
.hero.wait { background: var(--wait-bg); }
.hero.ok { background: var(--ok-bg); }
.hero.ok .hero-num { color: var(--ok); }
.hero.gap { background: var(--gap-bg); }
.hero.gap .hero-num { color: var(--gap); }
.muted { color: var(--muted); }
.block { display: block; font-size: 12px; }
.tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; background: var(--wait-bg); font-size: 12px;
}
.tag.late { background: var(--gap-bg); color: var(--gap); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.table-wrap { overflow-x: auto; }
table.sheet { width: 100%; border-collapse: collapse; background: var(--paper); }
table.sheet th, table.sheet td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; text-align: left; }
table.sheet th { font-size: 12px; color: var(--muted); font-weight: 500; }
table.sheet tfoot td { font-family: var(--serif); font-size: 18px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lines li { display: flex; justify-content: space-between; gap: 8px; }
.line-add, .fields-3 { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.line-add input { width: 80px; }
.check { display: flex; gap: 8px; align-items: center; }
.panel-h { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.bill { padding: 8px 0; border-top: 1px solid var(--line); }
.empty h2 { margin-top: 0; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.login-card h1 { margin: 12px 0 0; }
.print-body { background: white; }
.print-head h1 { margin: 0; }
.noprint.bar { display: flex; gap: 12px; margin-bottom: 16px; }
@media print {
  .noprint { display: none !important; }
  body { background: white; }
  .sheet, .panel { border: 0; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .rail { position: sticky; height: auto; }
  .nav { flex-direction: row; overflow: auto; margin-top: 14px; }
  .rail-user { margin-top: 14px; }
  .split, .semana-grid { grid-template-columns: 1fr; }
  .main { padding: 18px 14px 48px; }
}
