:root {
  color-scheme: light;
  --bg: #f5f6ef;
  --paper: #fffefa;
  --ink: #1b2c26;
  --muted: #52635a;
  --edge: #e0e5d9;
  --green: #173c31;
  --lime: #d7ed9f;
  --tint: #e9eee2;
  --danger: #a33638;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { opacity: .6; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #65957a; outline-offset: 3px;
}
h1, h2, p { margin: 0; }
.top { background: var(--paper); border-bottom: 1px solid var(--edge); }
.top-inner, main { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.top-inner { min-height: 83px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; background: var(--green); color: var(--lime); border-radius: 12px; width: 42px; height: 42px; font-size: 34px; font-weight: 700; line-height: 1; }
.brand strong { display: block; font-size: 25px; letter-spacing: -.07em; line-height: 1.03; }
.brand strong span { color: #638347; }
.brand small { color: var(--muted); font-size: .73rem; font-weight: 700; letter-spacing: .13em; }
main { padding-block: 35px max(34px, env(safe-area-inset-bottom)); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; border-radius: 11px; border: 1px solid transparent; min-height: 44px; font-size: .94rem; font-weight: 700; white-space: nowrap; }
.button span { font-size: 1.23rem; line-height: .8; }
.button:hover:enabled { filter: brightness(.96); }
.secondary { background: var(--bg); color: var(--ink); border-color: var(--edge); }
.primary { background: var(--green); color: white; }
.lime { color: #1b3423; background: var(--lime); }
.full { width: 100%; }
.text-button { border: 0; background: transparent; padding: 9px 5px; font-weight: 700; color: var(--green); font-size: .88rem; }
.text-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.trip-bar { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; flex-wrap: wrap; }
.select-wrap { display: inline-block; position: relative; min-width: 0; }
.select-wrap::after { content: ""; position: absolute; width: 7px; height: 7px; border-bottom: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); right: 13px; top: calc(50% - 5px); pointer-events: none; }
.select-wrap select { appearance: none; max-width: 100%; padding: 9px 32px 9px 11px; min-height: 40px; border: 1px solid var(--edge); border-radius: 9px; color: var(--ink); background: var(--paper); font-size: .88rem; font-weight: 650; }
#trip-select { min-width: min(210px, 55vw); max-width: min(380px, 68vw); min-height: 44px; }
.active-tag { font-size: .83rem; color: #42604c; padding: 5px 8px; border-radius: 7px; background: var(--tint); }
.hero { position: relative; overflow: hidden; border-radius: 24px; background: #173c31; color: white; isolation: isolate; min-height: 260px; }
.route-lines { position: absolute; z-index: -1; right: -80px; top: -95px; width: 620px; height: 480px; border-radius: 47% 53% 62% 38%; transform: rotate(-22deg);
  background: repeating-radial-gradient(ellipse at 68% 45%, transparent 0 15px, #b0cc8f29 16px 17px, transparent 18px 26px); mask-image: linear-gradient(90deg, transparent, black 44%); }
.hero-content { padding: clamp(22px, 4vw, 35px) clamp(22px, 4.5vw, 42px); }
.hero-label { display: flex; gap: 8px; align-items: center; color: #e0ebc8; font-size: .8rem; letter-spacing: .11em; font-weight: 700; }
.hero-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
.hero h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(2.6rem, 8vw, 5rem); letter-spacing: -.07em; line-height: 1.05; margin: 7px 0 26px; overflow-wrap: anywhere; }
.hero-total { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 17px; }
.hero-total p { font-size: .76rem; letter-spacing: .16em; font-weight: 700; color: #d8e6d9; }
.total { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -.06em; line-height: 1.16; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.other-totals { color: #e0ebc8; font-size: .88rem; }
.panels { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; gap: 18px; margin-top: 21px; }
.panel { background: var(--paper); border: 1px solid var(--edge); border-radius: 18px; padding: 22px; min-width: 0; }
.panel-header { display: flex; align-items: center; gap: 9px; justify-content: space-between; margin-bottom: 17px; }
.eyebrow { color: var(--muted); letter-spacing: .11em; font-size: .75rem; font-weight: 800; margin-bottom: 4px; }
h2 { font-size: 1.4rem; letter-spacing: -.045em; }
.count { font-size: .82rem; padding: 4px 8px; background: var(--tint); border-radius: 7px; white-space: nowrap; }
.chart-item + .chart-item { margin-top: 14px; }
.chart-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 6px; font-size: .88rem; font-weight: 660; }
progress { display: block; width: 100%; height: 10px; appearance: none; border: none; color: var(--bar, #52755a); background: var(--tint); border-radius: 8px; }
progress::-webkit-progress-bar { background: var(--tint); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--bar, #52755a); border-radius: 8px; }
progress::-moz-progress-bar { background: var(--bar, #52755a); border-radius: 8px; }
.cat-restaurant { --bar: #527b65; --chip: #e0eddf; }
.cat-food { --bar: #82934e; --chip: #eaf0d4; }
.cat-lodging { --bar: #576b93; --chip: #e4e9f2; }
.cat-car { --bar: #856896; --chip: #f0e5f3; }
.cat-transport { --bar: #447980; --chip: #e1efef; }
.cat-tickets { --bar: #af7644; --chip: #f7ebd8; }
.cat-shopping { --bar: #9c6470; --chip: #f2e5e9; }
.cat-other { --bar: #64736a; --chip: #edf0ea; }
.history-controls { display: flex; gap: 9px; align-items: start; margin-bottom: 10px; }
.filters { min-width: 0; display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 3px; }
.filter { border: 1px solid var(--edge); background: var(--paper); color: var(--ink); border-radius: 20px; white-space: nowrap; padding: 7px 11px; min-height: 34px; font-size: .82rem; }
.filter[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; }
.expense-row { width: 100%; display: grid; grid-template-columns: 39px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-top: 1px solid var(--edge); color: var(--ink); min-height: 61px; padding: 9px 2px; }
.expense-row:hover { background: #f3f5ed; }
.expense-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--chip, var(--tint)); color: var(--bar, var(--green)); font-size: 1.2rem; }
.expense-row strong, .expense-row small { display: block; }
.expense-row strong { font-size: .93rem; overflow-wrap: anywhere; }
.expense-row small { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.expense-value { align-self: center; font-size: .92rem; font-weight: 800; font-variant-numeric: tabular-nums; max-width: 32vw; overflow-wrap: anywhere; text-align: right; }
.helper, .placeholder { color: var(--muted); font-size: .89rem; line-height: 1.55; }
.helper { margin-top: 17px; }
.placeholder { padding-block: 11px; }
.empty { padding: clamp(25px, 6vw, 58px); background: var(--paper); border: 1px solid var(--edge); border-radius: 21px; }
.empty h1 { font-family: Georgia, serif; font-size: clamp(2rem, 8vw, 3.8rem); margin-block: 5px 10px; letter-spacing: -.055em; }
.empty p { margin-bottom: 20px; color: var(--muted); }
.status { padding: 16px; border: 1px solid var(--edge); background: var(--paper); border-radius: 13px; }
.demo { margin-bottom: 11px; font-size: .82rem; font-weight: 650; color: var(--muted); }
dialog { border: 1px solid var(--edge); border-radius: 20px; padding: 22px; width: min(450px, calc(100% - 24px)); max-height: calc(100% - 32px); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #142a23a3; }
dialog form { display: grid; gap: 14px; }
dialog label { display: grid; min-width: 0; gap: 5px; font-size: .9rem; font-weight: 650; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; }
.icon-button { border: 0; border-radius: 9px; background: var(--tint); color: var(--ink); width: 36px; height: 36px; font-size: 1.4rem; }
input, textarea, dialog select { display: block; width: 100%; min-width: 0; border: 1px solid var(--edge); border-radius: 8px; padding: 9px 10px; background: white; color: var(--ink); min-height: 42px; font-size: 1rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.amount-fields { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.form-error { color: var(--danger); font-size: .89rem; }
.form-error:empty { display: none; }
.toast { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); border-radius: 12px; max-width: calc(100% - 24px); padding: 12px 18px; color: white; background: var(--green); z-index: 1; box-shadow: 0 5px 20px #173c3138; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .top-inner, main { width: calc(100% - 30px); }
  .top-inner { min-height: 70px; }
  main { padding-top: 18px; }
  .panels { grid-template-columns: 1fr; gap: 13px; margin-top: 14px; }
  .panel { padding: 17px; }
}
@media (max-width: 390px) {
  .top-inner, main { width: calc(100% - 22px); }
  .brand { gap: 7px; }
  .brand-mark { width: 35px; height: 35px; font-size: 28px; }
  .brand strong { font-size: 21px; }
  .brand small { font-size: .61rem; }
  .button { padding-inline: 9px; font-size: .86rem; }
  .panel { padding: 14px; }
}
@media (max-width: 520px) {
  .history-controls { flex-direction: column-reverse; }
  .history-controls .select-wrap { align-self: flex-end; }
}
