:root {
  --ink: #1c1a17;
  --muted: #6a635a;
  --line: #e0d8cc;
  --bg: #f3efe8;
  --surface: #fffcf7;
  --accent: #9a3412;
  --accent-2: #0f766e;
  --danger: #9b1c1c;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 10px 28px rgba(28, 26, 23, 0.06);
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.45; font-size: 14.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.header {
  background: var(--ink); color: #faf7f2; padding: 12px 18px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  border-bottom: 3px solid var(--accent);
}
.brand { display: flex; flex-direction: column; }
.brand strong { font-size: 16px; }
.brand span { font-size: 11px; opacity: 0.7; }
.header-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { font-size: 11.5px; border: 1px solid rgba(255,255,255,0.2); border-radius: 999px; padding: 3px 10px; opacity: 0.85; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 58px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 12px; }
.sidebar h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 8px 6px; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.side-list button {
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  border-radius: 8px; padding: 8px 10px;
}
.side-list button:hover { background: #f5f0e8; }
.side-list button.active { background: #fde8dc; border-color: #f0c4ae; }
.side-list .n { font-weight: 650; font-size: 13px; display: block; }
.side-list .m { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.main { padding: 18px 20px 48px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid #c9bfb0; border-radius: 7px; padding: 7px 9px; background: #fff; min-height: 36px;
}
.field.full { grid-column: 1 / -1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 7px 12px; border: 1px solid transparent;
  font-weight: 650; font-size: 13px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-teal { background: var(--accent-2); color: #fff; }
.btn-ghost { background: #fff; border-color: #c9bfb0; }
.btn-danger { background: #fdecec; color: var(--danger); border-color: #f0c0c0; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; }
.stat .v { font-size: 20px; font-weight: 700; font-family: var(--mono); margin-top: 4px; }
.stat.hl { border-color: #f0c4ae; background: #fff7f2; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.data th { background: #f5f0e8; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-align: left; }
table.data .money { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data input { width: 100%; border: 1px solid transparent; background: transparent; padding: 4px; border-radius: 4px; }
table.data input:hover, table.data input:focus { border-color: #c9bfb0; background: #fff; outline: none; }
table.data tfoot td { font-weight: 700; background: #f5f0e8; }
.toast {
  position: fixed; bottom: 18px; right: 18px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 50;
}
.alert-info { background: #e7f5f3; color: #0f4a44; border: 1px solid #b5ddd7; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } .sidebar { border-right: none; border-bottom: 1px solid var(--line); } }
@media print {
  .header, .sidebar, .no-print, .toast { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
}
