/* NV Spend — a cognac leather wallet with stitched edges and cream card stock. Fonts: IBM Plex (SIL OFL). */
@font-face { font-family: 'Plex Mono'; src: url('./fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --leather: #6b3a22; --leather-2: #3b2216; --cream: #f6eee0; --card: #fffaf1; --ink: #2d1d14; --muted: #7b6658;
  --stitch: rgba(246, 238, 224, 0.55); --accent: #c8743a; --good: #3d7a4e; --bad: #a63c2c; --line: rgba(45, 29, 20, 0.14);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Plex Condensed', 'Arial Narrow', system-ui, sans-serif; --mono: 'Plex Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 500 16px/1.45 var(--sans);
  background: radial-gradient(130% 80% at 30% 0%, #8a4c2c, var(--leather) 40%, var(--leather-2) 100%) fixed;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #f0b37e; outline-offset: 2px; }
a { color: var(--leather); }
.wallet {
  width: min(980px, calc(100% - 32px)); margin: clamp(16px, 4vw, 40px) auto; padding: clamp(16px, 3vw, 28px); border-radius: 22px;
  background: rgba(59, 34, 22, 0.55); outline: 2px dashed var(--stitch); outline-offset: -10px;
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.75); display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr);
}
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; color: var(--cream); padding: 6px 8px 0; }
.brand { margin: 0; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: #f0b37e; }
.brand span { color: var(--cream); font-weight: 600; }
h1 { margin: 2px 0 0; font: 600 clamp(28px, 5vw, 38px)/1.05 var(--serif); }
h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.month { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 4px; }
.month button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(246, 238, 224, 0.12); color: var(--cream); font-size: 20px; cursor: pointer; }
.month output { min-width: 130px; text-align: center; font-weight: 600; }

.totals { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 12px; }
.tile, .panel, .add { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); min-width: 0; }
.tile p { margin: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.tile output { font: 600 clamp(22px, 3.6vw, 32px)/1.2 var(--serif); overflow-wrap: anywhere; }
.tile small { display: block; color: var(--muted); font-size: 13px; }
.tile--main { background: var(--cream); }
.meter { height: 8px; border-radius: 99px; background: rgba(45, 29, 20, 0.1); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; width: 0; background: var(--good); border-radius: inherit; transition: width 0.4s; }
.meter span.warn { background: #c99a2e; } .meter span.over { background: var(--bad); }
.pos { color: var(--good); } .neg { color: var(--bad); }

.add { display: grid; grid-template-columns: auto 1fr 1.2fr 1fr 1.6fr auto; gap: 10px; align-items: end; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 42px; }
.seg button { border: 0; background: transparent; padding: 0 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--leather); color: var(--cream); }
.f { display: grid; gap: 3px; min-width: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.f input, .f select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 10px; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.f input[type='number'] { font-family: var(--mono); }
.btn { min-height: 42px; border-radius: 10px; border: 0; padding: 0 18px; background: var(--leather); color: var(--cream); font-weight: 600; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.btn:hover { background: #7d4529; }
.btn--quiet { background: transparent; color: var(--leather); border: 1px solid var(--line); box-shadow: none; }
.btn--quiet:hover { background: rgba(107, 58, 34, 0.08); }
.error { grid-column: 1 / -1; margin: 0; color: var(--bad); font-size: 14px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cats li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; }
.cats .bar { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: rgba(45, 29, 20, 0.08); overflow: hidden; }
.cats .bar span { display: block; height: 100%; border-radius: inherit; }
.cats b { font: 400 14px var(--mono); }
.days { width: 100%; height: 130px; display: block; }
.days rect { fill: var(--accent); }
.days rect.today { fill: var(--leather); }
.days line { stroke: var(--line); }
.days__note { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; }
.list-head h2 { margin: 0; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tools input, .tools select { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 4px 10px; background: #fff; }
.entries { list-style: none; margin: 0; padding: 0; }
.day-head { padding: 10px 2px 4px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.entry { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px dashed var(--line); }
.entry .dot { width: 10px; height: 10px; border-radius: 50%; }
.entry .what { min-width: 0; }
.entry .what b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.entry .what small { color: var(--muted); }
.entry .amt { font: 400 15px var(--mono); white-space: nowrap; }
.entry .amt.in { color: var(--good); }
.entry .acts { display: flex; gap: 2px; }
.entry .acts button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted); }
.entry .acts button:hover { background: rgba(45, 29, 20, 0.07); color: var(--ink); }
.empty { margin: 0; padding: 24px 0; text-align: center; color: var(--muted); font: italic 400 17px var(--serif); }
.settings { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.files { display: flex; gap: 8px; flex-wrap: wrap; }
.file { display: inline-flex; align-items: center; position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.foot { color: rgba(246, 238, 224, 0.75); font-size: 12px; padding: 0 8px 4px; }
.foot a { color: #f0b37e; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; background: var(--ink); color: var(--cream); padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); max-width: calc(100% - 32px); }
.toast button { border: 1px solid rgba(246, 238, 224, 0.4); background: transparent; color: var(--cream); border-radius: 8px; padding: 4px 12px; cursor: pointer; font-weight: 600; }

@media (max-width: 860px) {
  .add { grid-template-columns: 1fr 1fr; }
  .add .seg, .f--note { grid-column: 1 / -1; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .settings { grid-template-columns: 1fr 1fr; }
  .files { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .totals { grid-template-columns: 1fr 1fr; }
  .tile--main { grid-column: 1 / -1; }
}
