:root {
  --bg: #f3f1eb;
  --fg: #14181c;
  --surface: #fcfaf6;
  --muted: #6b6a64;
  --subtle: #8a8982;
  --primary: #1b5f58;
  --primary-fg: #f4f1ea;
  --border: #e2ddd3;
  --border-strong: #cfc8ba;
  --danger: #9f3a32;
  --danger-fg: #fdf6f4;
  --success: #2c6a4a;
  --success-fg: #f3f8f4;
  --warning: #8a5a18;
  --warning-fg: #fbf6ec;
  --sidebar: #161c1b;
  --sidebar-fg: #ece8df;
  --sidebar-muted: #9aa09c;
  --sidebar-hover: #222a28;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 28, 0.04), 0 8px 24px rgba(20, 24, 28, 0.05);
  --font: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --display: "Fraunces", ui-serif, Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--fg); }
body { margin: 0; min-height: 100dvh; font-family: var(--font); background: var(--bg); color: var(--fg); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.03em; text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
a { color: var(--primary); text-decoration: none; }
button:not(:disabled), [role="button"]:not(:disabled), input[type="submit"]:not(:disabled) { cursor: pointer; }
input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0 1rem; border-radius: 8px; border: 0; background: var(--primary); color: var(--primary-fg); font-weight: 600; font-size: 0.95rem; }
.btn.secondary { background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); }
.btn.danger { background: var(--danger); color: var(--danger-fg); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }
.field input, .field textarea, .field select {
  min-height: 44px; width: 100%; border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--fg); padding: 0.5rem 0.75rem;
}
.field textarea { min-height: 88px; resize: vertical; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.badge.paid, .badge.completed, .badge.active { background: var(--success-fg); color: var(--success); }
.badge.pending, .badge.sent, .badge.viewed, .badge.processing { background: var(--warning-fg); color: var(--warning); }
.badge.partially_paid, .badge.grace { background: #eef4f3; color: var(--primary); }
.badge.cancelled, .badge.failed, .badge.revoked, .badge.invalid, .badge.danger { background: var(--danger-fg); color: var(--danger); }
.badge.draft, .badge.expired, .badge.inactive, .badge.queued { background: #eeeae3; color: var(--muted); }
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--success-fg); color: var(--success); }
.flash.err { background: var(--danger-fg); color: var(--danger); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.admin { min-height: 100dvh; }
@media (min-width: 960px) {
  .admin { display: grid; grid-template-columns: 240px 1fr; }
}
.sidebar { background: var(--sidebar); color: var(--sidebar-fg); display: none; flex-direction: column; }
@media (min-width: 960px) {
  .sidebar { display: flex; position: sticky; top: 0; height: 100dvh; }
}
.sidebar.open { display: flex; position: fixed; inset: 0; z-index: 40; }
.sidebar a { color: var(--sidebar-muted); display: flex; align-items: center; min-height: 44px; padding: 0 0.85rem; border-radius: 8px; }
.sidebar a.active, .sidebar a:hover { background: var(--sidebar-hover); color: var(--sidebar-fg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; height: 56px; padding: 0 1rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 90%, transparent); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
.main { padding: 1.25rem; }
@media (min-width: 960px) { .main { padding: 2rem; } }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-4 { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { padding: 1rem; }
.stat strong { display: block; font-size: 1.35rem; margin-top: 0.35rem; }
.search { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.home-hero { min-height: 100dvh; display: flex; flex-direction: column; }
.home-hero header, .home-hero footer { padding: 1.25rem 1.5rem; }
.home-hero section { flex: 1; display: grid; align-items: center; padding: 2rem 1.5rem; gap: 1.5rem; }
@media (min-width: 900px) {
  .home-hero section { grid-template-columns: 1.05fr 0.95fr; width: min(1100px, 100%); margin: 0 auto; }
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.menu-btn { display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; justify-content: center; background: none; border: 0; color: var(--fg); }
@media (min-width: 960px) { .menu-btn { display: none; } }
.pay-grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .pay-grid { grid-template-columns: 1fr 340px; } }
.qr { background: #fff; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border); max-width: 240px; }
.qr svg { width: 100%; height: auto; display: block; }
.line-row { display: grid; gap: 0.5rem; grid-template-columns: 1fr; margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
@media (min-width: 700px) { .line-row { grid-template-columns: 2fr 1fr 90px 120px auto; align-items: end; } }
.copy { font-size: 0.8rem; color: var(--muted); }
.copyright { font-size: 0.72rem; color: var(--sidebar-muted); padding: 1rem; }
body.admin-body .copyright { color: var(--sidebar-muted); }
.stamp { display:inline-block;margin-top:1rem;padding:0.25rem 0.7rem;border:2px solid var(--danger);color:var(--danger);font-weight:700;letter-spacing:0.14em;font-size:0.75rem;transform:rotate(-6deg); }
.bars { display:flex;align-items:flex-end;gap:0.55rem;height:170px;padding-top:0.5rem; }
.bar-col { flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:0.35rem;min-width:0; }
.bar { width:100%;max-width:36px;background:var(--primary);border-radius:6px 6px 2px 2px; }
.bar-col span { font-size:0.7rem;color:var(--muted); }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
