:root {
  --bg: #f6f4ef; --card: #fff; --text: #1d1d1b; --muted: #6b6b66; --accent: #c8102e; --ok: #2e7d32; --line: #e4e1d8;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --card: #232321; --text: #f1efe8; --muted: #a09d94; --accent: #ef4a63; --ok: #6bc16f; --line: #34332f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, sans-serif; }
main { max-width: 480px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 12px; }
h2 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); }
header { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--accent); min-height: 1.4em; }
button, a.primary, input { font: inherit; }
input { width: 100%; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
button.primary, a.primary { display: block; width: 100%; text-align: center; text-decoration: none; padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; margin-bottom: 8px; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.list { display: grid; gap: 8px; margin-bottom: 12px; }
.row { padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); cursor: pointer; }
.balance { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; display: flex; justify-content: space-between; align-items: baseline; }
.balance strong { font-size: 1.8rem; color: var(--ok); }
.balance.owed strong { color: var(--accent); }
.items { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.item { padding: 20px 8px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); font-weight: 600; font-size: 1.1rem; cursor: pointer; display: grid; gap: 4px; justify-items: center; }
.item:active { transform: scale(.97); border-color: var(--accent); }
.item small { color: var(--muted); font-weight: 400; }
.emoji { font-size: 2.4rem; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.hist { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.hist:last-child { border: 0; }
.voided { text-decoration: line-through; color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 20px; }
table { width: 100%; border-collapse: collapse; }
td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions button { margin-left: 4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; }
.item.big { width: 100%; margin-bottom: 16px; padding: 28px 8px; }
.item.big:disabled { opacity: .6; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet-box { width: 100%; max-width: 480px; background: var(--card); border-radius: 20px 20px 0 0; padding: 16px 16px 24px; text-align: center; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.kinds button { padding: 14px 8px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font-weight: 600; cursor: pointer; display: grid; gap: 4px; justify-items: center; }
.kinds .emoji { font-size: 1.8rem; }
details.fb { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
details.fb summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--text); cursor: pointer; }
.note { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.note:last-child { border: 0; }
.note small { color: var(--muted); display: block; }
.badge { background: var(--accent); color: #fff; border-radius: 12px; padding: 0 10px; font-size: 1rem; vertical-align: middle; }
a.primary.alt { background: var(--card); color: var(--text); border: 2px solid var(--accent); }
.dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--text); border-color: var(--text); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto 12px; }
.pad button { padding: 18px 0; font-size: 1.5rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); cursor: pointer; }
.pad button:active { background: var(--line); }
.pad .ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.error { text-align: center; }
.logo { display: block; width: 62%; max-width: 240px; height: auto; margin: 4px auto 8px; border-radius: 18px; }
.foot { text-align: center; padding: 8px 0 24px; font-size: .85rem; }
.foot a, p a { color: var(--muted); }
.iban { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.iban b { white-space: nowrap; font-size: .92rem; }
.iban .chip { flex: none; }
details.pay .primary { margin-top: 8px; }
