:root {
  --bg: #f3efe6;
  --bg-2: #e8e2d4;
  --ink: #1c1914;
  --muted: #5e584d;
  --brand: #2a4a34;
  --brand-2: #3d6b4b;
  --card: #fffdf8;
  --line: #ddd4c4;
  --income: #1f7a45;
  --expense: #b42318;
  --warn: #9a6700;
  --info: #1d4e6e;
  --planned: #9a6700;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(40, 32, 18, 0.06);
  --font: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
  --serif: "Palatino Linotype", Palatino, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #efe7d4, transparent), var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); margin: 0 0 .4rem; font-weight: 600; }
p { margin: 0 0 .75rem; }

.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand);
  color: #f6f1e6;
  padding: 1.2rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand { font-family: var(--serif); font-size: 1.35rem; margin-bottom: .2rem; }
.brand small { display: block; font-family: var(--font); opacity: .75; font-size: .78rem; }
.nav { display: flex; flex-direction: column; gap: .2rem; margin-top: 1.2rem; }
.nav a {
  color: #f6f1e6;
  text-decoration: none;
  padding: .45rem .65rem;
  border-radius: 10px;
  opacity: .9;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); opacity: 1; text-decoration: none; }
.nav .section-label { opacity: .55; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; margin: .8rem .65rem .2rem; }
.main { padding: 1.2rem 1.4rem 3rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: .2rem .6rem; font-size: .8rem; color: var(--muted);
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.card h2, .card h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }
.kpi { display: flex; flex-direction: column; gap: .2rem; }
.kpi .value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.pos { color: var(--income); }
.neg { color: var(--expense); }
.warn { color: var(--warn); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pill {
  display: inline-block; border-radius: 999px; padding: .1rem .5rem; font-size: .75rem;
  background: var(--bg-2); color: var(--ink);
}
.pill.income { background: #d8f3e3; color: #14532d; }
.pill.expense { background: #fde2df; color: #7f1d1d; }
.pill.transfer { background: #e4eef6; color: #1e3a5f; }
.pill.refund { background: #ece7f8; color: #3b0764; }
.pill.planned, .pill.due { background: #fff3d6; color: #7a4d00; }
.pill.paid, .pill.collected { background: #d8f3e3; color: #14532d; }
.pill.cancelled { background: #eee; color: #57534e; }
.btn, button.btn, input[type=submit] {
  appearance: none; border: 0; background: var(--brand); color: #fff;
  padding: .55rem .9rem; border-radius: 10px; cursor: pointer; font-weight: 600;
  display: inline-block; text-decoration: none;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--expense); }
.btn.small { padding: .3rem .55rem; font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: .5rem .65rem;
}
textarea { min-height: 90px; }
.flash { padding: .7rem .9rem; border-radius: 12px; margin-bottom: .8rem; }
.flash.success { background: #d8f3e3; }
.flash.error { background: #fde2df; }
.flash.info { background: #e4eef6; }
.guest {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
}
.guest-card { width: min(560px, 100%); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.progress { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-2); }
.progress.over > span { background: var(--expense); }
.menu-toggle { display: none; }
.help { font-size: .85rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.cal .day { min-height: 92px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .35rem; }
.cal .dow { font-size: .75rem; color: var(--muted); text-align: center; }
.ev { font-size: .72rem; margin-top: .2rem; padding: .15rem .25rem; border-radius: 6px; background: #f6eedc; }
.score { font-size: 2.4rem; font-family: var(--serif); }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(80vw, 280px); transform: translateX(-110%); z-index: 20; transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .main { padding: 1rem .8rem 5rem; }
}
