:root {
  --bg: #f4fbff; --card: #fff; --text: #22384c; --muted: #6d8aa3;
  --primary: #2f8fd4; --primary-dark: #236fa8; --danger: #b42318; --warn: #b54708; --ok: #1e7b34;
  --topbar: #d3ebfb; --topbar-text: #17537f;
  --border: #e2f0fa; --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 62, 94, .04), 0 8px 20px rgba(29, 62, 94, .05);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--primary); }
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; background: linear-gradient(135deg, #e3f3fd, #c9e6fa); color: var(--topbar-text); box-shadow: 0 1px 6px rgba(29, 62, 94, .08); }
.topbar a, .topbar .link { color: var(--topbar-text); text-decoration: none; }
.brand { font-weight: 700; }
.nav-toggle { display: none; }
.nav-burger { font-size: 1.5rem; cursor: pointer; }
.nav { display: none; width: 100%; flex-direction: column; gap: .5rem; }
.nav-toggle:checked ~ .nav { display: flex; }
@media (min-width: 720px) {
  .nav-burger { display: none; }
  .nav { display: flex; width: auto; flex-direction: row; gap: 1.25rem; align-items: center; }
}
.container { max-width: 960px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .25rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.narrow { max-width: 420px; margin: 2rem auto; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; }
.field ul { list-style: none; padding: 0; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: .6rem; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a8cfee; outline-offset: 1px; border-color: var(--primary); }
.error { color: var(--danger); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.btn { display: inline-block; padding: .55rem 1rem; border: 0; border-radius: 999px; background: var(--primary); color: #fff; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-secondary:hover { background: #eaf6fe; }
.btn-danger { background: var(--danger); }
.btn-small { padding: .3rem .6rem; font-size: .875rem; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.msg { padding: .6rem .8rem; border-radius: 10px; margin-bottom: .75rem; background: #e6f4fe; }
.msg-error { background: #fdecea; color: var(--danger); }
.msg-warning { background: #fef4e6; color: var(--warn); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
thead th { background: #eff8fe; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.status-PAID { color: var(--ok); }
.status-PARTIAL { color: var(--warn); }
.status-UNPAID { color: var(--danger); }
.calendar { table-layout: fixed; }
.calendar td { height: 4.5rem; font-size: .8rem; }
.calendar .out { color: #aac4d6; background: #fafdff; }
.calendar .today { outline: 2px solid var(--primary); outline-offset: -2px; }
.calendar .dot { display: block; margin-top: .2rem; padding: .1rem .25rem; border-radius: 6px; background: #d9edfc; color: var(--primary-dark); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
details.section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; padding: .25rem 1rem 1rem; }
details.section > summary { cursor: pointer; font-weight: 600; padding: .75rem 0; }
.options { list-style: none; padding: 0; margin: .5rem 0; }
.options li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.options .count { margin-left: auto; font-weight: 600; }
.options .voters { flex-basis: 100%; }
.badge { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .75rem; background: #e6f4fe; color: var(--primary-dark); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem; }
.stat strong { display: block; font-size: 1.3rem; }
@media (max-width: 480px) {
  .calendar td { height: 3rem; font-size: .7rem; }
  .calendar .dot { font-size: 0; height: .4rem; padding: 0; }
}
