@font-face {
  font-family: "Calcuji Pixel";
  src: url("budget-pixel.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #112140;
  --cream: #f3ebd8;
  --blue: #204a9a;
  --ice: #c0d5ee;
  font-family: "Calcuji Pixel", ui-monospace, monospace;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  padding: 26px 16px;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 15%, #faf7ee 0%, #e8e0d1 95%);
  color: var(--ink);
}
button, input, textarea, select, option { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #e6a93b; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.calculator {
  width: min(100%, 410px);
  padding: 18px;
  border: 1px solid #0f275d;
  border-radius: 31px;
  background:
    linear-gradient(145deg, #2f58a6, #20478f 54%, #163371);
  box-shadow: inset 0 1px 1px #95b3f0a1, inset 0 -5px 8px #091f52bd, 0 18px 46px #241e1640, 0 3px 8px #1c1e2638;
}
.lcd {
  min-height: 115px;
  padding: 11px 15px 10px;
  border: 6px solid #183464;
  border-radius: 15px;
  background: radial-gradient(ellipse at 58% 62%, #bdc6aa, #a2ad92);
  box-shadow: inset 0 4px 9px #34433791, 0 2px 0 #688bcb, 0 -1px 0 #10295c;
  color: #202a20;
}
.lcd-top { display: flex; justify-content: space-between; align-items: center; height: 16px; font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
#display { display: flex; justify-content: flex-end; align-items: center; gap: 3px; height: 63px; white-space: nowrap; font-weight: 750; font-size: 40px; }
.under-lcd { display: flex; justify-content: space-between; align-items: center; min-height: 33px; padding: 0 3px; color: #e1eafa; font-size: 12px; }
.quiet { color: #f0f4ff; background: transparent; border: 0; padding: 7px 2px; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.deck { position: relative; isolation: isolate; }
.keypad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.keypad button, .key {
  color: var(--ink);
  min-width: 0;
  border: 1px solid #364d6e;
  border-radius: 3px;
  background: linear-gradient(#fbf5e8 0 83%, #e5d9bb 83%);
  box-shadow: inset 0 1px 1px #fffdf7, inset 0 -3px 0 #82795d35, 0 3px 0 #0e2254, 0 5px 6px #0b1e5444;
  min-height: 52px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}
.keypad button:active, .key:active, .tab:active, .bill-line button:active { transform: translateY(2px); }
.keypad .op, .key.op { background: linear-gradient(#cde0f2, #91b4dd); }
.keypad .zero { grid-column: span 2; text-align: left; padding-left: 24px; }
.key.small { min-height: 43px; font-size: 15px; padding: 6px 10px; box-shadow: inset 0 1px 1px #fffc, inset 0 -2px 0 #26364728, 0 2px 0 #2f4875; }
.tabs { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; gap: 8px; }
.tab { touch-action: none; color: #fbf1d9; background: linear-gradient(#2d549b, #18376f); box-shadow: inset 0 1px #7296dc, 0 3px 1px #112755; border: 1px solid #102856; border-radius: 10px; padding: 9px 13px; min-height: 40px; font-weight: 750; font-size: 14px; }
.chevron { display: inline-block; width: 7px; height: 7px; margin: 0 1px -1px 6px; border-top: 2px solid currentColor; border-left: 2px solid currentColor; transform: rotate(45deg); }
[aria-expanded="true"] .chevron { transform: translateY(-3px) rotate(225deg); }
.drawer {
  position: absolute;
  z-index: 1;
  inset: auto -4px -3px;
  max-height: calc(100% + 28px);
  padding: 0 12px 12px;
  border: 1px solid #253f74;
  border-radius: 16px;
  background: linear-gradient(148deg, #b8cfe9, #81a2ce);
  box-shadow: inset 0 1px 1px #e8f2ff, 0 -6px 16px #11255140, 0 4px 8px #15265e44;
  display: flex;
  flex-direction: column;
  animation: slide-up .19s ease-out;
}
@keyframes slide-up { from { transform: translateY(10px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.grip { border: 0; background: transparent; width: 100%; min-height: 27px; display: grid; place-items: center; touch-action: none; }
.grip span { width: 37px; height: 6px; border-radius: 4px; background: #7392bb; box-shadow: inset 0 1px #d6e4f5, 0 1px 1px #395780; }
.drawer-head, .history-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drawer-head { margin: 0 1px 7px; }
.drawer-head h2, .history-head h2 { font-size: 23px; line-height: 1.1; letter-spacing: 0; }
.flat { border: 0; background: transparent; color: #203c6b; font-weight: 750; padding: 4px; min-height: 32px; font-size: 13px; }
.bill-list { list-style: none; padding: 0; margin: 0; }
.bill-list { overflow: auto; min-height: 0; padding: 2px 2px 4px; }
.bill-line { display: flex; gap: 4px; margin-bottom: 6px; }
.bill-line:last-child { margin-bottom: 0; }
.bill-line button { background: linear-gradient(#f8f1df 0 83%, #e9debf 83%); color: var(--ink); border: 1px solid #7c8691; border-radius: 8px; min-height: 38px; box-shadow: 0 2px 1px #4d6b94, inset 0 1px #fff; }
.bill-line .bill-main { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 9px; font-size: 14px; font-weight: 800; text-align: left; }
.bill-main span:first-child { overflow-wrap: anywhere; }
.bill-main span:last-child { flex: none; }
.bill-line .bill-main:disabled { opacity: 1; background: #d5e3d3; color: #304b40; }
.bill-edit { flex: 0 0 34px; font-weight: 900; }
.drawer-actions, .modal-actions { display: flex; justify-content: space-between; gap: 8px; }
.drawer-actions { margin-top: 10px; }
.drawer-actions button, .modal-actions button { flex: 1; }
.paper { padding: 16px; background: #f8f0da; border: 3px solid #183066; border-radius: 3px; box-shadow: inset 0 3px #e4d7b7, 0 3px #638ce1; }
.history-head { margin-bottom: 12px; }
#check-count, .empty { font-size: 13px; color: #435170; }
.empty { padding: 16px 0; line-height: 1.45; }
.receipt h3 { font-size: 17px; }
.receipt p { margin-top: 9px; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.negative { color: #902c2a; }
dialog { width: min(360px, calc(100% - 30px)); max-height: calc(100% - 24px); color: var(--ink); border: 2px solid #254b85; border-radius: 17px; background: var(--cream); padding: 19px; box-shadow: 0 18px 60px #111d4b60; }
dialog::backdrop { background: #101d3d8c; }
dialog h2 { font-size: 23px; margin-bottom: 10px; letter-spacing: 0; }
dialog label { display: block; margin: 12px 0 4px; font-size: 14px; font-weight: 750; }
dialog label span { font-size: 12px; font-weight: 500; }
dialog input, dialog textarea { width: 100%; background: #fffdf5; color: var(--ink); border: 1px solid #8b94a5; border-radius: 7px; padding: 8px; font-size: 16px; min-height: 42px; }
dialog textarea { resize: vertical; }
.modal-balance { color: #3a527b; font-size: 15px; }
.modal-actions { margin-top: 16px; }
.currency-input { position: relative; }
.currency-input span { position: absolute; left: 9px; top: 10px; }
.currency-input input { padding-left: 24px; }
.bill-options { display: flex; justify-content: space-between; margin-top: 9px; }
.danger { color: #892d2d; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 440px) {
  body { padding: 12px; }
  .calculator { padding: 15px; border-radius: 24px; }
  .keypad { gap: 7px; }
}
@media (max-height: 690px) {
  body { padding-block: 10px; }
  .keypad button { min-height: 47px; }
  .lcd { min-height: 101px; }
  #display { height: 53px; }
}

.glyphs { display: flex; align-items: flex-end; justify-content: flex-end; gap: 3px; width: 100%; height: 53px; }
.digit { position: relative; display: block; height: 100%; width: min(31px, 8.8%); }
.digit i { position: absolute; background: currentColor; display: block; }
.digit .a, .digit .g, .digit .d { left: 13%; width: 74%; height: 12%; clip-path: polygon(11% 0, 89% 0, 100% 50%, 89% 100%, 11% 100%, 0 50%); }
.digit .a { top: 0; }
.digit .g { top: 44%; }
.digit .d { bottom: 0; }
.digit .b, .digit .c, .digit .e, .digit .f { width: 20%; height: 43%; clip-path: polygon(50% 0, 100% 15%, 100% 85%, 50% 100%, 0 85%, 0 15%); }
.digit .b { top: 6%; right: 0; }
.digit .c { bottom: 6%; right: 0; }
.digit .e { bottom: 6%; left: 0; }
.digit .f { top: 6%; left: 0; }
.decimal { width: 6px; height: 6px; margin: 0 2px; background: currentColor; border-radius: 1px; }
@media (max-height: 690px) { .glyphs { height: 43px; } }


/* Stepped bevels and limited palettes render the shell like a game sprite. */
body {
  padding: 22px 12px;
  background-color: #ede9dc;
  background-image:
    radial-gradient(circle at 1px 1px, #697b8620 1px, transparent 1px),
    radial-gradient(ellipse at 50% 40%, #f8f5e8 17%, #e0e6e6 98%);
  background-size: 8px 8px, 100% 100%;
}
.calculator {
  width: min(100%, 376px);
  padding: 16px;
  border: 2px solid #142853;
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, #b6d7ff0b 0 1px, transparent 1px 4px),
    linear-gradient(#3263d1 0 31%, #2b58bf 31% 69%, #254aa7 69%);
  box-shadow:
    inset 0 0 0 3px #4e7fe2,
    inset 0 0 0 5px #25489d,
    inset 0 -8px #1b3886,
    0 4px #142853,
    4px 8px #23365e36,
    8px 12px #23365e16;
}
.calculator { display: grid; }
.calculator > section { grid-area: 1 / 1; min-width: 0; }
#calculator-view { display: grid; grid-template-areas: "lcd" "under" "deck" "tabs"; }
.calculator:has(#history-view:not([hidden])) #calculator-view { visibility: hidden; }
#history-view {
  contain: size;
  display: grid;
  grid-template: "paper" minmax(0, 1fr) "tabs" auto;
}
#history-view .paper {
  grid-area: paper;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(9px, 3.5vw, 16px);
}
#history-view .history-head { flex: 0 0 auto; }
#history-data, #receipt {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 4px 6px;
  margin: 0;
  list-style: none;
}
.history-note {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  aspect-ratio: 1;
  padding: clamp(8px, 3vw, 13px);
  border: 1px solid #947340;
  color: #3c321e;
  background: linear-gradient(135deg, #fff2b8 0 12%, #f8e7a8 12% 83%, #efd88d 83%);
  box-shadow: 2px 3px #ab884d75;
  text-align: left;
  overflow-wrap: anywhere;
}
.history-note:hover { background: #fff1b8; }
.history-note time { color: #654c26; font-size: 11px; }
#receipt { padding: 3px 4px 0; }
.lcd {
  grid-area: lcd;
  min-height: 79px;
  padding: 7px 9px 5px;
  border: 3px solid #72849d;
  border-radius: 2px;
  color: #263b31;
  background:
    radial-gradient(circle at 1px 1px, #354e3520 1px, transparent 1px) 0 0 / 4px 4px,
    linear-gradient(#c5d5a8 0 68%, #b9ca99 68%);
  box-shadow: 0 0 0 2px #142b60, 0 3px 0 2px #6790e4, inset 0 4px #a1b58c, inset 0 -3px #a9bc90;
}
.lcd-top { height: 14px; font-size: 10px; }
#display { height: 47px; }
.glyphs { height: 38px; }
.digit { width: min(25px, 8.8%); }
.decimal { width: 5px; height: 5px; border-radius: 0; }
.under-lcd {
  grid-area: under;
  min-height: 41px;
  padding: 3px 2px;
  margin-top: 4px;
  gap: 8px;
  align-items: center;
}
.under-lcd .solar {
  flex: 0 0 86px;
  height: 18px;
  margin: 0 auto 0 0;
  border: 2px solid #13264e;
  background:
    repeating-linear-gradient(90deg, transparent 0 24%, #181d33 24% 26%),
    linear-gradient(#634a53 0 22%, #464051 22% 70%, #373247 70%);
  box-shadow: 0 2px #6088e0;
}
.quiet { color: #f4f7ff; font-weight: 700; text-decoration-color: #bed4f0; }
.deck { grid-area: deck; padding: 9px; border: 1px solid #1546a3; border-radius: 7px; background: #063ca44d; box-shadow: inset 0 2px 3px #062e8c69, 0 1px #5788d595; }
.keypad { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, .88fr); gap: 7px; }
.keypad button {
  border-radius: 4px;
  color: #16438c;
  min-height: clamp(37px, 6.1svh, 47px);
  background: linear-gradient(#fff9e7 0 74%, #f1e6c3 74% 91%, #ddcaba 91%);
  border-color: #263f70;
  box-shadow: inset 0 2px #fffdf4, inset 2px 0 #fffdf4, 0 3px #142b63;
  font-size: 22px;
}
.keypad button:nth-child(4n), .keypad .equals { margin-left: 5px; }
.keypad .function, .keypad .op {
  color: #fff6ec;
  background: linear-gradient(#ea514b 0 74%, #cf393d 74% 91%, #ac2940 91%);
  border-color: #74263f;
  text-shadow: 1px 1px #8c263a;
  box-shadow: inset 0 2px #ff8a6e, inset 2px 0 #fa7969, 0 3px #182b62;
}
.keypad .memory { font-size: 14px; }
.keypad .equals { grid-column: 4; grid-row: 5 / span 2; align-self: stretch; }
.tabs { grid-area: tabs; padding-top: 13px; }
.tab { min-height: 44px; border-radius: 2px; background: linear-gradient(#3967c9 0 83%, #284aa2 83%); box-shadow: inset 0 2px #7298ec, 0 3px #142853; }
.drawer { inset: auto 0 0; max-height: 100%; background: #d8e5f8; border-radius: 3px; box-shadow: inset 0 2px #f4f8ff, inset 0 -3px #acc6ec, 0 4px #162e69; }
.drawer-actions .op, .modal-actions .op { background: linear-gradient(#e74d49 0 79%, #b52c3a 79%); color: #fff6ec; }
.bill-line button { min-height: 44px; border-radius: 2px; }
.bill-line .bill-main.applied { background: #d8e7d2; color: #234a31; }
.bill-line .bill-main { touch-action: manipulation; user-select: none; -webkit-touch-callout: none; }
.bill-edit { flex-basis: 44px; }
.receipt-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1px 5px; }
.receipt-head h3 { margin: 0; }
.receipt-actions { display: flex; gap: 5px; }
.export-options { display: grid; gap: 8px; }
#export-status { margin-top: 8px; font-size: 13px; line-height: 1.35; }
#export-download { display: inline-block; margin-top: 6px; font-size: 13px; color: #203c6b; }
.form-error { color: #8c2323; font-size: 13px; margin-top: 6px; }
.form-error:empty { display: none; }
.notice {
  position: fixed;
  z-index: 3;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 8px 13px;
  background: #122b5d;
  color: #fff;
  border-radius: 5px;
  box-shadow: 0 3px 10px #122b5d55;
  font-size: 13px;
}
@media (max-width: 350px) {
  .calculator { padding: 13px; }
  .under-lcd .solar { flex-basis: 63px; }
  .quiet { font-size: 11px; }
  .key.small, .tab { font-size: 12px; }
  .receipt h3 { font-size: 13px; }
}
.backspace { min-width: 44px; min-height: 35px; padding: 0 4px; font-size: 23px; line-height: 1; text-decoration: none; }
.legend { flex-wrap: wrap; row-gap: 4px; }

/* A short drawer in the keypad and a compact editor in the same space. */
body { grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
.site-footer { font-size: 12px; }
.site-footer a { color: #375479; padding: 6px; }
.drawer { padding: 6px 8px 9px; max-height: min(100%, 285px); }
.drawer-head { margin: 0 0 3px; }
.drawer-head h2 { font-size: 19px; }
.drawer-tools { display: flex; align-items: center; gap: 4px; }
.drawer-tools .flat, .close-small { min-height: 38px; }
.close-small { min-width: 39px; font-size: 22px; line-height: 1; touch-action: none; }
.bill-list { max-height: 146px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #7492ba #d8e5f8; }
.bill-line { margin-bottom: 4px; }
.drawer-actions { margin-top: 6px; }
.bill-form { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.editor-head h2:focus { outline: none; }
.bill-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(85px, .65fr); gap: 7px; }
.bill-fields label { min-width: 0; font-size: 12px; font-weight: 800; }
.bill-fields input {
  margin-top: 3px;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 5px 7px;
  border: 1px solid #7a91b3;
  border-radius: 4px;
  background: #fffdf1;
  color: #142957;
  font-size: 16px;
}
.bill-fields .currency-input span { top: 12px; }
.bill-fields .currency-input input { padding-left: 22px; }
.bill-options { display: block; margin-top: 3px; }
.bill-options summary { width: fit-content; cursor: pointer; color: #244275; font-size: 12px; padding: 7px 3px 3px; }
.bill-options > div { display: flex; flex-wrap: wrap; gap: 0 10px; }
.keyboard-open { align-items: start; }
.keyboard-open .drawer:has(.bill-form:not([hidden])) { inset: 0 0 auto; max-height: 100%; }
dialog { width: min(320px, calc(100% - 30px)); padding: 12px; border-radius: 3px; }
dialog h2 { font-size: 20px; margin-bottom: 5px; }
dialog label { margin-top: 7px; }
dialog .modal-actions { margin-top: 9px; }
dialog textarea { min-height: 43px; }
#check-note { height: 50px; }
.digit .a, .digit .g, .digit .d { clip-path: polygon(0 30%, 9% 30%, 9% 0, 91% 0, 91% 30%, 100% 30%, 100% 70%, 91% 70%, 91% 100%, 9% 100%, 9% 70%, 0 70%); }
.digit .b, .digit .c, .digit .e, .digit .f { clip-path: polygon(25% 0, 75% 0, 75% 9%, 100% 9%, 100% 91%, 75% 91%, 75% 100%, 25% 100%, 25% 91%, 0 91%, 0 9%, 25% 9%); }


  body.privacy-page { display: block; margin: 0 auto; max-width: 560px; padding: 24px; background: #f8f5ed; color: #162a52; font-size: 13px; line-height: 1.65; }
  .privacy-page a { color: #164ca0; }
  .privacy-page h1 { margin-bottom: 8px; }
  .privacy-page h2 { font-size: 18px; }

.history-sponsor { width: min(100%, 376px); text-align: center; }

/* The case uses hard color steps, pixel-sized edges and a recessed LCD. */
.calculator-stage { position: relative; width: min(100%, 376px); min-width: 0; }
.calculator-stage .calculator {
  width: 100%;
  border-radius: 9px;
  background:
    repeating-conic-gradient(#ecf5ff12 0 25%, transparent 0 50%) 0 0 / 4px 4px,
    linear-gradient(155deg, #5c85de 0 14%, #3765c5 14% 39%, #2d56b4 39% 72%, #244293 72%);
  box-shadow: inset 0 0 0 3px #9cb2e6, inset 0 0 0 6px #4366b6,
    inset 0 -9px #233b83, 0 4px #172743, 3px 7px #182b5a50, 6px 10px #182b5a23;
}
.lcd {
  background:
    repeating-conic-gradient(#40573829 0 25%, transparent 0 50%) 0 0 / 4px 4px,
    linear-gradient(155deg, #b9cd9a 0 28%, #aac48f 28% 63%, #9ab783 63%);
  border-color: #69758b;
  box-shadow: 0 0 0 2px #152a50, 0 3px 0 2px #7a9ce1, inset 0 4px #809971, inset 0 -3px #91a77d;
  color: #23372c;
}
.lcd-top { letter-spacing: .12em; }
.lcd:has(#display:empty) .lcd-top { font-size: 15px; height: auto; }
.lcd:has(#display:empty) #display { height: 37px; }
.deck { background: #244493; border-color: #1b3271; box-shadow: inset 0 2px #182e66, 0 2px #6384d4; }
.keypad button {
  border-radius: 3px;
  border-color: #273655;
  background: linear-gradient(135deg,#fffbed 0 15%,#f7edcf 15% 70%,#e4d3ad 70%);
  box-shadow: inset 0 2px #fffef6, inset 2px 0 #fffef6, inset 0 -4px #c7b58e, 0 4px #142751;
}
.keypad .function, .keypad .op {
  border-color: #782b41;
  background: linear-gradient(135deg,#f7765b 0 15%,#e3544d 15% 70%,#c43b46 70%);
  box-shadow: inset 0 2px #ff9a76, inset 2px 0 #ff9a76, inset 0 -4px #9d3149, 0 4px #142751;
}
.keypad .equals {
  background: linear-gradient(#e3544d 0 79%, #c43b46 79%);
}
.drawer { max-height: 350px; }
.bill-list {
  --bill-height: 44px;
  --bill-gap: 4px;
  max-height: calc(5 * var(--bill-height) + 4 * var(--bill-gap) + 6px);
  scrollbar-width: none;
}
.bill-list.can-scroll { scrollbar-width: thin; }
.bill-line { margin-bottom: var(--bill-gap); }
.bill-line button { min-height: var(--bill-height); }
.bill-line .bill-main { height: var(--bill-height); min-width: 0; }
.bill-label { display: grid; min-width: 0; }
.bill-main .bill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-main .bill-due { color: #465b75; font-size: 10px; font-weight: 700; line-height: 1.1; }
#add-bill { background: #2856ad; color: #fff9e7; letter-spacing: .02em; box-shadow: inset 0 2px #709aeb, 0 2px #173976; }
.due-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 800; }
.due-field select { min-height: 37px; padding: 4px 7px; color: var(--ink); background-color: #fffdf1; border: 1px solid #7a91b3; border-radius: 3px; font: inherit; font-size: 16px; }
.bill-options { display: flex; flex-wrap: wrap; gap: 0 6px; }
.bill-options .flat { min-height: 36px; }
.keyboard-open .drawer:has(.bill-form:not([hidden])) { max-height: 100%; }

.budget-note, .budget-snapshot {
  font-size: 11px;
  line-height: 1.6;
  color: #3c321e;
}
.budget-note {
  --note-width: 304px;
  --peek: 38px;
  --open: 228px;
  position: absolute;
  z-index: 2;
  top: 107px;
  left: 100%;
  width: var(--peek);
  overflow: hidden;
  background: #f7e29a;
  border: 2px solid #5f4b28;
  box-shadow: 3px 4px #3b2b2734;
  transition: width .18s steps(6, end);
}
.budget-note:has(.budget-tab[aria-expanded="true"]) { width: var(--open); }
.calculator-stage:has(#history-view:not([hidden])) .budget-note { visibility: hidden; }
.budget-tab {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--peek) - 4px);
  border: 0;
  border-right: 2px solid #b49755;
  color: #40331d;
  background: repeating-conic-gradient(#af8e361c 0 25%, transparent 0 50%) 0 0 / 4px 4px, #efd181;
}
.budget-tab span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); }
.budget-tab[aria-expanded="true"] span::before { content: "‹ "; }
.budget-tab:focus-visible { outline-offset: -4px; }
.budget-body {
  width: calc(var(--note-width) - var(--peek));
  min-height: 230px;
  margin-left: calc(var(--peek) - 4px);
  padding: 12px 12px 15px;
}
.budget-body > * { max-width: calc(var(--open) - var(--peek) - 24px); }
.budget-number { margin-bottom: 9px; color: #654c26; }
.budget-lines { list-style: none; margin: 0; padding: 0 2px 0 0; max-height: 156px; overflow-y: auto; }
.budget-lines li, .budget-total { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; }
.budget-lines li span:first-child { overflow-wrap: anywhere; min-width: 0; }
.budget-lines li span:last-child, .budget-total strong { white-space: nowrap; }
.budget-lines .budget-empty { color: #65502b; }
.budget-total { border-top: 2px dashed #ab884d; margin-top: 12px; padding-top: 6px; }
.budget-total strong { font-weight: 400; }
.budget-save {
  width: 100%;
  min-height: 41px;
  padding: 5px 4px;
  margin-top: 11px;
  border: 2px solid #675129;
  color: #342816;
  background: #ffefb6;
  box-shadow: 0 2px #bb9755;
}
.budget-save:active { transform: translateY(2px); }
.budget-snapshot { margin: 6px 0 9px; padding: 7px 9px 9px; border: 1px solid #ab884d; background: #f8e7a8; }
@media (max-width: 850px) {
  .budget-note { position: relative; inset: auto; margin: 8px 0 0 auto; width: 104px; height: 37px; }
  .budget-note:has(.budget-tab[aria-expanded="true"]) { height: auto; }
  .budget-tab { position: static; display: block; width: 100%; min-height: 33px; border-right: 0; border-bottom: 2px solid #b49755; }
  .budget-tab span { writing-mode: horizontal-tb; transform: none; }
  .budget-tab[aria-expanded="true"] span::before { content: "− "; }
  .budget-body { width: 100%; margin: 0; min-height: 0; }
  .budget-body > * { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .budget-note { transition: none; } }

.bill-fields { align-items: start; }
.bill-field { display: grid; grid-template-rows: 16px 40px; gap: 3px; min-width: 0; }
.bill-field label { line-height: 16px; }
.bill-field input { display: block; height: 40px; margin-top: 0; }
.bill-field .currency-input span { top: 9px; }
.bill-hint { margin: 0 2px 3px; color: #375174; font-size: 9px; line-height: 1.4; }
.bill-main .bill-due { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.bill-main .bill-value { font-size: 12px; }

.budget-body { display: flex; flex-direction: column; height: 258px; }
.budget-body > :not(.budget-lines) { flex: 0 0 auto; }
.budget-body .budget-lines { flex: 1 1 auto; min-height: 0; max-height: none; }
.budget-pay {
  width: fit-content;
  border: 0;
  padding: 0 0 3px;
  margin-bottom: 6px;
  color: #654c26;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.budget-lines li { flex-wrap: wrap; column-gap: 5px; row-gap: 0; }
.budget-lines li span:first-child { flex: 1 1 45%; }
.budget-lines .adjustment-line { flex-wrap: nowrap; align-items: center; }
.adjustment-label {
  min-width: 0;
  min-height: 30px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.budget-due { display: block; flex: 0 0 100%; color: #6b5026; font-size: 9px; margin-bottom: 3px; }
.budget-snapshot .budget-lines { max-height: none; }
.budget-start { color: #654c26; }
.budget-memo { border-top: 1px solid #bba465; padding-top: 6px; font-size: 11px; }
.history-sponsor { margin: 14px auto 0; max-width: 100%; }
