:root {
  --ink: #1c1915;
  --muted: #5e584e;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #e3dacc;
  --brand: #1e3b32;
  --brand-ink: #f6f3ec;
  --accent: #9a4e24;
  --danger: #8d2e2e;
  --ok: #1d6a43;
  --warn: #8a5a12;
  --shadow: 0 16px 40px rgba(40, 32, 20, 0.06);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #efe4d2 0%, transparent 55%),
    var(--paper);
  min-height: 100vh;
}

a { color: var(--brand); }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--brand);
  color: var(--brand-ink);
}

.brand { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.brand strong { font-size: 1.15rem; letter-spacing: 0.01em; }
.brand span { font-size: 0.78rem; opacity: 0.8; }

.site-header nav { display: flex; gap: 16px; }
.site-header nav a { color: var(--brand-ink); text-decoration: none; font-size: 0.92rem; }
.site-header nav a:hover { text-decoration: underline; }
.site-header button.secondary {
  width: auto;
  min-height: 36px;
  padding: 8px 14px;
  color: var(--brand-ink);
  border-color: rgba(246, 243, 236, 0.55);
  background: transparent;
}

.wrap { width: min(960px, calc(100% - 32px)); margin: 32px auto 64px; }
.lede { max-width: 62ch; line-height: 1.5; }
.hint, .fine-print { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.fields { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 12px 12px;
  font: inherit;
  color: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }

button, .button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 650;
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
button.secondary, .button.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stack { display: grid; gap: 12px; }

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  background: #f3e6d4;
  color: var(--ink);
  line-height: 1.45;
}
.banner.error { background: #f8e4e4; color: var(--danger); }
.banner.ok { background: #e5f3eb; color: var(--ok); }
.banner.warn { background: #f8efd8; color: var(--warn); }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #ece7dc;
}
.pill.open { background: #e4efe9; color: var(--brand); }
.pill.disputed { background: #f8e7da; color: var(--accent); }
.pill.paid { background: #e5f3eb; color: var(--ok); }
.pill.cancelled { background: #eceae6; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: 0.82rem; }
.stat strong { display: block; margin-top: 6px; font-size: 1.35rem; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }

.money { font-variant-numeric: tabular-nums; }

@media (min-width: 720px) {
  .fields.two { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 720px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  td { border: 0; padding: 4px 0; }
  td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
  button, .button { width: 100%; }
}
