:root {
  color-scheme: light;
  --paper: #f5f4ee;
  --surface: #fffefa;
  --ink: #1e2925;
  --muted: #59635d;
  --line: #d9ded6;
  --green: #185540;
  --light-green: #e7f0e8;
  --gold: #fbf1d7;
  font: 16px/1.5 Inter, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #23764e; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font: 500 clamp(2.15rem, 7vw, 3.65rem)/1.05 'Instrument Serif', Georgia, serif; letter-spacing: -.045em; }
h1::first-letter { text-transform: uppercase; }
h2 { font-size: 1.06rem; }
.shell { width: min(54rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.25rem, 5vw, 3.2rem) 0 2.5rem; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; background: var(--green); color: white; border: 1px solid var(--green); border-radius: .7rem; padding: .75rem 1.1rem; min-height: 46px; font-weight: 650; text-decoration: none; }
.primary:hover { background: #104330; }
.primary:disabled { opacity: .62; cursor: wait; }
.create { width: 100%; }
.create span { font-size: 1.55rem; line-height: 1; }
.period { display: flex; gap: .7rem; align-items: center; margin: .8rem 0 1.1rem; }
.period label, .brand { font-size: .85rem; color: var(--muted); font-weight: 650; }
input, select { min-width: 0; padding: .52rem .7rem; border: 1px solid #aab6ac; border-radius: .5rem; color: var(--ink); background: var(--surface); min-height: 42px; }
.heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem; }
.heading { margin: 1.6rem 0 1.05rem; }
.brand { margin-bottom: .25rem; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.tile { min-width: 0; background: var(--surface); border: 1px solid var(--line); padding: clamp(.65rem, 3vw, 1.15rem); border-radius: .85rem; }
.tile.income { background: var(--light-green); border-color: #cbdad0; }
.tile p { color: var(--muted); font-size: .9rem; font-weight: 550; }
.tile strong { font-size: clamp(1.15rem, 5vw, 2rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quiet { color: var(--green); background: transparent; border: 1px solid #afbbb1; border-radius: .5rem; padding: .4rem .65rem; min-height: 36px; font-size: .86rem; font-weight: 600; }
.quiet:hover { background: var(--light-green); }
.muted, footer, .empty { color: var(--muted); font-size: .88rem; }
.movement-panel, .review { background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; overflow: hidden; }
.review { background: var(--gold); border-color: #e0d7bd; }
.review summary, .movement-panel > .panel-heading, .empty { padding: .85rem 1rem; }
.review summary { font-weight: 650; }
.entries { list-style: none; padding: 0; margin: 0; }
.entry { padding: .8rem 1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .7rem; border-top: 1px solid var(--line); }
.entry-title { font-weight: 650; overflow-wrap: anywhere; }
.entry p { overflow-wrap: anywhere; }
.entry-amount { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.entry-amount.positive { color: var(--green); }
.entry-actions, .chips { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.entry-actions { grid-column: 1 / -1; margin-top: .2rem; }
.entry a { color: var(--green); font-size: .88rem; }
.chip { background: var(--light-green); border: 0; border-radius: 1rem; color: #204f3b; padding: .1rem .55rem; font-size: .8rem; overflow-wrap: anywhere; }
.annulled .entry-amount { text-decoration: line-through; color: var(--muted); }
.message { color: #6e301e; font-size: .9rem; min-height: 1.35rem; margin: .35rem 0; }
footer { padding: 1rem .1rem 0; }
dialog { width: min(31rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); border: 1px solid var(--line); color: var(--ink); background: var(--surface); padding: 1.15rem; border-radius: .85rem; box-shadow: 0 16px 60px #162b2840; }
dialog::backdrop { background: #1e29256b; }
.fields { display: grid; gap: .62rem; margin: .7rem 0; }
dialog label { display: block; font-size: .9rem; font-weight: 620; }
dialog label span { font-size: .78rem; color: var(--muted); font-weight: 400; }
dialog label input, dialog label select { display: block; width: 100%; margin-top: .15rem; }
.tag-editor { display: flex; gap: .45rem; margin-top: .2rem; }
.tag-editor input { flex: 1; }
#selected-tags { margin-top: .35rem; }
#save { width: 100%; }
.login { display: grid; min-height: 100dvh; place-items: center; padding: 1rem; }
.login-card { width: min(26rem, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 2rem; }
.login-card p { margin: .6rem 0; }
.login-card .primary { margin-top: .6rem; }
