/* Tally: one stylesheet, light and dark, phone first. Colors are tokens: change them here. */
:root {
  --bg: #f7f7f5; --surface: #ffffff; --text: #1d1d1f; --muted: #6b6b70; --line: #e3e3e0;
  --accent: #2357c6; --ok: #11845b; --ok-bg: #e3f4ec; --bad: #c2352b; --bad-bg: #fbe7e5;
  --warn: #8a5a00; --warn-bg: #fff4d6; --neutral-bg: #ececec; --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214; --surface: #1c1c1f; --text: #ececee; --muted: #9a9aa2; --line: #2e2e33;
    --accent: #7ea6ff; --ok: #4cc690; --ok-bg: #12342a; --bad: #ff7b70; --bad-bg: #3d1c1a;
    --warn: #f0c35a; --warn-bg: #3a2e10; --neutral-bg: #2b2b30;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; }
.card h2 { margin-top: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.num { text-align: right; }

/* header */
.top {
  display: flex; align-items: center; gap: 18px; padding: 10px 16px; margin-bottom: 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: 14px; }
.top nav a { color: var(--muted); }
.top nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.menu { position: relative; }
.menu summary { cursor: pointer; list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; color: var(--muted); }
.menu-items {
  position: absolute; right: 0; top: 1.8rem; z-index: 10; min-width: 170px; padding: 8px 12px;
  display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / 0.12);
}

/* bits */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
}
.narrow { max-width: 380px; margin: 24px auto; }

/* sign-in: a page of its own, centered, no header (like Photos) */
body.solo main {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px;
}
.signin { width: 100%; max-width: 340px; padding: 28px 24px; border-radius: 14px; margin: 0; }
.signin h1 { font-size: 1.3rem; margin: 0 0 18px; }
.signin > label:not(.check) { display: block; font-size: 0.88rem; color: var(--muted); margin: 0 0 4px; }
.signin > input { padding: 10px 12px; margin-bottom: 14px; }
.signin .check { margin: 0 0 16px; color: var(--muted); }
.signin button, .signin .button { width: 100%; padding: 10px; text-align: center; }
.signin .error { color: var(--bad); margin: 0 0 12px; font-size: 0.92rem; }
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.msg { padding: 8px 12px; border-radius: 8px; background: var(--neutral-bg); margin: 8px 0; }
.msg.success { background: var(--ok-bg); }
.msg.error { background: var(--bad-bg); }
.msg.warning { background: var(--warn-bg); color: var(--warn); }
.empty { padding: 24px 0; }
.name { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
tr.rough td { opacity: 0.62; }
tr.group td { border-bottom: 0; padding-bottom: 0; }
tr.group h2 { margin: 0.8rem 0 0; }
table.compact td, table.compact th { padding: 5px 6px; font-size: 0.88rem; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; }

/* forms */
input, button, select, textarea { font: inherit; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text);
}
button {
  padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #fff;
  cursor: pointer; font-weight: 600; justify-self: start;
}
button.link { background: none; color: var(--accent); padding: 0 4px; font-weight: 400; }
button.link.danger { color: var(--bad); }
.stack { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 0.85rem; font-weight: 600; }
.has-error input, .has-error textarea { border-color: var(--bad); }
.errorlist { list-style: none; padding: 0; margin: 0; color: var(--bad); font-size: 0.85rem; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; border: 1px solid var(--line); }
.status { font-size: 0.82rem; font-weight: 600; }
.status.done { color: var(--ok); }
.status.queued, .status.running { color: var(--warn); }
.status.failed { color: var(--bad); }

/* Tally pages */
:root { --chart-this: var(--accent); --chart-last: #9a9aa2; --bar-track: var(--neutral-bg);
  /* categorical slots, in this order (validated: dataviz validate_palette.js, light and dark) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948; }
@media (prefers-color-scheme: dark) {
  :root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767; }
}
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
form.inline { display: inline; }
form.rename { display: flex; gap: 6px; align-items: center; }
form.rename input { width: 12rem; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 14px 0; }
.good { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.tag {
  display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 0.72rem; font-weight: 600;
  background: var(--neutral-bg); color: var(--muted); vertical-align: middle;
}
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.button, label.button {
  display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff;
  font-weight: 600; cursor: pointer; text-decoration: none; justify-self: start;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
label.button input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
form.busy label.button { opacity: 0.6; pointer-events: none; }
form.busy label.button::after { content: " … uploading"; }

.month-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.month-head h1 { margin: 0; }
.month-head .step { font-size: 1.5rem; line-height: 1; padding: 0 6px; color: var(--muted); }
.month-head .snap, .month-head .button { margin-left: auto; }

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
a.tile { color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.tile .value { font-size: 1.5rem; font-weight: 700; margin: 2px 0; }
.intro ol { padding-left: 1.2rem; margin: 0 0 8px; }
.intro li { margin-bottom: 6px; }

svg.pace { width: 100%; height: auto; display: block; }
svg.pace polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.pace polyline.this { stroke: var(--chart-this); }
svg.pace polyline.last { stroke: var(--chart-last); stroke-dasharray: 5 4; stroke-width: 2; }
svg.pace .budget-line { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 2 4; }
.legend { color: var(--muted); margin: 6px 0 0; }
.legend .key { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin: 0 4px 0 8px; }
.legend .key.this { background: var(--chart-this); }
.legend .key.last { background: var(--chart-last); }
.legend .key.budget { background: var(--bad); }

.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; }
.trend .col { display: grid; justify-items: center; gap: 4px; color: var(--text); }
.trend .col:hover { text-decoration: none; }
.trend svg { width: 100%; height: 120px; }
.trend rect { fill: var(--chart-last); opacity: 0.55; }
.trend .current rect { fill: var(--chart-this); opacity: 1; }
.trend .current .muted { color: var(--text); font-weight: 600; }

table.cats td { padding: 6px 6px; }
table.cats .cat { width: 30%; }
table.cats .barcell { width: 40%; }
svg.bar { width: 100%; height: 12px; display: block; background: var(--bar-track); border-radius: 3px; }
svg.bar .fill { fill: var(--chart-this); }
svg.bar .fill.over { fill: var(--bad); }
svg.bar .avg { stroke: var(--text); stroke-width: 0.8; }
.note ul, .note p { margin: 0 0 6px; }

.receipts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.receipt { display: grid; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text); }
.receipt:hover { text-decoration: none; border-color: var(--accent); }
.receipt img, .receipt .noimg { width: 100%; height: 150px; object-fit: cover; object-position: top;
  background: var(--neutral-bg); display: grid; place-items: center; color: var(--muted); }
.receipt .info { display: grid; gap: 1px; padding: 8px 10px; }
.receipt .total { font-weight: 700; }

.receipt-layout { display: grid; grid-template-columns: minmax(240px, 2fr) 3fr; gap: 16px; align-items: start; }
.receipt-layout .photo img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fields .field:first-child { grid-column: 1 / -1; }
table.items td { padding: 4px 4px; }
table.items .qty input { width: 5rem; }
table.items .amt input { width: 6.5rem; }
.row-actions { display: flex; gap: 18px; margin-top: 16px; }
.items-line { color: var(--muted); margin-top: 2px; }
.link-charge { margin-top: 12px; }
.link-charge summary { cursor: pointer; font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.filters input[type="search"] { flex: 1 1 200px; width: auto; }
.filters select { width: auto; }
.narrowish { max-width: 560px; }

/* cards by month: wide, so it scrolls sideways with the month column kept in view */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
/* fixed layout: the twelve months share the width equally, busy or empty; wide enough for
   "1,462.68" in each (narrower windows scroll), and a tag wraps under its amount */
table.sheet { font-size: 0.88rem; table-layout: fixed; min-width: 74rem; }
table.sheet th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.sheet col.card-col { width: 8rem; }
table.sheet col.total-col { width: 6.5rem; }
table.sheet th, table.sheet td { padding: 6px 8px; }
table.sheet tbody th, table.sheet tfoot th, table.sheet thead th:first-child {
  position: sticky; left: 0; background: var(--surface); }
table.sheet tbody th { color: var(--text); font-size: 0.88rem; font-weight: 600; }
table.sheet .current { background: var(--warn-bg); }
body.wide main { max-width: none; }
table.sheet tfoot td, table.sheet tfoot th { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.budget-grid { display: grid; grid-template-columns: auto 10rem; gap: 8px 14px; align-items: center; }

@media (max-width: 720px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .receipt-layout { grid-template-columns: 1fr; }
  .month-head .snap, .month-head .button { margin-left: 0; width: 100%; }
  .month-head label.button { width: 100%; text-align: center; padding: 12px; }
  table.cats .cat { width: 38%; }
  table.items thead { display: none; }
  table.items tr { display: grid; grid-template-columns: 1fr auto auto; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  table.items td { border: 0; }
  table.items td:first-child { grid-column: 1 / -1; }
}

/* phones: tables become cards */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px; }
  table.manage thead { display: none; }
  table.manage tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  table.manage td { border: 0; padding: 2px 0; text-align: left; }
  table.manage td:first-child { grid-column: 1 / -1; }
  table.manage td[data-label]::before {
    content: attr(data-label); display: block; font-size: 0.7rem; color: var(--muted);
  }
  table.manage td:first-child::before { display: none; }
  .actions { text-align: left; }
  .grid { grid-template-columns: 1fr; }
}

h2.section { margin-top: 28px; }
/* the year by category: bars (every category, exact) next to a pie (the split at a glance) */
.year-split { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.year-bars { flex: 1 1 36rem; max-width: 56rem; margin: 0; }
/* the pie's box takes the rest of the row: a bigger pie with its legend beside it */
.pie-wrap { flex: 1 1 30rem; margin: 0; display: flex; flex-wrap: wrap; gap: 16px 32px;
  align-items: center; justify-content: center; }
svg.pie { width: min(340px, 100%); height: auto; aspect-ratio: 1; }
svg.pie .slice { stroke: var(--bg); stroke-width: 2; stroke-linejoin: round; }
.s1 { fill: var(--series-1); } .s2 { fill: var(--series-2); } .s3 { fill: var(--series-3); }
.s4 { fill: var(--series-4); } .s5 { fill: var(--series-5); } .s6 { fill: var(--series-6); }
.s7 { fill: var(--series-7); } .s8 { fill: var(--series-8); }
.pie-legend { list-style: none; padding: 0; margin: 0; display: grid; row-gap: 4px;
  column-gap: 8px; grid-template-columns: auto auto auto; align-items: center; font-size: 0.85rem; }
.pie-legend li { display: contents; }
.pie-legend .key { width: 12px; height: 12px; border-radius: 3px; }
.key.s1 { background: var(--series-1); } .key.s2 { background: var(--series-2); }
.key.s3 { background: var(--series-3); } .key.s4 { background: var(--series-4); }
.key.s5 { background: var(--series-5); } .key.s6 { background: var(--series-6); }
.key.s7 { background: var(--series-7); } .key.s8 { background: var(--series-8); }

table.sheet tr.group th { padding-top: 14px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
tr.group h3 { margin: 0.8rem 0 0; }
.month-head.section { margin-top: 28px; }
table.sheet td.cell { padding: 0; }
table.sheet td.cell input {
  padding: 6px 8px; border: 1px solid transparent; border-radius: 0; background: transparent;
  text-align: right; font-variant-numeric: tabular-nums;
}
table.sheet td.cell input:hover { border-color: var(--line); }
table.sheet td.cell input::placeholder { color: var(--muted); opacity: 1; }
table.sheet td.cell input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
table.sheet td.cell input.saving { color: var(--muted); }
table.sheet td.cell input.error { border-color: var(--bad); background: var(--bad-bg); }
table.sheet.years { min-width: 0; width: 34rem; }
.sheet-save { margin: 10px 0 0; }
table.accounts td.edit input, table.accounts td.edit textarea {
  display: block; padding: 3px 6px; margin: 1px 0; border: 1px solid transparent; border-radius: 6px;
  background: transparent; resize: none; text-overflow: ellipsis;
}
table.accounts td.edit textarea { field-sizing: content; }
table.accounts td.edit ::placeholder { color: var(--muted); opacity: 0.45; }
table.accounts td.edit input:hover, table.accounts td.edit textarea:hover { border-color: var(--line); }
table.accounts td.edit :is(input, textarea):focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
table.accounts td.edit .name { font-weight: 700; }
table.accounts td.edit .small { color: var(--muted); }
table.accounts td.edit input.num { text-align: right; }
table.accounts td.edit .inst { display: flex; align-items: center; gap: 2px; }
table.accounts td.edit .inst span { font-size: 0.72rem; color: var(--muted); }
table.accounts td.edit .inst input:not(.tick) { flex: 1; min-width: 0; }
table.accounts td.edit .inst input.tick { margin-right: 4px; }
table.accounts td.edit .inst > label.inst { flex: 1; min-width: 0; }
table.accounts :is(input, textarea).error { border-color: var(--bad); background: var(--bad-bg); }
table.accounts :is(input, textarea).saving { color: var(--muted); }
.acct-grid { columns: 2 38rem; column-gap: 16px; margin-top: 20px; }
.acct-grid > .acct-card { break-inside: avoid; margin-bottom: 16px; }
.acct-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; }
.acct-card h3 { margin: 0 0 4px; font-size: 1rem; }
table.accounts { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.9rem; }
table.accounts th { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.accounts th.num { text-align: right; }
table.accounts td { padding: 7px 6px; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.35; }
table.accounts tbody tr:last-child td { border-bottom: 0; }
table.accounts col.acct-col { width: 27%; }
table.accounts col.phone-col { width: 20%; }
table.accounts col.amount-col { width: 9rem; }
table.accounts col.edit-col { width: 2.6rem; }
table.accounts td.edit { padding: 4px 2px; }
table.accounts td.actions { text-align: right; padding-top: 9px; }
h2 .left { font-weight: 500; margin-left: 4px; }
table.bills-due td.tick { width: 1.4rem; padding-right: 0; }
table.bills-due tr.paid td, table.bills-due tr.paid a { color: var(--muted); }
table.sheet td.cell .in { display: flex; align-items: center; }
table.sheet td.cell .in input:not(.tick) { flex: 1; min-width: 0; }
table.sheet td.cell .in input:has(+ input.tick) { padding-right: 4px; }
table.sheet td.cell .in { padding-right: 6px; }
/* a paid tick: a faint ring until it's paid, then a green check */
input.tick, table.sheet td.cell input.tick, table.accounts td.edit input.tick, .pchip input.tick {
  appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 16px; height: 16px; margin: 0; padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 50%; background: transparent; cursor: pointer; vertical-align: middle;
  transition: background-color 0.12s, border-color 0.12s;
}
input.tick:hover, table.sheet td.cell input.tick:hover, table.accounts td.edit input.tick:hover, .pchip input.tick:hover { border-color: var(--ok); }
input.tick:checked, table.sheet td.cell input.tick:checked, table.accounts td.edit input.tick:checked, .pchip input.tick:checked { background: var(--ok); border-color: var(--ok); }
input.tick:checked::after { content: "✓"; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
table.sheet td.cell input.tick:focus, table.accounts td.edit input.tick:focus { outline: none; }
input.tick:focus-visible, table.sheet td.cell input.tick:focus-visible, table.accounts td.edit input.tick:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
/* Perks: a used-up credit's period is green; one filled in from a statement is grey */
table.sheet td.cell.full { background: var(--ok-bg); }
table.sheet td.cell.auto input { color: var(--muted); }
table.accounts col.who-col { width: 4rem; }
table.accounts col.date-col { width: 6.2rem; }
table.accounts col.left-col { width: 4.6rem; }
table.accounts col.tick-col { width: 2rem; }
table.accounts tr.used td:not(.edit):not(.actions) { color: var(--muted); }
table.accounts td.edit:has(input.tick) { padding-top: 9px; }
table.sheet.perks col.card-col { width: 11rem; }
table.sheet td.cell.paid input:not(.tick) { color: var(--ok); }
/* Perks: how much of the year's credits is used, what's left soon, and a card per card for the rest */
.perk-total { margin: 0 0 14px; max-width: 34rem; }
.perk-total-line { font-size: 1.05rem; margin-bottom: 6px; }
.perk-total-line strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.left-now { margin: 0 0 16px; display: grid; gap: 6px; }
.left-by { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.left-by .when { font-size: 0.78rem; font-weight: 700; color: var(--warn); margin-right: 2px; }
.left-chip {
  font-size: 0.82rem; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
/* Perks: under the monthly table, a block per card (a line per other credit with a pill per period, then
   what else is on the card), then Global Entry, Hotels and points; things that expire and numbers are lines too */
.perk-blocks { columns: 2 34rem; column-gap: 16px; margin-top: 20px; }
.perk-blocks > .perk-block { break-inside: avoid; margin-bottom: 16px; padding-bottom: 6px; }
.perk-block h3 { display: flex; align-items: baseline; gap: 10px; }
.perk-block h3 .perk-sum { margin-left: auto; font-size: 0.85rem; }
.perk > span.perk-name { flex: 1 1 auto; }
.perk-name a { color: var(--text); }
.perk.paid .perk-name, .perk.paid .perk-name a { color: var(--muted); }
.perk .perk-sum { display: inline-flex; align-items: center; gap: 6px; }
.perk input.perk-value {
  margin-left: auto; width: 12rem; max-width: 55%; padding: 2px 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; text-align: right; font-size: 0.88rem;
}
.perk input.perk-value:hover { border-color: var(--line); }
.perk input.perk-value:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.perk input.perk-value.error { border-color: var(--bad); background: var(--bad-bg); }
.perk input.perk-count {
  width: 3.5rem; padding: 1px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent;
  text-align: right; font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.perk input.perk-count:hover { border-color: var(--line); }
.perk input.perk-count:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.perk { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.perk-name {
  flex: 0 0 11rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.perk-sum { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 2px 1px 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
}
.pchip.current { border-color: var(--warn); background: var(--warn-bg); }
.pchip.full, .pchip.paid { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pchip .plabel { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.pchip input.num {
  width: 4.2rem; padding: 1px 6px 1px 2px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; text-align: right; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.pchip input.num:hover { border-color: var(--line); }
.pchip input.num:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.pchip.auto input.num { color: var(--muted); }
.pchip input.num::placeholder { color: var(--muted); opacity: 0.6; }
.pchip input.tick:disabled { cursor: default; }
.pchip.one { padding: 1px 7px 1px 3px; cursor: pointer; }
.fee-seen { color: var(--ok); white-space: nowrap; }
.fee-unknown { margin: 6px 0 0; }
.pchip.paid input.num { color: var(--ok); }
.pchip input.num.error { border-color: var(--bad); background: var(--bad-bg); }
.pchip input.num.saving { color: var(--muted); }
@media (max-width: 560px) { .perk { flex-wrap: wrap; } .perk-name { flex-basis: 100%; } }
/* Statements: drop files beside the form */
.upload-row { display: flex; gap: 16px; align-items: stretch; margin-bottom: 14px; }
.upload-row > form { flex: 0 1 560px; margin: 0; }
.dropzone {
  flex: 1; display: grid; place-content: center; gap: 4px; text-align: center; min-height: 10rem;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--text); background: var(--surface); }
.dropzone.busy::after { content: "uploading…"; font-size: 0.82rem; }
@media (max-width: 720px) { .dropzone { display: none; } }
table.bills-due form.zero { margin: 0; }
table.bills-due form.zero input { width: 7rem; text-align: right; padding: .1rem .3rem; }

/* Utilities: electric, water and gas against the same month last year */
.utilcompare { margin-top: 14px; }
svg.uline { width: 100%; height: auto; display: block; }
svg.uline .grid { stroke: var(--line); stroke-width: 1; }
svg.uline .axis { fill: var(--muted); font-size: 7px; }
svg.uline a:hover .axis { fill: var(--accent); }
svg.uline polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.uline .last polyline { stroke-dasharray: 6 5; stroke-width: 2; }
svg.uline .last circle { opacity: 0.55; }
svg.uline .elec polyline { stroke: var(--series-4); } svg.uline .elec circle { fill: var(--series-4); }
svg.uline .water polyline { stroke: var(--series-1); } svg.uline .water circle { fill: var(--series-1); }
svg.uline .gas polyline { stroke: var(--series-6); } svg.uline .gas circle { fill: var(--series-6); }
.utilcompare .legend .key { width: 18px; height: 0; border-top: 2.5px solid; background: none; }
.utilcompare .legend .key.last { border-top-style: dashed; }
.utilcompare .legend .key.elec { border-color: var(--series-4); }
.utilcompare .legend .key.water { border-color: var(--series-1); }
.utilcompare .legend .key.gas { border-color: var(--series-6); }
