:root {
  --bg: #f4f6f8; --card: #fff; --text: #1b1f23; --muted: #5f6b76; --border: #d0d7de;
  --primary: #1f5f8b; --expense: #b3261e; --income: #1e7d32;
  font-family: system-ui, sans-serif; font-size: 18px; color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
section { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.3rem; margin: 0 0 12px; text-align: center; }
label { display: block; margin: 12px 0; font-weight: 600; }
input { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-size: 1.1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

.big { display: block; width: 100%; min-height: 56px; margin: 12px 0; border: 0; border-radius: 12px;
  font-size: 1.2rem; font-weight: 700; color: #fff; }
.big:disabled { opacity: .6; }
.primary { background: var(--primary); }
.expense { background: var(--expense); }
.income { background: var(--income); }
.link { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 12px 0; }
.danger { color: var(--expense); }
.row { display: flex; justify-content: space-between; }
.error { color: var(--expense); min-height: 1.2em; margin: 4px 0; }
.muted { color: var(--muted); text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--card); }
.chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

.month-bar { display: flex; align-items: center; justify-content: space-between; }
.month-bar h1 { margin: 0; }
.month-bar button { width: 56px; height: 56px; font-size: 2rem; border: 0; background: none; color: var(--primary); }
.month-bar button:disabled { visibility: hidden; }

.totals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.totals div { background: var(--card); border-radius: 10px; padding: 10px; text-align: center; }
.totals dt { color: var(--muted); font-size: .85rem; }
.totals dd { margin: 4px 0 0; font-weight: 700; font-size: .95rem; }
.totals .kalan { grid-column: 1 / -1; }
.totals .kalan dd { font-size: 1.8rem; }
.negative { color: var(--expense); }

.add-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.add-buttons .big { margin: 0; }

#entries { list-style: none; padding: 0; margin: 16px 0; }
#entries li { display: grid; grid-template-columns: 3.2em 1fr auto; gap: 8px; align-items: center;
  background: var(--card); border-radius: 10px; padding: 14px 12px; margin-bottom: 6px; cursor: pointer; }
#entries li span:nth-child(2) { overflow-wrap: anywhere; }
#entries li span:last-child { font-weight: 700; white-space: nowrap; }
#entries .expense span:last-child { color: var(--expense); }
#entries .income span:last-child { color: var(--income); }

.reminder { background: #fff4ce; border-radius: 10px; padding: 10px 12px; }
.menu { margin: 16px 0 32px; }
.menu summary { padding: 12px 0; color: var(--muted); }
.menu button { display: block; width: 100%; min-height: 48px; margin: 6px 0; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); }
