:root {
  --paper: #f4efe4;
  --paper-2: #fffdf8;
  --ink: #1e2430;
  --muted: #6b6458;
  --line: #e3d8c4;
  --green: #1b5e45;
  --green-dark: #123c2d;
  --green-soft: #e7f2ec;
  --clay: #9c4328;
  --gold: #a78445;
  --shadow: 0 16px 40px rgba(48, 36, 18, 0.08);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(198, 161, 91, 0.18), transparent 28%),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
img, svg { max-width: 100%; }
a { color: var(--green-dark); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.4em; }
p { margin: 0 0 0.8em; }
button, input, select, textarea { font: inherit; color: inherit; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: white;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-header, .admin-nav, main, .site-footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(244, 239, 228, 0.92);
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; margin-right: auto; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--green);
  color: #f7f3ea;
  font-family: var(--serif);
  font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.brand-text strong { font-family: var(--serif); font-size: 22px; white-space: nowrap; }
.nav, .admin-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.nav a, .admin-nav a { text-decoration: none; color: var(--ink); padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav a.is-active, .admin-nav a.is-active { border-color: var(--green); color: var(--green-dark); font-weight: 600; }
.admin-nav {
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.who { margin-left: auto; color: var(--muted); font-size: 14px; }
main { padding-bottom: 64px; }
.site-footer { padding: 18px 0 36px; color: var(--muted); font-size: 14px; }

.hero, .page-intro, .section, .panel { margin-top: 28px; }
.hero { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 28px; align-items: center; }
.eyebrow { color: var(--gold); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px; }
.lede { font-size: 1.12rem; }
.hero-art { width: 100%; height: auto; display: block; filter: drop-shadow(var(--shadow)); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.hero-stats div, .stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.hero-stats dt, .stat span { color: var(--muted); font-size: 13px; }
.hero-stats dd, .stat strong { margin: 0; font-family: var(--serif); font-size: 28px; white-space: nowrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin: 18px 0; }
.stat-row .stat {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 112px;
  padding: 16px 16px 14px;
}
.stat-row .stat span { display: block; line-height: 1.35; }
.stat-row .stat strong { display: block; font-size: clamp(22px, 15cqi, 32px); line-height: 1.05; }
.hero-actions, .bar-actions, .split, .form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.split { justify-content: space-between; }
.section-head, .panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.khu-head { display: flex; justify-content: flex-start; gap: 12px; align-items: baseline; }
.khu-head span { color: var(--muted); font-weight: 600; }
.muted, .quiet, .meta, .code { color: var(--muted); }
.code { display: block; font-size: 12px; }
.khu-grid, .card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.khu-card, .project-card, .card, .panel, .profile-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.khu-card, .project-card { display: block; padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.khu-card strong { display: block; font-family: var(--serif); font-size: 28px; }
.khu-head a { color: inherit; text-decoration: none; }
.khu-head a:hover { color: var(--green-dark); }
.area-head { margin-bottom: 18px; max-width: 560px; }
.is-head { background: var(--green-soft); }
.project-card h3 { font-size: 1.25rem; }
.project-card p:last-child { margin-bottom: 0; }
.card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.money { font-family: var(--serif); font-size: 1.6rem; margin: 8px 0 0; }
.panel { padding: 18px; }
.khu { margin-top: 22px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 600;
}
.badge-open { background: #e5f4ea; color: #146338; }
.badge-closed { background: #f3e6dc; color: var(--clay); }
.badge-muted { background: #eeeae2; color: var(--muted); }
.year { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: #efe6d6; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--green); }
.bar-lg { height: 12px; margin: 8px 0 18px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 18px; }
.search input, select, .form-card input, .form-card textarea, .form-card select, .ledger input {
  width: 100%;
  border: 1px solid #d9cdb8;
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
}
.search { min-width: min(100%, 280px); flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .btn, .linkish {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.chip.is-on, .btn-primary { background: var(--green); color: white; border-color: var(--green); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--clay); color: white; border-color: var(--clay); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.checkline { display: flex; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.panel, .khu, .section { max-width: 100%; min-width: 0; }
.sheet { width: 100%; border-collapse: collapse; min-width: 640px; }
.sheet th, .sheet td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sheet th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.group-line th { background: var(--green-soft); color: var(--green-dark); text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 18px; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.is-paid { background: #f3faf5; }
.is-paid td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.is-hidden { display: none !important; }
.actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.actions form { margin: 0; }
.linkish { border: 0; background: transparent; padding: 0; color: var(--green-dark); border-radius: 0; }
.ledger { min-width: 720px; }
.ledger input { padding: 8px 10px; }
.amount-input { width: 130px; }
.note-input { min-width: 180px; width: 100%; }
.paid-cell { width: 88px; text-align: center; }
.paid-input { width: 18px; height: 18px; }
.status-cell, .date-cell { white-space: nowrap; }
.ledger-bar {
  position: sticky;
  top: 74px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.ledger-bar strong { display: block; font-family: var(--serif); font-size: 28px; }
.flash {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-soft);
}
.flash-error { background: #fde8e2; color: #7a2e1d; }
.form-card { padding: 22px; display: grid; gap: 14px; max-width: 720px; }
.form-card label, .form-row label { display: grid; gap: 6px; font-weight: 600; flex: 1; }
.form-card p { margin: 0; }
.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.narrow { max-width: 760px; }
.danger-zone { margin-top: 18px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.profile-grid-compact { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.profile-card { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: start; padding: 16px; }
.profile-link { text-decoration: none; color: inherit; }
.profile-link strong, .person { display: block; font-family: var(--serif); font-size: 1.25rem; }
.profile-card h2 { font-size: 1.35rem; margin-bottom: 0.2em; }
.duty, .bio { color: var(--muted); }
.bio { white-space: pre-line; }
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--green);
}
.avatar-fallback {
  display: grid;
  place-items: center;
  color: #f7f3ea;
  font-family: var(--serif);
  font-size: 32px;
}
.avatar-sm { width: 48px; height: 48px; font-size: 20px; }
.profile-grid-compact .profile-card { grid-template-columns: 48px 1fr; align-items: center; }
.photo-field { display: flex; gap: 14px; align-items: center; }
.photo-field label { flex: 1; }
.empty { padding: 12px 0; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .who { margin-left: 0; }
  .ledger-bar, .split { align-items: stretch; flex-direction: column; }
  .site-header { position: static; flex-direction: column; align-items: stretch; gap: 8px; }
  .nav { width: 100%; min-width: 0; gap: 2px 12px; font-size: 15px; }
  .nav a { white-space: nowrap; }
  .ledger-bar { top: 8px; }
}
@media print {
  .site-header, .admin-nav, .filters, .hero-actions, .site-footer, .skip, .ledger-bar { display: none !important; }
  body { background: white; }
  .panel, .project-card, .khu-card { box-shadow: none; }
}
