/* Kobo — receipt paper, Naira-note green, a little mustard. */
:root {
  --paper: #fbf6ea;
  --paper-2: #f3ecdb;
  --card: #fffdf7;
  --ink: #1b2420;
  --ink-2: #47524c;
  --muted: #6f776f;
  --line: #e2d9c4;
  --green: #0b5d43;
  --green-2: #127a59;
  --green-soft: #dcefe5;
  --mustard: #f4c542;
  --tomato: #d94b2b;
  --tomato-soft: #fbe3dc;
  --radius: 16px;
  --display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --body: "Karla", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -50px; background: var(--ink); color: #fff; padding: .5rem .9rem; border-radius: 8px; z-index: 50; }
.skip-link:focus { top: 1rem; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
kbd { font: 500 .75rem var(--mono); padding: .05rem .4rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--card); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--green); color: var(--mustard); font: 800 1.3rem var(--display); transform: rotate(-4deg); transition: transform .3s cubic-bezier(.3,1.6,.5,1); }
.brand:hover .brand-mark { transform: rotate(4deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font: 800 1.35rem var(--display); letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: .8rem; }
.month-picker { display: flex; align-items: center; gap: .3rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; }
.month-picker input { border: 0; background: transparent; padding: .35rem .4rem; font-family: var(--mono); font-size: .9rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--paper-2); cursor: pointer; font-size: 1.2rem; line-height: 1; transition: background .2s, transform .15s; }
.icon-btn:hover { background: var(--green); color: #fff; }
.icon-btn:active { transform: scale(.92); }

.layout { display: grid; gap: 1.25rem; padding: 1.75rem 0 3rem; }

/* Hero */
.hero-card { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding: 2rem 2.2rem; border-radius: 24px; background: var(--green); color: #f6f3e8; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(244, 197, 66, .12); }
.eyebrow { margin: 0 0 .4rem; font: 500 .85rem var(--mono); color: var(--mustard); letter-spacing: .03em; }
.headline { margin: 0; font: 700 clamp(1.7rem, 3.6vw, 2.6rem)/1.12 var(--display); letter-spacing: -.02em; max-width: 22ch; }
.headline em { font-style: normal; color: var(--mustard); }
.subline { margin: .7rem 0 0; color: #cfe3d8; max-width: 52ch; font-size: 1.05rem; }
.budget-meter { position: relative; width: 132px; height: 132px; z-index: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: rgba(255,255,255,.14); }
.ring-fill { stroke: var(--mustard); stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1), stroke .3s; }
.ring-fill.over { stroke: #ff8a6b; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font: 700 1.6rem var(--display); }
.ring-label span { font-size: .75rem; color: #cfe3d8; }

/* Stats */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat { padding: 1rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); position: relative; transition: transform .2s, box-shadow .2s; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -18px rgba(27,36,32,.5); }
.stat .label { margin: 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { margin: .25rem 0 0; font: 600 1.55rem var(--mono); letter-spacing: -.02em; }
.stat .value-sm { font: 700 1.25rem var(--display); }
.value.ok { color: var(--green-2); }
.value.over { color: var(--tomato); }

/* Panels */
.content-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.25rem; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.4rem 1.5rem; }
.panel-head { margin-bottom: 1.1rem; }
.panel-head h2 { margin: 0; font: 700 1.3rem var(--display); letter-spacing: -.01em; }
.muted { color: var(--muted); margin: .2rem 0 0; }
.small { font-size: .88rem; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.wrap { flex-wrap: wrap; }

/* Form */
label, legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; padding: 0; }
.optional { font-weight: 400; color: var(--muted); font-size: .8rem; }
fieldset { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
.amount-field { margin-bottom: 1rem; }
.amount-input { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); padding-left: 1rem; transition: border-color .2s, box-shadow .2s; }
.amount-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.amount-input span { font: 600 1.6rem var(--mono); color: var(--muted); }
.amount-input input { flex: 1; min-width: 0; border: 0; background: transparent; padding: .7rem .6rem; font: 600 1.8rem var(--mono); outline: none; }
.amount-input-sm span { font-size: 1rem; }
.amount-input-sm input { font-size: 1rem; padding: .55rem .5rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.cat-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .8rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 500; font-size: .92rem; transition: all .18s; }
.cat-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.cat-chip:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.cat-chip[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.form-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: .9rem; margin-bottom: 1.1rem; }
.field input, .field select, .filters input, .filters select { width: 100%; padding: .65rem .8rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); transition: border-color .2s; }
.field input:focus, .filters input:focus, .filters select:focus { outline: none; border-color: var(--green); }
.invalid, .amount-input.invalid { border-color: var(--tomato) !important; }
.field-error { display: block; min-height: 1.1em; color: var(--tomato); font-size: .85rem; margin-top: .25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .75rem 1.2rem; border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; cursor: pointer; transition: transform .15s, background .2s, box-shadow .2s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 3px 0 #073d2c; }
.btn-primary:hover { background: var(--green-2); }
.btn-primary.saved { background: var(--mustard); color: var(--ink); box-shadow: 0 3px 0 #b08a1f; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: .5rem .85rem; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; font-size: 1.05rem; }
.budget-form { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1.5px dashed var(--line); }
.inline-form { display: flex; gap: .6rem; }
.inline-form .amount-input { flex: 1; }

/* Chart */
.chart { display: grid; gap: .55rem; }
.chart-row { display: grid; grid-template-columns: 132px 1fr auto; gap: .8rem; align-items: center; padding: .35rem .5rem; margin: 0 -.5rem; border-radius: 10px; cursor: pointer; border: 0; background: transparent; text-align: left; width: calc(100% + 1rem); transition: background .2s; }
.chart-row:hover, .chart-row.active { background: var(--paper-2); }
.chart-label { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .95rem; }
.chart-label i { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.chart-track { height: 14px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; width: 0; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.chart-amount { font: 500 .9rem var(--mono); }

/* Receipts */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters input { width: 190px; }
.filters select { width: auto; }
.receipt-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px dashed var(--line); }
.receipt { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 1rem; align-items: center; padding: .85rem .4rem; border-bottom: 1px dashed var(--line); animation: slideIn .35s ease both; transition: background .2s; }
.receipt:hover { background: var(--paper); }
.receipt.flash { animation: flash 1.2s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background: #fff3c4; } 100% { background: transparent; } }
.r-date { font: 500 .8rem var(--mono); color: var(--muted); text-align: center; line-height: 1.15; }
.r-date b { display: block; font: 700 1.3rem var(--display); color: var(--ink); }
.r-main { min-width: 0; }
.r-note { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-cat { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--ink-2); }
.r-cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.r-amount { font: 600 1.05rem var(--mono); }
.row-actions { display: flex; gap: .3rem; opacity: .35; transition: opacity .2s; }
.receipt:hover .row-actions, .receipt:focus-within .row-actions { opacity: 1; }
.row-actions button { border: 1px solid var(--line); background: var(--card); padding: .3rem .6rem; border-radius: 8px; cursor: pointer; font-size: .82rem; font-weight: 600; }
.row-actions button:hover { border-color: var(--ink); }
.row-actions button[data-delete]:hover { border-color: var(--tomato); color: var(--tomato); }
.list-foot { margin-top: 1rem; text-align: right; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .88rem; }
.link-btn:hover { color: var(--tomato); }

.empty-state { display: flex; gap: 1rem; align-items: center; padding: 1.2rem; border-radius: 14px; background: var(--paper); color: var(--ink-2); }
.empty-state[hidden] { display: none; }
.empty-state p { margin: 0; }
.empty-art { width: 56px; flex: none; color: var(--green-2); }

/* Footer & toast */
.site-footer { border-top: 1px solid var(--line); padding: 1.4rem 0 2rem; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 150%); visibility: hidden; display: flex; align-items: center; gap: .9rem; background: var(--ink); color: #fff; padding: .7rem .8rem .7rem 1.1rem; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); transition: transform .3s cubic-bezier(.3,1.4,.5,1), visibility 0s .3s; z-index: 60; }
.toast.show { transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
.toast button { border: 0; background: var(--mustard); color: var(--ink); font-weight: 700; padding: .35rem .75rem; border-radius: 8px; cursor: pointer; }

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hero-card { grid-template-columns: 1fr; padding: 1.5rem; }
  .budget-meter { width: 104px; height: 104px; }
  .brand-text small { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .receipt { grid-template-columns: 48px 1fr auto; }
  .row-actions { grid-column: 2 / -1; opacity: 1; }
  .filters, .filters input { width: 100%; }
  .chart-row { grid-template-columns: 90px 1fr auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
