:root {
  /* Light and dark mode (issue #91): every colour is a pair, -l for light and -d for dark. light-dark() picks
     one by the used color-scheme (below), the theme switch in the settings only sets color-scheme. */
  color-scheme: light dark;
  --bg-l: #fbf6ec; --bg-d: #14110d;
  --surface-l: #ffffff; --surface-d: #1f1b16;
  --surface-2-l: #f5eee1; --surface-2-d: #29241d;
  --surface-3-l: #ece2d0; --surface-3-d: #353026;
  --text-l: #1f1a14; --text-d: #f6efe4;
  --text-2-l: #554a3d; --text-2-d: #d6cab8;
  --muted-l: #6b5f50; --muted-d: #ab9e8b;
  --border-l: rgba(70, 50, 20, 0.12); --border-d: rgba(255, 240, 215, 0.11);
  --border-strong-l: rgba(70, 50, 20, 0.24); --border-strong-d: rgba(255, 240, 215, 0.24);
  --grid-l: #ebe2d2; --grid-d: #302a22;
  --axis-l: #cfc3ae; --axis-d: #443c31;
  --accent-l: #047857; --accent-d: #34d399;
  --accent-hover-l: #065f46; --accent-hover-d: #6ee7b7;
  --accent-ink-l: #ffffff; --accent-ink-d: #04261a;
  --accent-soft-l: #d6f0e2; --accent-soft-d: #143829;
  --series-food-l: #2a78d6; --series-food-d: #3987e5;
  --series-food-track-l: #cde2fb; --series-food-track-d: #184f95;
  --series-nonfood-l: #eb6834; --series-nonfood-d: #d95926;
  --series-fixed-l: #7d55c7; --series-fixed-d: #9b78e0;
  --series-income-l: #1f8a5b; --series-income-d: #3fb57c;
  --series-other-l: #138f8a; --series-other-d: #2fbfb6;
  --series-savings-l: #b7790f; --series-savings-d: #e0a33a;
  --good-text-l: #006300; --good-text-d: #22c55e;
  --critical-text-l: #b42828; --critical-text-d: #f07c7c;
  /* area tints (issue #105): every area of the app has its own soft colour; text keeps 4.5:1 on all of them */
  --tint-money-l: #dcf1e4; --tint-money-d: #16312a;
  --tint-shop-l: #dde9fa; --tint-shop-d: #172b44;
  --tint-todo-l: #ebe4fa; --tint-todo-d: #2a2443;
  --tint-pantry-l: #fcebcc; --tint-pantry-d: #382b14;
  --tint-receipt-l: #fbe3d8; --tint-receipt-d: #3a241b;
  /* the bold colour of each area (icon badges, bars); not used for text */
  --pop-money-l: #059669; --pop-money-d: #34d399;
  --pop-shop-l: #2f6fd6; --pop-shop-d: #6aa4ff;
  --pop-todo-l: #7c4ddb; --pop-todo-d: #b197fc;
  --pop-pantry-l: #b45309; --pop-pantry-d: #fbbf24;
  --pop-receipt-l: #e0592a; --pop-receipt-d: #ff9a70;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --shadow: 0 1px 0 light-dark(rgba(70, 50, 20, 0.06), transparent);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);   /* a little overshoot: ticks, tiles (motion dial 4) */
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 84px;          /* the floating dock (64 px) with its gap to the screen edge */
  --topbar-h: 60px;          /* the sticky top bar without the safe area (brand, badge, icon buttons) */
  --sticky-actions-h: 64px;  /* the action bar of the receipt review (.sticky-actions) */
  --dialog-actions-h: 68px;  /* the sticky buttons at the foot of a dialog */
  font-family: var(--font-body);
}
:root[data-theme="light"] { color-scheme: light; }   /* chosen on this device (settings), otherwise the system's */
:root[data-theme="dark"] { color-scheme: dark; }

/* The colours in use. Also declared on [data-look], so a look preview tile inside the page resolves its own
   pairs; light-dark() follows the color-scheme the element inherits. */
:root, [data-look] {
  --bg: light-dark(var(--bg-l), var(--bg-d));
  --surface: light-dark(var(--surface-l), var(--surface-d));
  --surface-2: light-dark(var(--surface-2-l), var(--surface-2-d));
  --surface-3: light-dark(var(--surface-3-l), var(--surface-3-d));
  --text: light-dark(var(--text-l), var(--text-d));
  --text-2: light-dark(var(--text-2-l), var(--text-2-d));
  --muted: light-dark(var(--muted-l), var(--muted-d));
  --border: light-dark(var(--border-l), var(--border-d));
  --border-strong: light-dark(var(--border-strong-l), var(--border-strong-d));
  --grid: light-dark(var(--grid-l), var(--grid-d));
  --axis: light-dark(var(--axis-l), var(--axis-d));
  --accent: light-dark(var(--accent-l), var(--accent-d));
  --accent-hover: light-dark(var(--accent-hover-l), var(--accent-hover-d));
  --accent-ink: light-dark(var(--accent-ink-l), var(--accent-ink-d));
  --accent-soft: light-dark(var(--accent-soft-l), var(--accent-soft-d));
  --series-food: light-dark(var(--series-food-l), var(--series-food-d));
  --series-food-track: light-dark(var(--series-food-track-l), var(--series-food-track-d));
  --series-nonfood: light-dark(var(--series-nonfood-l), var(--series-nonfood-d));
  --series-fixed: light-dark(var(--series-fixed-l), var(--series-fixed-d));
  --series-income: light-dark(var(--series-income-l), var(--series-income-d));
  --series-other: light-dark(var(--series-other-l), var(--series-other-d));
  --series-savings: light-dark(var(--series-savings-l), var(--series-savings-d));
  --good-text: light-dark(var(--good-text-l), var(--good-text-d));
  --critical-text: light-dark(var(--critical-text-l), var(--critical-text-d));
  --tint-money: light-dark(var(--tint-money-l), var(--tint-money-d));
  --tint-shop: light-dark(var(--tint-shop-l), var(--tint-shop-d));
  --tint-todo: light-dark(var(--tint-todo-l), var(--tint-todo-d));
  --tint-pantry: light-dark(var(--tint-pantry-l), var(--tint-pantry-d));
  --tint-receipt: light-dark(var(--tint-receipt-l), var(--tint-receipt-d));
  --pop-money: light-dark(var(--pop-money-l), var(--pop-money-d));
  --pop-shop: light-dark(var(--pop-shop-l), var(--pop-shop-d));
  --pop-todo: light-dark(var(--pop-todo-l), var(--pop-todo-d));
  --pop-pantry: light-dark(var(--pop-pantry-l), var(--pop-pantry-d));
  --pop-receipt: light-dark(var(--pop-receipt-l), var(--pop-receipt-d));
}

/* Browsers without light-dark() (before Safari 17.5, Chrome 123, Firefox 120): the same pairs, switched by
   the media query and the theme attribute. Shadows are left out there. */
@supports not (color: light-dark(#000, #fff)) {
  :root, [data-look] {
    --bg: var(--bg-l);
    --surface: var(--surface-l);
    --surface-2: var(--surface-2-l);
    --surface-3: var(--surface-3-l);
    --text: var(--text-l);
    --text-2: var(--text-2-l);
    --muted: var(--muted-l);
    --border: var(--border-l);
    --border-strong: var(--border-strong-l);
    --grid: var(--grid-l);
    --axis: var(--axis-l);
    --accent: var(--accent-l);
    --accent-hover: var(--accent-hover-l);
    --accent-ink: var(--accent-ink-l);
    --accent-soft: var(--accent-soft-l);
    --series-food: var(--series-food-l);
    --series-food-track: var(--series-food-track-l);
    --series-nonfood: var(--series-nonfood-l);
    --series-fixed: var(--series-fixed-l);
    --series-income: var(--series-income-l);
    --series-other: var(--series-other-l);
    --series-savings: var(--series-savings-l);
    --good-text: var(--good-text-l);
    --critical-text: var(--critical-text-l);
    --tint-money: var(--tint-money-l);
    --tint-shop: var(--tint-shop-l);
    --tint-todo: var(--tint-todo-l);
    --tint-pantry: var(--tint-pantry-l);
    --tint-receipt: var(--tint-receipt-l);
    --pop-money: var(--pop-money-l);
    --pop-shop: var(--pop-shop-l);
    --pop-todo: var(--pop-todo-l);
    --pop-pantry: var(--pop-pantry-l);
    --pop-receipt: var(--pop-receipt-l);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]), :root:not([data-theme="light"]) [data-look] {
      --bg: var(--bg-d);
      --surface: var(--surface-d);
      --surface-2: var(--surface-2-d);
      --surface-3: var(--surface-3-d);
      --text: var(--text-d);
      --text-2: var(--text-2-d);
      --muted: var(--muted-d);
      --border: var(--border-d);
      --border-strong: var(--border-strong-d);
      --grid: var(--grid-d);
      --axis: var(--axis-d);
      --accent: var(--accent-d);
      --accent-hover: var(--accent-hover-d);
      --accent-ink: var(--accent-ink-d);
      --accent-soft: var(--accent-soft-d);
      --series-food: var(--series-food-d);
      --series-food-track: var(--series-food-track-d);
      --series-nonfood: var(--series-nonfood-d);
      --series-fixed: var(--series-fixed-d);
      --series-income: var(--series-income-d);
      --series-other: var(--series-other-d);
      --series-savings: var(--series-savings-d);
      --good-text: var(--good-text-d);
      --critical-text: var(--critical-text-d);
      --tint-money: var(--tint-money-d);
      --tint-shop: var(--tint-shop-d);
      --tint-todo: var(--tint-todo-d);
      --tint-pantry: var(--tint-pantry-d);
      --tint-receipt: var(--tint-receipt-d);
      --pop-money: var(--pop-money-d);
      --pop-shop: var(--pop-shop-d);
      --pop-todo: var(--pop-todo-d);
      --pop-pantry: var(--pop-pantry-d);
      --pop-receipt: var(--pop-receipt-d);
    }
  }
  :root[data-theme="dark"], :root[data-theme="dark"] [data-look] {
    --bg: var(--bg-d);
    --surface: var(--surface-d);
    --surface-2: var(--surface-2-d);
    --surface-3: var(--surface-3-d);
    --text: var(--text-d);
    --text-2: var(--text-2-d);
    --muted: var(--muted-d);
    --border: var(--border-d);
    --border-strong: var(--border-strong-d);
    --grid: var(--grid-d);
    --axis: var(--axis-d);
    --accent: var(--accent-d);
    --accent-hover: var(--accent-hover-d);
    --accent-ink: var(--accent-ink-d);
    --accent-soft: var(--accent-soft-d);
    --series-food: var(--series-food-d);
    --series-food-track: var(--series-food-track-d);
    --series-nonfood: var(--series-nonfood-d);
    --series-fixed: var(--series-fixed-d);
    --series-income: var(--series-income-d);
    --series-other: var(--series-other-d);
    --series-savings: var(--series-savings-d);
    --good-text: var(--good-text-d);
    --critical-text: var(--critical-text-d);
    --tint-money: var(--tint-money-d);
    --tint-shop: var(--tint-shop-d);
    --tint-todo: var(--tint-todo-d);
    --tint-pantry: var(--tint-pantry-d);
    --tint-receipt: var(--tint-receipt-d);
    --pop-money: var(--pop-money-d);
    --pop-shop: var(--pop-shop-d);
    --pop-todo: var(--pop-todo-d);
    --pop-pantry: var(--pop-pantry-d);
    --pop-receipt: var(--pop-receipt-d);
  }
}


/* ------------------------------------------------------------------ personal look (issue #82)
   A look changes surfaces, corners, shadows, default accent and heading font. "Classic" is the design
   above. The rules also match an element inside the page ([data-look] on a preview tile). */

@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --font-system: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-rounded: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-body: var(--font-rounded);
  --font-head: var(--font-rounded);
}
[data-look="classic"] {   /* "Garden" since issue #105: the playful default */
  --bg-l: #fbf6ec; --bg-d: #14110d;
  --surface-l: #ffffff; --surface-d: #1f1b16;
  --surface-2-l: #f5eee1; --surface-2-d: #29241d;
  --surface-3-l: #ece2d0; --surface-3-d: #353026;
  --text-l: #1f1a14; --text-d: #f6efe4;
  --text-2-l: #554a3d; --text-2-d: #d6cab8;
  --muted-l: #6b5f50; --muted-d: #ab9e8b;
  --border-l: rgba(70, 50, 20, 0.12); --border-d: rgba(255, 240, 215, 0.11);
  --border-strong-l: rgba(70, 50, 20, 0.24); --border-strong-d: rgba(255, 240, 215, 0.24);
  --grid-l: #ebe2d2; --grid-d: #302a22;
  --axis-l: #cfc3ae; --axis-d: #443c31;
  --accent-l: #047857; --accent-d: #34d399;
  --accent-hover-l: #065f46; --accent-hover-d: #6ee7b7;
  --accent-ink-l: #ffffff; --accent-ink-d: #04261a;
  --accent-soft-l: #d6f0e2; --accent-soft-d: #143829;
  --shadow: 0 1px 0 light-dark(rgba(70, 50, 20, 0.06), transparent);
  --radius: 22px;
  --radius-sm: 14px;
  --font-head: var(--font-rounded);
}
[data-look="paper"] {
  --bg-l: #f3ecdf; --bg-d: #1c1814;
  --surface-l: #fbf6ec; --surface-d: #26211b;
  --surface-2-l: #efe7d8; --surface-2-d: #302a22;
  --surface-3-l: #e4dac7; --surface-3-d: #3b342a;
  --text-l: #2a2520; --text-d: #f1e9db;
  --text-2-l: #5c544a; --text-2-d: #cbbfab;
  --muted-l: #6a6256; --muted-d: #a89c88;
  --border-l: rgba(60, 45, 20, 0.16); --border-d: rgba(255, 240, 210, 0.12);
  --border-strong-l: rgba(60, 45, 20, 0.3); --border-strong-d: rgba(255, 240, 210, 0.24);
  --grid-l: #e2d8c5; --grid-d: #342d24;
  --axis-l: #c9bda6; --axis-d: #453c30;
  --accent-l: #9a4a2f; --accent-d: #e39a78;
  --accent-hover-l: #823c25; --accent-hover-d: #edb093;
  --accent-ink-l: #ffffff; --accent-ink-d: #20120b;
  --accent-soft-l: #f1dfd2; --accent-soft-d: #44291d;
  --shadow: none;
  --radius: 12px;
  --radius-sm: 8px;
  --font-head: var(--font-serif);
}
[data-look="kitchen"] {
  --bg-l: #fff4e6; --bg-d: #1a1410;
  --surface-l: #ffffff; --surface-d: #261d17;
  --surface-2-l: #ffecd6; --surface-2-d: #32261e;
  --surface-3-l: #ffe2c2; --surface-3-d: #3f3026;
  --text-l: #25190f; --text-d: #fff3e6;
  --text-2-l: #5e4a3a; --text-2-d: #dcc6b1;
  --muted-l: #73604f; --muted-d: #ad9681;
  --border-l: rgba(80, 40, 0, 0.1); --border-d: rgba(255, 225, 190, 0.12);
  --border-strong-l: rgba(80, 40, 0, 0.2); --border-strong-d: rgba(255, 225, 190, 0.24);
  --grid-l: #f3e3cf; --grid-d: #382b21;
  --axis-l: #dcc6ab; --axis-d: #4a392c;
  --accent-l: #c2410c; --accent-d: #ff9d5c;
  --accent-hover-l: #a8380a; --accent-hover-d: #ffb27e;
  --accent-ink-l: #ffffff; --accent-ink-d: #2a1203;
  --accent-soft-l: #ffe4d3; --accent-soft-d: #4a2a14;
  --shadow: 0 2px 0 light-dark(rgba(120, 60, 0, 0.07), transparent);
  --radius: 26px;
  --radius-sm: 16px;
  --font-head: var(--font-rounded);
}
[data-look="night"] {
  --bg-l: #eef2f7; --bg-d: #0b1220;
  --surface-l: #fbfcfe; --surface-d: #131c2e;
  --surface-2-l: #e8edf4; --surface-2-d: #1b263b;
  --surface-3-l: #dae2ec; --surface-3-d: #24324b;
  --text-l: #131a24; --text-d: #e8eef8;
  --text-2-l: #465264; --text-2-d: #b5c2d6;
  --muted-l: #55606f; --muted-d: #8d9cb2;
  --border-l: rgba(15, 30, 60, 0.12); --border-d: rgba(160, 190, 255, 0.12);
  --border-strong-l: rgba(15, 30, 60, 0.22); --border-strong-d: rgba(160, 190, 255, 0.24);
  --grid-l: #dde4ee; --grid-d: #1f2b41;
  --axis-l: #b9c4d3; --axis-d: #2c3b56;
  --accent-l: #2f5fd0; --accent-d: #7aa5ff;
  --accent-hover-l: #244eb0; --accent-hover-d: #96b8ff;
  --accent-ink-l: #ffffff; --accent-ink-d: #071226;
  --accent-soft-l: #dfe8fb; --accent-soft-d: #1b2f57;
  --shadow: 0 1px 0 light-dark(rgba(15, 30, 60, 0.07), transparent);
  --radius: 18px;
  --radius-sm: 12px;
  --font-head: var(--font-system);
}

/* heading font chosen in the settings (otherwise the look's own) */
:root[data-font="system"] { --font-head: var(--font-system); }
:root[data-font="serif"] { --font-head: var(--font-serif); }
:root[data-font="rounded"] { --font-head: var(--font-rounded); }

/* accent colour chosen in the settings: --ua (light), --ua-ink and --ua-dark are set by js/look.js */
:root[data-accent] {
  --accent-l: var(--ua); --accent-d: var(--ua-dark);
  --accent-ink-l: var(--ua-ink); --accent-ink-d: #0b0f0d;
  --accent-hover-l: color-mix(in srgb, var(--ua) 86%, #000); --accent-hover-d: color-mix(in srgb, var(--ua-dark) 82%, #fff);
  --accent-soft-l: color-mix(in srgb, var(--ua) 14%, var(--surface-l));
  --accent-soft-d: color-mix(in srgb, var(--ua-dark) 24%, var(--surface-d));
}

h1, h2, h3, .brand-text, .hero, .kpi .value { font-family: var(--font-head); }
:root[data-look="paper"] .card, :root[data-look="paper"] .kpi { border-color: var(--border-strong); }
.brand-mark.emoji { background: var(--accent-soft); font-size: 1.15rem; line-height: 1; }
/* a header symbol drawn as a picture (static/symbols/) */
.brand-mark.picture { background: var(--accent-soft); }
.brand-mark img, .hello-mark img, .icon-choices img { display: block; object-fit: contain; }

/* look settings */
.look-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .look-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.look-tile {
  display: flex; flex-direction: column; gap: 8px; padding: 10px; text-align: left; cursor: pointer;
  background: var(--bg); color: var(--text); border: 2px solid var(--border-strong); border-radius: 14px;
}
.look-tile.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.look-tile .sample {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.look-tile .sample b { font-family: var(--font-head); font-size: 1.15rem; font-weight: 650; }
.look-tile .sample i { width: 34px; height: 18px; border-radius: 999px; background: var(--accent); flex: none; }
.look-tile .name { font-weight: 650; font-size: 0.9rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface); outline: 1px solid var(--border-strong);
  background: var(--swatch, var(--surface-2)); cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--text-2);
}
.swatch.active { outline: 3px solid var(--text); }
.swatch-custom { position: relative; overflow: hidden; }
.swatch-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.icon-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-choices button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.icon-choices button.active { border-color: var(--accent); background: var(--accent-soft); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; accent-color: var(--accent); }
/* Focused and scrolled-to content stays clear of the sticky top bar and the fixed tab bar (issue #95, WCAG
   2.4.11): scroll-padding applies to focus scrolling, scrollIntoView(), anchors and find-in-page. */
html {
  scroll-padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 8px);
  scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
}
html:has(.sticky-actions) {
  scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sticky-actions-h) + 16px);
}
@media (min-width: 900px) {   /* no tab bar */
  html { scroll-padding-bottom: 8px; }
  html:has(.sticky-actions) { scroll-padding-bottom: calc(var(--sticky-actions-h) + 20px); }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.8rem; font-weight: 850; letter-spacing: -0.02em; }
h2 { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 0.98rem; font-weight: 750; }
p { margin: 0; text-wrap: pretty; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 0.85rem; }
.num, .hero, .kpi .value { font-variant-numeric: tabular-nums; }
.sr-only {   /* read by screen readers, not shown */
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* the page heading (or the view on an error page) takes focus on a page change (issue #97) so screen readers
   read it. It is not a control, so it never gets a ring: iOS Safari counts focus set by script after a tap
   as :focus-visible and would draw one */
#view h1[tabindex="-1"]:focus, #view:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* ------------------------------------------------------------------ utilities (issue #91)
   One declaration each, for markup built in js/: the Content-Security-Policy allows no style="…"
   attributes. !important, as an inline style won over the stylesheet; [hidden] below still wins. */
.border-0 { border: 0 !important; }
.case-plain { text-transform: none !important; letter-spacing: 0 !important; }
.color-inherit { color: inherit !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.flex-1 { flex: 1 !important; }
.fs-110 { font-size: 1.1rem !important; }
.fs-160 { font-size: 1.6rem !important; }
.fs-180 { font-size: 1.8rem !important; }
.fw-400 { font-weight: 400 !important; }
.fw-600 { font-weight: 600 !important; }
.fwrap { flex-wrap: wrap !important; }
.gap-6 { gap: 6px !important; }
.gap-8 { gap: 8px !important; }
.gap-10 { gap: 10px !important; }
.gap-14 { gap: 14px !important; }
.gap-16 { gap: 16px !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.items-start { align-items: flex-start !important; }
.jc-between { justify-content: space-between !important; }
.jc-center { justify-content: center !important; }
.justify-self-start { justify-self: start; }
.jc-end { justify-content: flex-end !important; }
.m-0 { margin: 0 !important; }
.maxw-110 { max-width: 110px !important; }
.maxw-260 { max-width: 260px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 2px !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-6 { margin-bottom: 6px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-14 { margin-bottom: 14px !important; }
.mb-16 { margin-bottom: 16px !important; }
.minw-0 { min-width: 0 !important; }
.mt-n6 { margin-top: -6px !important; }
.mt-n4 { margin-top: -4px !important; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 2px !important; }
.mt-4 { margin-top: 4px !important; }
.mt-6 { margin-top: 6px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-14 { margin-top: 14px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-18 { margin-top: 18px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-22 { margin-top: 22px !important; }
.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-2 { margin-left: 2px !important; margin-right: 2px !important; }
.no-underline { text-decoration: none !important; }
.p-0 { padding: 0 !important; }
.pl-18 { padding-left: 18px !important; }
.pointer { cursor: pointer !important; }
.py-2 { padding-top: 2px !important; padding-bottom: 2px !important; }
.py-4 { padding-top: 4px !important; padding-bottom: 4px !important; }
.text-critical { color: var(--critical-text) !important; }
.text-good { color: var(--good-text) !important; }
.w-20 { width: 20px !important; }
.w-full { width: 100% !important; }
.ws-normal { white-space: normal !important; }

[hidden] { display: none !important; }

/* ------------------------------------------------------------------ layout */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.05rem; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px; flex: none;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
}
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a {
  text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--text-2); font-weight: 700;
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
@media (max-width: 1099px) { .topnav { gap: 2px; margin-left: 8px; } .topnav a { padding: 8px 9px; } }
@media (hover: hover) { .topnav a:hover { background: var(--surface-2); color: var(--text); } }
.topnav a.active { background: var(--accent-soft); color: var(--text); }
.topbar .spacer { flex: 1; }
.topbar #scan-top { display: none; }
@media (min-width: 900px) { .topbar #scan-top { display: inline-flex; } }

main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 32px; outline: none; }

.tabbar {   /* the dock (issue #105): a floating pill above the home indicator */
  position: fixed; z-index: 30;
  left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--tabbar-h) - 20px); padding: 0 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border-strong); border-radius: 28px;
  box-shadow: 0 10px 30px light-dark(rgb(70 50 20 / 0.16), rgb(0 0 0 / 0.5));
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
}
.tabbar a, .tabbar .tab-capture {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: 100%; min-width: 0; text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 750;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
  transition: color 150ms ease-out;
}
/* the active place: a pill behind its icon */
.tabbar a svg {
  box-sizing: content-box; padding: 4px 16px; border-radius: 999px;
  transition: background-color 200ms ease-out, color 200ms ease-out, scale 150ms ease-out;
}
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { color: var(--accent); background: var(--accent-soft); }
.tabbar .capture-bubble {
  width: 54px; height: 54px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); margin-top: -26px; border: 4px solid var(--bg);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: scale 150ms ease-out, box-shadow 150ms ease-out, background-color 150ms ease-out;
}
.tabbar .tab-capture { color: var(--text-2); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar .prices-top, .topbar .pantry-top { display: none; }   /* labelled links in the top navigation there */
  .topbar { border-bottom-color: var(--border); }
  main { padding: 28px 24px 48px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
/* the page's area (issue #105): a soft panel in the area's colour with its symbol in a badge */
.page-head {
  align-items: center; padding: 16px; border-radius: var(--radius);
  background: var(--area-tint, var(--surface-2));
}
.page-head > div:first-child { position: relative; min-width: 0; flex: 1 1 200px; padding-left: 58px; min-height: 46px;
  display: flex; flex-direction: column; justify-content: center; }
.page-head > div:first-child::before, .page-head > div:first-child::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 46px; height: 46px; translate: 0 -50%;
}
.page-head > div:first-child::before { border-radius: 15px; background: var(--area-pop, var(--accent)); }
.page-head > div:first-child::after {
  background: var(--bg); -webkit-mask: var(--area-icon) center / 24px 24px no-repeat; mask: var(--area-icon) center / 24px 24px no-repeat;
}
/* words never break inside (issue #105 feedback): only a single word too long for the whole line may */
.page-head h1 { font-size: 1.6rem; overflow-wrap: break-word; hyphens: manual; }
@media (max-width: 599px) {   /* the page's buttons get their own row, the title the whole width */
  .page-head > div:first-child { flex-basis: 100%; }
}
@media (max-width: 359px) {
  .page-head { padding: 14px; }
  .page-head > div:first-child { padding-left: 52px; }
  .page-head > div:first-child::before, .page-head > div:first-child::after { width: 42px; height: 42px; }
  .page-head h1 { font-size: 1.45rem; }
}
.page-head p.muted { color: var(--text-2); }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head a { font-size: 0.9rem; color: var(--text-2); text-decoration: none; font-weight: 700; }
@media (hover: hover) { .card-head a:hover { color: var(--text); } }
.card.flat { box-shadow: none; }

.cta {
  display: flex; align-items: center; gap: 16px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 18px;
}
.cta .cta-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent-ink) 14%, transparent); flex: none; }
.cta strong { display: block; font-size: 1.1rem; }
/* solid --accent-ink, no opacity: the ink is chosen for 4.5:1 on the accent (js/look.js), also for own colours (#93) */
.cta span span { font-size: 0.9rem; font-weight: 450; }

.banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 0.93rem;
}
.banner.warn { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.banner.error { background: color-mix(in srgb, var(--critical) 12%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.banner.ok { background: color-mix(in srgb, var(--good) 10%, var(--surface)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.banner svg { flex: none; }
.banner .banner-body { flex: 1; min-width: 0; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------ buttons & forms */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 750; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
@media (hover: hover) { .btn:hover { background: var(--surface-2); } }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
@media (hover: hover) { .btn.primary:hover { background: var(--accent-hover); } }
.btn.danger { color: var(--critical-text); }
.btn.ghost { border-color: transparent; background: transparent; }
@media (hover: hover) { .btn.ghost:hover { background: var(--surface-2); } }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.88rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* needs a connection while offline (issue #128): still focusable, a click says why */
.btn[aria-disabled="true"], .segmented button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; flex: none;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2);
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--text); } }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); }

label.field, div.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--text-2); font-weight: 700; min-width: 0; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%; min-height: 46px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: max(1rem, 1em);   /* at least 16 px: iOS zooms into smaller fields */
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
/* marked only after the user touched the field, not on an untouched required field */
:is(input:not([type="range"], [type="checkbox"], [type="radio"]), select, textarea):user-invalid { border-color: var(--critical); }
textarea { min-height: 160px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.93rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 0.88rem;
  font-weight: 750; cursor: pointer; text-decoration: none; min-height: 36px;
}
@media (hover: hover) { .chip:hover { color: var(--text); } }
.chip.active { background: var(--text); color: var(--bg); border-color: transparent; }
.chip .count { color: var(--muted); font-weight: 500; }   /* solid colour, 4.5:1 on cards (#93) */
.chip.active .count { color: inherit; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 24px; padding: 4px; gap: 4px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 750; color: var(--text-2); cursor: pointer; }
.segmented button.active { background: var(--text); color: var(--bg); }
.segmented a { padding: 7px 14px; border-radius: 999px; font-weight: 750; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.segmented a.active { background: var(--text); color: var(--bg); }
.finance-tabs { margin-bottom: 16px; max-width: 100%; overflow-x: auto; }
@media (max-width: 560px) {
  .finance-tabs { display: flex; width: 100%; }
  .finance-tabs a { flex: 1; text-align: center; padding: 7px 6px; font-size: 0.88rem; }
}
.month-nav { margin-bottom: 16px; }
.month-nav .month-label { min-width: 150px; text-align: center; }

/* ------------------------------------------------------------------ badges & status */

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.food { background: color-mix(in srgb, var(--series-food) 14%, var(--surface)); color: var(--text); }
.badge.nonfood { background: color-mix(in srgb, var(--series-nonfood) 14%, var(--surface)); color: var(--text); }
.badge.fixed { background: color-mix(in srgb, var(--series-fixed) 16%, var(--surface)); color: var(--text); }
.badge.income { background: color-mix(in srgb, var(--series-income) 16%, var(--surface)); color: var(--text); }
.badge.other { background: color-mix(in srgb, var(--series-other) 14%, var(--surface)); color: var(--text); }
.badge.draft { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--text); }
.badge.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--text); }
.badge.ai { background: color-mix(in srgb, var(--series-fixed) 16%, var(--surface)); color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.dot.food { background: var(--series-food); }
.dot.nonfood { background: var(--series-nonfood); }
.dot.fixed { background: var(--series-fixed); }
.dot.income { background: var(--series-income); }
.dot.other { background: var(--series-other); }
.dot.savings { background: var(--series-savings); }
.dot.spent { background: var(--series-food); }

.expiry {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.expiry svg { width: 14px; height: 14px; }
.expiry.expired { background: color-mix(in srgb, var(--critical) 16%, var(--surface)); color: var(--text); }
.expiry.expired svg { color: var(--critical); }
.expiry.today { background: color-mix(in srgb, var(--serious) 20%, var(--surface)); color: var(--text); }
.expiry.today svg { color: var(--serious); }
.expiry.soon { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--text); }
.expiry.soon svg { color: color-mix(in srgb, var(--warning) 70%, var(--text)); }

/* ------------------------------------------------------------------ lists */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); min-width: 0;
}
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 0.83rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a choice next to its title, e.g. the local OCR engine: below the text when the row is too narrow for both */
.list-item.has-choice { flex-wrap: wrap; row-gap: 8px; }
.list-item.has-choice > .grow { flex: 1 1 14rem; }
.list-item.has-choice > select { width: auto; flex: 1 0 12rem; max-width: 100%; }
/* status rows in the settings (system, accounts, passkeys): their explanations are read in full, not cut */
:is(#system-card, #account-card, #people-card, #ai-settings) .list-item .sub { white-space: normal; overflow: visible; }
:is(#system-card, #account-card, #people-card) .list-item .title { white-space: normal; overflow-wrap: anywhere; }
.list-item a.title { text-decoration: none; }
.list-item .title.wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.inv-main { all: unset; flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 4px; border-radius: 8px; }
.inv-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inv-main .meta-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.83rem; color: var(--muted); }
.hide-mobile { display: none; }
@media (min-width: 600px) { .hide-mobile { display: inline; } }
.emoji { font-size: 1.35rem; width: 32px; text-align: center; flex: none; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.group-title { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; font-family: var(--font-head); font-size: 1rem; font-weight: 800; color: var(--text-2); }
.group-title:first-child { margin-top: 0; }
.group-title .line { flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------------ receipts: search & load more */

.receipt-search { display: grid; gap: 10px; margin-bottom: 18px; }
.search-bar { display: flex; gap: 8px; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 38px; }
.filter-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 700; }
.search-filters { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); }
.search-filters .btn[data-act="reset"] { justify-self: start; }
.filter-group { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.filter-group legend { padding: 0; margin-bottom: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.filter-row { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-row:has(> :nth-child(3)) > :first-child { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .filter-row:has(> :nth-child(3)) { grid-template-columns: 2fr 1fr 1fr; }
  .filter-row:has(> :nth-child(3)) > :first-child { grid-column: auto; }
}
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 0.88rem; font-weight: 600; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.last-bought { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; text-decoration: none; color: inherit;
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.last-bought .title { font-weight: 650; font-size: 1.05rem; }
.last-bought > svg { flex: none; color: var(--text-2); }
.load-more { display: flex; justify-content: center; margin-top: 12px; }
.search-note { text-align: center; margin-top: 16px; }

/* ------------------------------------------------------------------ stats */

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis.five .kpi.lead, .kpis.six .kpi.lead { grid-column: 1 / -1; }
@media (min-width: 1000px) {
  .kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis.five .kpi.lead { grid-column: auto; }
}
/* six KPIs: lead + five on the phone (last one full width), two rows of three from tablet width */
.kpis.six .kpi:last-child { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.six .kpi.lead, .kpis.six .kpi:last-child { grid-column: auto; }
}

/* fixed costs (expenses page) */
.fixed-mode { display: grid; gap: 6px; margin-bottom: 8px; }
.fixed-mode p { margin: 0; }
.fixed-mode .segmented { justify-self: start; max-width: 100%; }
.fixed-mode .segmented button { white-space: nowrap; }
/* expenses: one part of the page at a time (issue #117); the switch scrolls sideways on a phone */
/* Expenses: one part at a time (issue #117). The tabs scroll sideways on a phone; the edge that has more tabs
   beyond it fades out, driven by the scroll position (modern-web-guidance "tabs"). */
@property --fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
.view-switch {
  position: relative; overflow-x: auto; scrollbar-width: none; margin-inline: -2px; padding: 2px;
  scroll-snap-type: inline proximity; scroll-padding-inline: 2rem;
  --fade-size: 2.5rem;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to right, black, transparent) 0 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to right, transparent, black) 100% 0 / var(--fade-end) 100% no-repeat no-clip;
  animation: view-fade-start linear both, view-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
}
@keyframes view-fade-start { to { --fade-start: var(--fade-size); } }
@keyframes view-fade-end { from { --fade-end: var(--fade-size); } }
@supports not (animation-timeline: scroll()) {   /* set from script: which edge has more tabs beyond it */
  .view-switch { animation: none; transition: --fade-start .2s, --fade-end .2s; }
  .view-switch.more-start { --fade-start: var(--fade-size); }
  .view-switch.more-end { --fade-end: var(--fade-size); }
}
.view-switch::-webkit-scrollbar { display: none; }
.view-switch .segmented button { white-space: nowrap; flex: none; scroll-snap-align: start; }
@media (pointer: coarse) { .view-switch .segmented button { min-height: 44px; } }
@media (forced-colors: active) { .view-switch [aria-selected="true"] { outline: 2px solid CanvasText; outline-offset: -2px; } }
.kind-chips .chip { flex: 1 0 auto; justify-content: center; padding-inline: 10px; }
@media (pointer: coarse) { .kind-chips .chip { min-height: 44px; } }
.day-head { margin: 14px 2px 6px; font-size: 0.85rem; font-weight: 750; color: var(--text-2); }
.day-head:first-of-type { margin-top: 4px; }
.list-item.planned .title, .list-item.planned .num { color: var(--text-2); }

/* Narrow: the six figures as one card, the five parts as rows under the total, so the switch comes into view
   sooner on a phone (about 330 px instead of 500 px). Every figure stays. */
.kpi-wrap { container: kpis / inline-size; }
@container kpis (inline-size < 560px) {
  .kpis.six {
    gap: 0; grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  }
  .kpis.six .kpi { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .kpis.six .kpi:not(.lead) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "delta value";
    column-gap: 12px; align-items: center; padding: 7px 16px; border-top: 1px solid var(--border);
  }
  .kpis.six .kpi:not(.lead) .label { grid-area: label; color: var(--text); font-weight: 650; line-height: 1.35; }
  .kpis.six .kpi:not(.lead) .delta { grid-area: delta; margin-top: 0; line-height: 1.35; }
  .kpis.six .kpi:not(.lead) .value { grid-area: value; font-size: 1.1rem; margin-top: 0; text-align: end; }
}
:root[data-look="paper"] .kpis.six { border-color: var(--border-strong); }
@media (max-width: 420px) { .fixed-mode .segmented button { padding: 7px 10px; font-size: 0.85rem; } }
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-chip { position: relative; cursor: pointer; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip span { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.choice-chip input:checked + span { border: 2px solid var(--accent); background: var(--accent-soft); padding: 6px 11px; }
.choice-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; padding: 2px; }
.icon-choice { position: relative; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; pointer-events: none; }
.icon-choice span { display: flex; align-items: center; justify-content: center; height: 44px; font-size: 1.35rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.icon-choice input:checked + span { border: 2px solid var(--accent); background: var(--accent-soft); }
.icon-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.category-list .list-item { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.category-list .list-item:hover .title { text-decoration: underline; text-underline-offset: 3px; }
button.list-item.fixed-item { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.list-item.fixed-item:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.fixed-item .fixed-icon { font-size: 1.25rem; width: 1.6rem; text-align: center; flex: none; }
.category-list .category-icon { font-size: 1.25rem; width: 1.6rem; text-align: center; }
.fixed-item.inactive { opacity: 0.6; }
.fixed-item .badge { margin-left: 4px; vertical-align: 1px; }
/* an amount changed from a month on: one row, the other amounts of its history underneath */
.history-group { border-top: 1px solid var(--border); }
.history-group:first-child { border-top: 0; }
.history-group > .list-item { border-top: 0; padding-bottom: 4px; }
.history-lines { display: grid; justify-items: start; gap: 2px; padding: 0 0 10px calc(1.6rem + 12px); }
.history-line, .history-more summary { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 0.83rem;
  color: var(--muted); text-align: left; cursor: pointer; }
.history-line:hover, .history-more summary:hover { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.history-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.history-more { display: grid; justify-items: start; gap: 2px; }
.change-scope { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px 12px; margin: 0;
  min-width: 0; display: grid; gap: 8px; }
.change-scope legend { padding: 0 4px; font-size: 0.85rem; font-weight: 550; color: var(--text-2); }
.change-scope p { margin: 0; }
.change-from { display: flex; align-items: center; gap: 10px; }
.change-from select { flex: 1; min-width: 0; }
.form-grid input:disabled { opacity: 0.55; cursor: not-allowed; }   /* e.g. the first date while "from" is chosen */
.fixed-total { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .label { font-size: 0.85rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.6rem; font-weight: 850; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .delta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.delta.up { color: var(--critical-text); }
.delta.down { color: var(--good-text); }
.hero { font-size: 2.7rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }

.meter { height: 12px; border-radius: 999px; background: var(--series-food-track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--series-food); }
.meter.warn > span { background: var(--warning); }
.meter.over > span { background: var(--critical); }
.meter.warn { background: color-mix(in srgb, var(--warning) 25%, var(--surface)); }
.meter.over { background: color-mix(in srgb, var(--critical) 22%, var(--surface)); }

.splitbar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.splitbar span { display: block; height: 100%; }
.splitbar .food { background: var(--series-food); }
.splitbar .nonfood { background: var(--series-nonfood); }
.splitbar .other { background: var(--series-other); }
.splitbar .fixed { background: var(--series-fixed); }
.splitbar .savings { background: var(--series-savings); }
.splitbar .spent { background: var(--series-food); }
.splitbar .income { background: var(--series-income); }
.splitbar.budget-bar { height: 12px; }

/* ------------------------------------------------------------------ budget */

.budget-hero .label { font-size: 0.9rem; color: var(--text-2); font-weight: 600; }
.budget-hero .hero { margin-top: 4px; }
.goal-meter { background: color-mix(in srgb, var(--series-savings) 22%, var(--surface-2)); }
.goal-meter > span { background: var(--series-savings); }
.goal-list { display: grid; gap: 0; }
.goal { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.goal:last-child { border-bottom: 0; }
.goal:first-child { padding-top: 4px; }
.goal-title { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.goal-title:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.goal.reached .goal-meter > span { background: var(--good); }
.cat-budgets { display: grid; }
.cat-budget { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cat-budget:first-child { padding-top: 4px; }
.cat-budget:last-child { border-bottom: 0; padding-bottom: 0; }
.cat-budget .num { white-space: nowrap; }
.storage-size { white-space: nowrap; }
#storage progress { inline-size: 100%; }
#storage .list-item .sub { white-space: normal; overflow: visible; }
.cat-budget-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.cat-budget-title:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.cat-budget .fixed-icon, .limit-row .fixed-icon { font-size: 1.15rem; width: 1.6rem; text-align: center; flex: none; }
.limit-list { display: grid; }
.limit-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.limit-row:last-child { border-bottom: 0; }
.limit-row .grow { flex: 1; min-width: 0; }
.limit-row input[type="number"] { width: 7.5rem; flex: none; text-align: right; }
.hint-list { display: grid; }
.hint { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.hint:last-child { border-bottom: 0; }
.hint .hint-icon { flex: none; margin-top: 2px; color: var(--muted); }
.hint.warn .hint-icon { color: var(--serious); }
.hint .icon-btn { flex: none; margin-top: -4px; }
.finance-card { display: block; text-decoration: none; color: inherit; }
.finance-card .label { font-weight: 600; color: var(--text-2); }
.finance-card:hover .small { text-decoration: underline; }
.amount-positive { color: var(--good-text); }
.amount-negative { color: var(--critical-text); }
.budget-lines { margin: 6px 0 14px; }
.budget-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
.table-scroll table.data td:first-child { white-space: nowrap; }
.budget-line.total { border-bottom: 0; font-weight: 650; font-size: 1.05rem; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .value-label { fill: var(--text-2); font-weight: 600; }
.chart text.selected-label { fill: var(--text); font-weight: 650; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .bar-food { fill: var(--series-food); }
.chart .bar-nonfood { fill: var(--series-nonfood); }
.chart .bar-fixed { fill: var(--series-fixed); }
.chart .bar-other { fill: var(--series-other); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus { fill: color-mix(in srgb, var(--text) 5%, transparent); outline: none; }
.chart .selected-bg { fill: color-mix(in srgb, var(--text) 4%, transparent); }

.hbar { display: grid; grid-template-columns: 1fr; align-items: center; gap: 4px; padding: 6px 0; border-radius: 8px; }
@media (min-width: 560px) { .hbar { grid-template-columns: minmax(130px, 38%) 1fr; gap: 10px; } }
.hbar:hover, .hbar:focus { background: var(--surface-2); outline: none; }
.hbar .hbar-label { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.hbar .hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar .hbar-fill { height: 14px; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .hbar-fill.food { background: var(--series-food); }
.hbar .hbar-fill.nonfood { background: var(--series-nonfood); }
.hbar .hbar-fill.other { background: var(--series-other); }
.hbar .hbar-value { font-size: 0.85rem; color: var(--text-2); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 8px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-size: 0.83rem;
}
.tooltip .tt-title { color: var(--text-2); font-size: 0.78rem; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row .key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .tt-row .key i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.tooltip .tt-row strong { font-variant-numeric: tabular-nums; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { text-align: left; padding: 7px 6px; border-top: 1px solid var(--border); }
table.data th { color: var(--muted); font-weight: 600; font-size: 0.8rem; border-top: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 0.85rem; margin-top: 10px; }

/* ------------------------------------------------------------------ scanner */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px 16px; text-align: center;
  background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .big-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dropzone .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.preview { max-height: 320px; border-radius: 12px; border: 1px solid var(--border); object-fit: contain; background: var(--surface-2); }
.progress { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 10px; text-align: center; }
.progress-text { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.spinner.small { width: 20px; height: 20px; border-width: 3px; flex: none; }
/* review: the receipt is locked while the AI works on it (issue #122) */
.banner.ai-busy { align-items: center; }
.review-layout[inert], .sticky-actions[inert] { opacity: 0.55; transition: opacity 0.2s; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ------------------------------------------------------------------ receipt review */

.review-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .review-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.review-side { position: sticky; top: 76px; }
.receipt-image { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: zoom-in; }
.header-fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.header-fields .wide { grid-column: 1 / -1; }
@media (min-width: 760px) { .header-fields { grid-template-columns: 2fr 1fr 1fr; } .header-fields .wide { grid-column: auto; } }
.checkline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.93rem; }
.checkline strong { font-variant-numeric: tabular-nums; }

.item-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface); display: grid; gap: 10px; }
.item-card.low { border-color: color-mix(in srgb, var(--warning) 70%, transparent); box-shadow: inset 3px 0 0 var(--warning); }
.item-card.excluded { opacity: 0.75; }
/* positions the AI correction changed (issue #52) */
.item-card.ai-changed { border-color: color-mix(in srgb, var(--series-fixed) 60%, transparent); box-shadow: inset 3px 0 0 var(--series-fixed); }
.item-top { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.item-top .name-input { font-weight: 600; }
.item-meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item-fields { display: grid; gap: 8px; grid-template-columns: 70px 76px 1fr; }
.item-fields .f-cat { grid-column: 1 / -1; }
.item-fields .f-loc, .item-fields .f-bbd { grid-column: span 1; }
.item-fields .f-wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) {
  .item-fields { grid-template-columns: 70px 80px 100px minmax(150px, 1.4fr) minmax(130px, 1fr) 150px; }
  .item-fields .f-cat { grid-column: auto; }
  .item-fields .f-wide { display: contents; }
}
.item-fields label.field { font-size: 0.75rem; }
.item-fields input, .item-fields select { min-height: 40px; padding: 6px 9px; }
.item-list { display: grid; gap: 10px; }
.group-sum { margin-left: auto; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; font-weight: 650; color: var(--text-2); }

.sticky-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 10;
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: nowrap;
  padding: 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius); margin-top: 16px; box-shadow: var(--shadow);
}
@media (min-width: 900px) { .sticky-actions { bottom: 12px; } }
/* narrow phones: the three draft buttons must fit inside the bar (the delete button used to stick out on the left) */
@media (max-width: 420px) {
  .sticky-actions { gap: 6px; padding: 8px; }
  .sticky-actions .btn { padding-inline: 12px; }
  .sticky-actions #discard { padding-inline: 0; width: 44px; flex: none; }
}
@media (max-width: 370px) { .sticky-actions #confirm > svg { display: none; } }

/* ------------------------------------------------------------------ price memory */

.topbar .icon-btn.active { background: var(--accent-soft); color: var(--accent); }   /* pantry, prices, settings */
.price-tabs { margin-bottom: 12px; max-width: 100%; overflow-x: auto; }
.price-filter { margin-bottom: 12px; flex-wrap: wrap; }
.price-filter input { flex: 1 1 14rem; min-width: 0; }   /* on a phone the chips go below the search */
.list-item.price-product { position: relative; align-items: flex-start; }
/* the product name is the point of the row: it wraps instead of ending in "…" next to the cheapest-shop badge */
.list-item.price-product .title { white-space: normal; overflow-wrap: anywhere; }
.list-item.price-product .sub { white-space: normal; }
@media (max-width: 599px) {
  .list-item.price-product > .badge { white-space: normal; text-align: center; justify-content: center; max-width: 6.5rem; line-height: 1.25; padding-block: 3px; }
}
/* the product name links the whole row (stretched link); the pack size button sits above it (issue #172) */
.price-product-link { display: block; color: inherit; }
.price-product-link::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.price-product-link:focus-visible { outline: none; }
.price-product-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.price-product:has(.price-product-link:active) { background: color-mix(in srgb, var(--text) 6%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--text) 6%, transparent); border-radius: 6px; }
.pack-missing, .item-pack { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; }
.pack-missing svg, .item-pack > span svg { vertical-align: -2px; }
/* a booked receipt line: name (up to two lines), quantity and "in the pantry" on the left, the price on the right;
   the pack size gets its own full-width line below instead of squeezing the name on a phone */
.receipt-line { flex-wrap: wrap; row-gap: 2px; }
.receipt-line .sub { white-space: normal; }
.receipt-line .grow > .badge { margin-top: 4px; }
.receipt-line > .item-pack { flex-basis: 100%; margin-top: 0; padding-left: 44px; }
.pack-missing .btn { position: relative; z-index: 1; }
.pack-pick .list-item { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit;
  color: inherit; text-align: left; cursor: pointer; }
.pack-pick .list-item .title, .pack-pick .list-item .sub { display: block; }
.pack-pick .list-item:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.price-chips { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 0.85rem; }
.price-chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.price-trend { font-size: 0.78rem; font-weight: 650; white-space: nowrap; color: var(--muted); }
.price-trend.up { color: var(--critical-text); }
.price-trend.down { color: var(--good-text); }
.price-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); min-width: 0; }
.price-line:first-child { border-top: 0; }
.price-line .grow { flex: 1; min-width: 0; }
.price-line .title { font-weight: 600; font-size: 0.9rem; }
.price-line .sub { font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.price-line.highlight { background: var(--accent-soft); border-radius: 8px; padding-left: 8px; padding-right: 4px; }
.price-figure { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.price-details { border-top: 1px solid var(--border); padding-top: 8px; }
.price-details summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; list-style: none; }
.price-details summary::-webkit-details-marker { display: none; }
.price-details summary::after { content: "▾"; color: var(--muted); }
/* a store price in the comparison, with the estimated other view below it (issue #110) */
.price-figure { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.price-details[open] summary::after { content: "▴"; }
.price-details[open] summary { margin-bottom: 4px; }
.price-details summary .grow { flex: 1; min-width: 0; }
.price-verdict { font-weight: 650; margin-bottom: 4px; color: var(--good-text); }
.same-pair { display: grid; gap: 10px; grid-template-columns: 1fr; }
.same-side { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; display: grid; gap: 2px; }
.same-side .same-pack { margin-inline-start: -12px; }
@media (hover: hover) { .same-side .btn.ghost:hover { background: var(--surface-3); } }
.same-label { font-weight: 650; overflow-wrap: anywhere; }
.same-vs { text-align: center; font-weight: 700; color: var(--muted); }
@media (min-width: 700px) { .same-pair { grid-template-columns: 1fr auto 1fr; align-items: stretch; } .same-vs { align-self: center; } }

/* kinds of interchangeable products (issue #173) */
.price-view { flex: none; }
.price-view button { white-space: nowrap; }
@media (pointer: coarse) { .price-view button { min-height: 44px; } }
@media (forced-colors: active) { .price-view [aria-pressed="true"] { outline: 2px solid CanvasText; outline-offset: -2px; } }
.kind-card h2 { font-size: 1.05rem; }
.kind-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; margin-block: -12px; }   /* a 44 px tap target without making the card taller */
.kind-link svg { color: var(--accent); flex: none; }
@media (hover: hover) { .kind-link:hover { text-decoration: underline; text-underline-offset: 3px; } }
.kind-suggestion legend { margin-bottom: 2px; }
.kind-suggestion .check > span { overflow-wrap: anywhere; }
.product-grouping hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.kind-remove { position: relative; z-index: 1; }   /* above the stretched product link */
.pick-results .check > span { overflow-wrap: anywhere; }

/* product photos (issue #175): a fixed square, so nothing shifts while a photo loads */
.prod-thumb {
  flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
}
.prod-thumb[width="44"] { width: 44px; height: 44px; }
.prod-thumb[width="36"] { width: 36px; height: 36px; border-radius: 9px; }
/* in a list where some rows have a product photo, the emoji of the other rows takes the photo's width,
   so all names start at the same line */
.list:has(> .list-item > .prod-thumb) > .list-item > .emoji { width: 40px; }
.list:has(> .list-item > .prod-thumb[width="44"]) > .list-item > .emoji { width: 44px; }
.product-photo { display: flex; gap: 14px; align-items: flex-start; }
.product-photo-img, .product-photo-empty {
  flex: none; width: 96px; height: 96px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2);
}
.product-photo-img { object-fit: contain; }
.product-photo-empty { display: grid; place-items: center; color: var(--muted); border-style: dashed; }
.product-photo-actions { flex-wrap: wrap; }
.product-photo[aria-busy="true"] { opacity: 0.7; cursor: progress; }
@media (min-width: 700px) { .product-photo-img, .product-photo-empty { width: 120px; height: 120px; } }

/* ------------------------------------------------------------------ inventory & shopping */

.inv-actions { display: flex; gap: 4px; flex: none; }
.qty { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 0.88rem; white-space: nowrap; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.shop-item:first-child { border-top: 0; }
.shop-item .grow { flex: 1; min-width: 0; }
.shop-item.done .title { text-decoration: line-through; color: var(--muted); }
.shop-item .title { font-weight: 700; }
.shop-check { width: 28px; height: 28px; border-radius: 10px; border: 2.5px solid color-mix(in srgb, var(--text) 38%, transparent); display: grid; place-items: center; background: var(--surface); cursor: pointer; flex: none; color: transparent; padding: 0; }
.shop-item.done .shop-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.shop-pending { color: var(--muted); display: inline-flex; vertical-align: -2px; }
.shop-name[data-edit="true"] { cursor: pointer; }

/* to-do list (issue #71) */
.todo-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 3px; }
.todo-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.todo-meta svg { width: 14px; height: 14px; flex: none; }
.todo-note { white-space: pre-line; overflow-wrap: anywhere; }
.todo-star { color: var(--muted); }
.todo-star[aria-pressed="true"] { color: var(--warning); }
.todo-star[aria-pressed="true"] svg { fill: currentColor; }
.shop-item.done .todo-meta { display: none; }
.todo-repeat { display: grid; grid-template-columns: 80px 1fr; gap: 8px; }
.todo-important { gap: 8px; font-weight: 550; color: var(--text-2); cursor: pointer; }
.todo-important input { width: 18px; height: 18px; }

/* offline badge in the top bar (offline.js) */
.net-badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.net-badge.offline { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.net-badge.stuck { background: color-mix(in srgb, var(--critical) 14%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.queue-list { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.queue-error { color: var(--critical-text); }
.net-badge .net-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--text); color: var(--bg); text-align: center; font-size: 0.75rem; line-height: 20px; }
.empty > svg { display: block; margin: 0 auto 8px; color: var(--muted); }

/* ------------------------------------------------------------------ dialog & toast */

dialog {
  border: 1px solid var(--border); border-radius: 26px; padding: 0; width: min(520px, calc(100% - 24px));
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
dialog form { padding: 18px; display: grid; gap: 12px; }
dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .wide { grid-column: 1 / -1; }

#toast-root { position: fixed; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); width: min(520px, calc(100vw - 24px)); }
@media (min-width: 900px) { #toast-root { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 18px; font-weight: 650; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex; gap: 10px; align-items: center; font-size: 0.93rem; animation: toast-fade 0.18s ease-out;
  transition: opacity 160ms ease-in, translate 160ms ease-in; }
.toast.leaving { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .toast.leaving { translate: 0 6px; }
}
.toast.error { background: var(--critical); color: #fff; }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
@keyframes toast-in { from { translate: 0 12px; scale: 0.98; opacity: 0; } }
@keyframes toast-fade { from { opacity: 0; } }

.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; background: var(--surface-2); border-radius: 8px; padding: 10px; overflow-x: auto; white-space: pre; }
.loading { opacity: 0.55; transition: opacity 0.2s; }

/* ------------------------------------------------------------------ date fields (issue #45) */

.date-field { position: relative; display: block; }
.date-field input.date-text { width: 100%; padding-right: 44px; }
.date-field .date-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2);
  pointer-events: none; display: grid; }
/* the native input sits invisibly on the icon: tapping it opens the system's date picker */
.date-field input.date-native { position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent; }
.date-field input.date-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.date-field:focus-within .date-icon { color: var(--accent); }
.date-field input.date-text:user-invalid { border-color: var(--critical); }
/* narrow date fields (the receipt lines): a little less room for the icon, so "DD/MM/YYYY" fits at 16 px */
.item-fields .date-field input.date-text { padding-right: 36px; }
.item-fields .date-field .date-icon { right: 9px; }
.item-fields .date-field input.date-native { right: 2px; width: 34px; }

/* ------------------------------------------------------------------ crop the receipt photo (issue #48) */

.crop-offer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; text-align: left; }
.crop-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 18px; }
.crop-dialog .crop-stage { position: relative; margin: 10px auto; touch-action: none; user-select: none;
  background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.crop-canvas { display: block; width: 100%; height: 100%; }
.crop-frame { position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55); outline: 2px solid var(--accent);
  cursor: move; touch-action: none; }
.crop-handle { position: absolute; width: 28px; height: 28px; border: 3px solid var(--accent); background: transparent;
  touch-action: none; }
.crop-handle.nw { left: -4px; top: -4px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.crop-handle.ne { right: -4px; top: -4px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.crop-handle.sw { left: -4px; bottom: -4px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.crop-handle.se { right: -4px; bottom: -4px; border-left: 0; border-top: 0; cursor: nwse-resize; }

/* demo instance (issue #61) */
.demo-banner { padding: 6px 16px; text-align: center; font-size: 0.85rem; font-weight: 600;
  background: color-mix(in srgb, var(--series-fixed) 18%, var(--surface)); color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--series-fixed) 40%, transparent); }

/* model suggestions under a model field (scan page, settings) */
.model-suggest { list-style: none; margin: 4px 0 0; padding: 4px; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  box-shadow: var(--shadow); font-weight: 400; }
.model-suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; min-width: 0; }
.model-suggest li strong { display: block; font-size: 0.9rem; overflow-wrap: anywhere; }
.model-suggest li small { display: block; color: var(--muted); font-size: 0.78rem; }
.model-suggest li:hover, .model-suggest li.active { background: var(--accent-soft); }

/* carry corrections over (issue #74) */
.carry-list, .carry-places { margin: 8px 0; padding-left: 20px; }
.carry-list li { font-weight: 600; overflow-wrap: anywhere; }
.carry-places li { margin: 2px 0; }

/* ------------------------------------------------------------------ phone usability (issue #85) */

/* tap targets: at least 44 px to hit, the controls look as before */
.shop-check { position: relative; }
.shop-check::after { content: ""; position: absolute; inset: -9px; }
.card-head a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px -8px -12px 0; padding: 0 8px; }
.check { min-height: 44px; }
.check input { width: 22px; height: 22px; flex: none; }
.item-top .check { min-height: 0; padding: 11px 11px 11px 0; margin: -11px -11px -11px 0; }
@media (pointer: coarse) {
  .btn.small { min-height: 40px; }
  .segmented button, .segmented a { padding-top: 10px; padding-bottom: 10px; }
  a.small, button.link { display: inline-flex; align-items: center; min-height: 40px; }
}

/* a way to the receipts where the top navigation is hidden */
@media (min-width: 900px) { .phone-only { display: none !important; } }
@media (max-width: 899px) {
  .quick-row { flex-wrap: wrap; gap: 8px; }
  .quick-row .btn { flex: 1 1 0; padding: 0 10px; white-space: nowrap; justify-content: center; }
  .quick-row .muted { flex: 1 0 100%; }
}

/* quick add: the name gets the whole row on narrow screens */
.quick-add .quick-qty { max-width: 72px; flex: none; }
.quick-add .quick-unit { width: auto; flex: none; }
.shop-qty { align-items: flex-end; flex-wrap: nowrap; }
.shop-qty .grow { flex: 1; min-width: 0; }
@media (max-width: 480px) {
  .quick-add { flex-wrap: wrap; }
  .quick-add #add-name { flex: 1 0 100%; }
  .quick-add .quick-qty { max-width: none; flex: 1; }
}

/* dialogs: fit the visible screen, buttons stay in view */
dialog { max-height: calc(100dvh - 24px); scroll-padding-block: 8px calc(var(--dialog-actions-h) + 8px); }
dialog .dialog-actions {
  position: sticky; bottom: 0; background: var(--surface); margin: 4px -18px -18px; padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
}

/* editing a receipt: category, place and date folded away per line */
.item-more { margin-top: 8px; }
.item-more summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; cursor: pointer;
  list-style: none; color: var(--text-2); font-size: 0.88rem; padding: 0 2px;
}
.item-more summary::-webkit-details-marker { display: none; }
.item-more summary .more-text { flex: 1; width: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-more summary svg { flex: none; transition: transform 0.15s; }
.item-more[open] summary svg { transform: rotate(90deg); }
.item-fields.more-fields { grid-template-columns: 1fr; margin-top: 4px; }
@media (min-width: 700px) {
  .item-fields:not(.more-fields) { grid-template-columns: 90px 110px 140px; }
  .item-fields.more-fields { grid-template-columns: minmax(150px, 1.4fr) minmax(130px, 1fr) 150px; }
}

/* ------------------------------------------------------------------ interaction states (issue #88)
   Every control answers a touch: hover (only with a real pointer), press and keyboard focus look
   different and can be combined. Colours change always; the small press-in scale only when the
   device does not ask for reduced motion. */

:where(a, button, input, select, textarea, summary, label, [tabindex]) { -webkit-tap-highlight-color: transparent; }
:where(a, button, summary, label, input, select, [role="button"]) { touch-action: manipulation; }   /* no double-tap zoom delay */

:where(.btn, .icon-btn, .chip, .pick, .choice-chip span, .icon-choice span, .segmented button, .segmented a, .look-tile,
  .swatch, .icon-choices button, .net-badge, .shop-check, .cta, .finance-card, .last-bought, .history-line, .topnav a) {
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out,
    box-shadow 150ms ease-out, scale 150ms ease-out, opacity 150ms ease-out;
}

/* pressed */
.btn:active:not(:disabled) { background: var(--surface-3); }
.btn.primary:active:not(:disabled) { background: var(--accent-hover); }
.btn.ghost:active:not(:disabled), .icon-btn:active { background: var(--surface-3); color: var(--text); }
.chip:active, .pick:active, .segmented button:active, .segmented a:active, .topnav a:active,
.icon-choices button:active, .net-badge:active { background: var(--surface-3); color: var(--text); }
.chip.active:active, .segmented button.active:active, .segmented a.active:active { background: color-mix(in srgb, var(--text) 85%, var(--bg)); color: var(--bg); }
.choice-chip:active span, .icon-choice:active span { background: var(--surface-2); }
.shop-check:active { border-color: var(--accent); }
.tabbar a:active { color: var(--text); }
.tabbar a:active svg { background: var(--surface-3); }
.tabbar a.active:active svg { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }
.cta:active, .finance-card:active, .last-bought:active { box-shadow: none; }
.cta:active { background: var(--accent-hover); }
/* tappable rows: a soft highlight that reaches a little past the text */
:is(button.list-item, a.list-item, .inv-main, .goal-title, .cat-budget-title, .shop-name[data-edit="true"]):active {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--text) 6%, transparent); border-radius: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  .btn:active:not(:disabled), .chip:active, .pick:active, .segmented button:active, .segmented a:active,
  .look-tile:active, .swatch:active, .icon-choices button:active, .net-badge:active, .choice-chip:active span,
  .icon-choice:active span { scale: 0.96; }
  .icon-btn:active, .shop-check:active { scale: 0.9; }
  .tabbar a:active svg { scale: 0.92; }
  .tabbar .tab-capture:active .capture-bubble { scale: 0.9; }
  .cta:active, .finance-card:active, .last-bought:active { scale: 0.985; }
}

/* hover, only with a real pointer */
@media (hover: hover) {
  .cta:hover, .finance-card:hover, .last-bought:hover { box-shadow: 0 2px 4px rgb(0 0 0 / 0.06), 0 10px 26px rgb(0 0 0 / 0.1); }
  .pick:hover, .choice-chip:hover span, .icon-choice:hover span { border-color: var(--border-strong); color: var(--text); }
  .segmented button:not(.active):hover, .segmented a:not(.active):hover { color: var(--text); }
  .tabbar a:hover { color: var(--text); }
  .look-tile:hover, .swatch:hover { border-color: var(--accent); }
  .tabbar .tab-capture:hover .capture-bubble { box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 50%, transparent); }
}

/* keyboard focus: a clear ring with room around it */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible { outline-offset: 3px; }
.tabbar a:focus-visible, .tabbar .tab-capture:focus-visible { outline-offset: -4px; border-radius: 22px; }

/* ------------------------------------------------------------------ dialogs (issue #88)
   Native <dialog> + showModal(). On the phone a dialog is a sheet at the bottom, within reach of the
   thumb. It fades and slides in and out (@starting-style, allow-discrete, overlay); where a browser
   cannot animate the exit of the top layer, js/ui.js sets [data-closing] and waits for the
   transition. With reduced motion it only fades. */

dialog:modal { overscroll-behavior: contain; }   /* scrolling in the dialog does not move the page behind */
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }

dialog {
  opacity: 0;
  transition-property: opacity, translate, scale, display, overlay;
  transition-duration: 180ms;
  transition-timing-function: ease-in;
  transition-behavior: allow-discrete;
}
:is(dialog[open]):where(:not([data-closing])) {
  opacity: 1;
  transition-duration: 280ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  @starting-style { opacity: 0; }
}
dialog::backdrop {
  background-color: rgb(10 10 8 / 0);
  transition-property: background-color, display, overlay;
  transition-duration: 220ms;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}
:is(dialog[open]):where(:not([data-closing]))::backdrop {
  background-color: rgb(10 10 8 / 0.45);
  @starting-style { background-color: rgb(10 10 8 / 0); }
}

@media (prefers-reduced-motion: no-preference) {
  dialog { scale: 0.96; }
  :is(dialog[open]):where(:not([data-closing])) {
    scale: 1;
    @starting-style { scale: 0.96; }
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog, dialog::backdrop { transition-duration: 120ms; }
}

/* phone: a bottom sheet */
@media (max-width: 599px) {
  dialog:modal {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 28px 28px 0 0; border-bottom: 0;
    max-height: calc(100dvh - 12px - env(safe-area-inset-top, 0px));
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.22);
  }
  dialog:modal .dialog-actions { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  dialog:modal { scroll-padding-bottom: calc(var(--dialog-actions-h) + env(safe-area-inset-bottom, 0px) + 8px); }
  @media (prefers-reduced-motion: no-preference) {
    dialog { scale: 1; translate: 0 100%; }
    :is(dialog[open]):where(:not([data-closing])) {
      scale: 1; translate: 0 0;
      transition-duration: 320ms;
      @starting-style { scale: 1; translate: 0 100%; }
    }
  }
}

/* ------------------------------------------------------------------ playful layout (issue #105)
   Flat + bento (ui-ux-pro-max design system): soft tiles in the colour of their area, chunky corners,
   rounded heavy type, one-tap capture. Areas: home, pantry, shop, todo, money, receipt, settings – set on
   <body> by the router (page header) and on single tiles (overview, capture sheet). The symbols are masks,
   drawn in the area's colour; they are pictures only, never the only label. */

[data-area="home"] { --area-tint: var(--tint-money); --area-pop: var(--pop-money); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5.5 9v11h13V9'/%3E%3Cpath d='M9.5 20v-5.5h5V20'/%3E%3C/svg%3E"); }
[data-area="pantry"] { --area-tint: var(--tint-pantry); --area-pop: var(--pop-pantry); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M4 10h16'/%3E%3Cpath d='M8 6.5v1M8 13v3'/%3E%3C/svg%3E"); }
[data-area="shop"] { --area-tint: var(--tint-shop); --area-pop: var(--pop-shop); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.5'/%3E%3Ccircle cx='18' cy='20' r='1.5'/%3E%3Cpath d='M2.5 3h2.5l2.4 12.2a1.5 1.5 0 0 0 1.5 1.3h9.3a1.5 1.5 0 0 0 1.5-1.2L21 7H6'/%3E%3C/svg%3E"); }
[data-area="todo"] { --area-tint: var(--tint-todo); --area-pop: var(--pop-todo); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='17' height='17' rx='4'/%3E%3Cpath d='m8 12.5 3 3 5-6'/%3E%3C/svg%3E"); }
[data-area="money"] { --area-tint: var(--tint-money); --area-pop: var(--pop-money); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7z'/%3E%3Cpath d='M4 7l11-3.5V7'/%3E%3Cpath d='M20 12h-4a1.5 1.5 0 0 0 0 3h4'/%3E%3C/svg%3E"); }
[data-area="receipt"] { --area-tint: var(--tint-receipt); --area-pop: var(--pop-receipt); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-3-2-3 2-3-2-3 2z'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h4'/%3E%3C/svg%3E"); }
[data-area="settings"] { --area-tint: var(--surface-2); --area-pop: var(--text-2); --area-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1'/%3E%3C/svg%3E"); }

/* greeting */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.hello h1 { font-size: 2rem; line-height: 1.1; }
.hello-date { color: var(--text-2); font-weight: 750; font-size: 0.95rem; margin-bottom: 2px; }
.hello-mark {
  flex: none; width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; font-size: 1.9rem;
  background: var(--tint-pantry); border: 1px solid var(--border);
}

/* the samovar pours a coffee when tapped: it grows a little, a stream runs from the tap, the cup fills, steam rises */
button.hello-mark { padding: 0; color: var(--text-2); cursor: pointer; position: relative; z-index: 2;
  transform-origin: 100% 30%; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); -webkit-tap-highlight-color: transparent; }
.samovar-art { position: relative; display: block; width: 44px; height: 44px; }
.pour { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; }
.pour .cup, .pour .coffee, .pour .stream, .pour .steam path { transform-box: fill-box; }
.pouring .pour { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  button.hello-mark:active { transform: scale(0.94); }
  button.hello-mark.pouring { transform: scale(1.7); }
  .pouring .pour .cup { animation: cup-in 3.6s ease both; }
  .pouring .pour .stream { transform-origin: 50% 0; animation: stream 3.6s ease-in-out both; }
  .pouring .pour .coffee { transform-origin: 50% 100%; animation: fill 3.6s ease-in-out both; }
  .pouring .pour .steam path { transform-origin: 50% 100%; animation: steam 3.6s ease-out both; }
  .pouring .pour .steam path:nth-child(2) { animation-delay: 0.25s; }
  .pouring .pour .steam path:nth-child(3) { animation-delay: 0.5s; }
}
@media (prefers-reduced-motion: reduce) {
  .pour .stream { display: none; }
  .pouring .pour { animation: fade-pour 1.6s ease both; }
  .pour .steam path { opacity: 0.6; }
}
@keyframes cup-in { 0% { opacity: 0; transform: translateY(14px); } 10%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes stream { 0%, 12% { transform: scaleY(0); opacity: 1; } 22%, 58% { transform: scaleY(1); opacity: 1; }
  66% { transform: scaleY(1) translateY(30%); opacity: 0; } 100% { opacity: 0; } }
@keyframes fill { 0%, 18% { transform: scaleY(0); } 62%, 100% { transform: scaleY(0.82); } }
@keyframes steam { 0%, 50% { opacity: 0; transform: translateY(8px) scaleY(0.6); } 66% { opacity: 0.9; }
  92%, 100% { opacity: 0; transform: translateY(-46px) scaleY(1.1); } }
@keyframes fade-pour { 0% { opacity: 0; } 20%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* the bento: one column on the phone, a grid from tablet width */
.bento { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.bento > section.tile { align-self: start; }
@media (min-width: 760px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .bento > .tile-hero { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .bento { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tile {
  display: block; min-width: 0; padding: 18px; border-radius: var(--radius); color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 36px; }
.tile-head h2 { flex: 1; min-width: 0; font-size: 1.12rem; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; overflow-wrap: break-word; }
.tile-icon {
  flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--area-tint); color: var(--area-pop);
}
.tile-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px;
  background: var(--area-tint); color: var(--text); font-size: 0.85rem; font-weight: 850; font-family: var(--font-body);
}
.tile-link {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -4px -6px -4px 0;
  color: var(--text-2); text-decoration: none; border-radius: 14px;
}
.tile-kicker { flex: 1; min-width: 0; font-weight: 800; color: var(--text-2); }
.tile-line { color: var(--text-2); font-weight: 650; margin: 4px 0 14px; }
.tile-list { display: flex; flex-direction: column; }
.tile-list .shop-item, .tile-list .list-item { padding: 9px 0; }
.tile-list .shop-item:first-child, .tile-list .list-item:first-child { padding-top: 2px; }
.tile-more { display: inline-flex; align-items: center; min-height: 40px; margin-top: 2px; color: var(--text-2); font-weight: 750; font-size: 0.9rem; }
.tile-empty { display: flex; gap: 12px; align-items: center; padding: 6px 0 2px; }
.tile-empty > span { font-size: 1.8rem; flex: none; }
.tile-empty strong { display: block; }
.tile-empty div > span { color: var(--text-2); font-size: 0.92rem; }
.small-emoji { font-size: 1.15rem; width: 26px; }
@media (max-width: 374px) {   /* small phones: the tile titles keep one line */
  .tile { padding: 16px 14px; }
  .tile-head { gap: 8px; }
  .tile-icon { width: 32px; height: 32px; border-radius: 11px; }
}
.todo-flag { font-size: 0.95em; }

/* the month's money: the big tile, filled with the money colour */
.tile-hero { background: var(--tint-money); border-color: transparent; position: relative; overflow: hidden; isolation: isolate; }
.tile-hero > * { position: relative; z-index: 1; }
.tile-hero .tile-icon { background: var(--surface); }
.tile-hero .hero { font-size: 3rem; }
.tile-hero .tile-line { margin-bottom: 16px; }
.tile-hero .splitbar { height: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.tile-hero .legend { color: var(--text); }
.tile-hero::after {   /* a playful blob in the corner */
  content: ""; position: absolute; right: -44px; bottom: -64px; width: 150px; height: 150px; border-radius: 50%;
  background: var(--pop-money); opacity: 0.1; pointer-events: none;
}
.meter.big { height: 16px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.meter.big > span { background: var(--pop-money); }
.meter.big.warn > span { background: var(--warning); }
.meter.big.over > span { background: var(--critical); }

/* one-tap capture: four tiles in the sheet of the dock's "+" */
.capture-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-bottom: 6px; }
.capture-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-width: 0;
  min-height: 132px; padding: 16px; border-radius: 20px; border: 0; cursor: pointer; font: inherit; color: var(--text);
  background: var(--area-tint); text-align: left;
}
.capture-icon {
  width: 48px; height: 48px; margin-bottom: 6px; border-radius: 14px; display: grid; place-items: center;
  background: var(--area-pop); color: var(--bg);
}
.capture-label { font-weight: 800; font-size: 1.05rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capture-hint { font-size: 0.82rem; color: var(--text-2); font-weight: 600; }
dialog:has(.capture-grid) form { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }

/* ticking an entry on the overview: the box pops, the row fades away */
.shop-item.ticked .shop-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.shop-item.ticked .title { text-decoration: line-through; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .shop-item.ticked .shop-check { animation: tick-pop 260ms var(--ease-pop); }
  .shop-item.ticked { animation: tick-away 260ms 120ms ease-in both; }
  @keyframes tick-pop { 0% { scale: 0.7; } 60% { scale: 1.18; } 100% { scale: 1; } }
  @keyframes tick-away { to { opacity: 0.35; } }
  /* the tiles rise in one after the other when the overview opens (motion dial 4: stagger) */
  .bento.entering > * { animation: tile-in 420ms var(--ease-pop) both; }
  .bento.entering > :nth-child(2) { animation-delay: 40ms; }
  .bento.entering > :nth-child(3) { animation-delay: 80ms; }
  .bento.entering > :nth-child(4) { animation-delay: 120ms; }
  .bento.entering > :nth-child(5) { animation-delay: 160ms; }
  .bento.entering > :nth-child(6) { animation-delay: 200ms; }
  @keyframes tile-in { from { opacity: 0; translate: 0 14px; scale: 0.98; } }
}

/* pressed and hover for the new tiles (see "interaction states" above) */
:where(.tile, .capture-tile, .tile-link) {
  transition: background-color 150ms ease-out, box-shadow 150ms ease-out, scale 150ms ease-out, color 150ms ease-out;
}
a.tile:active { box-shadow: none; }
.capture-tile:active { background: color-mix(in srgb, var(--area-pop) 22%, var(--area-tint)); }
.tile-link:active { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  a.tile:active { scale: 0.985; }
  .capture-tile:active { scale: 0.95; }
}
@media (hover: hover) {
  a.tile:hover { box-shadow: 0 2px 4px rgb(0 0 0 / 0.05), 0 12px 28px rgb(0 0 0 / 0.08); }
  .capture-tile:hover { background: color-mix(in srgb, var(--area-pop) 14%, var(--area-tint)); }
  .tile-link:hover { color: var(--text); }
}
.capture-tile:focus-visible { outline-offset: 3px; }

/* the other pages in the same language: the money figure of the finance page as a tile */
.card.budget-hero { background: var(--tint-money); border-color: transparent; }
.kpi .value { font-family: var(--font-head); }
.dropzone { border-radius: var(--radius); border-width: 2.5px; background: var(--area-tint, var(--surface)); }
.dropzone .big-icon { background: var(--area-pop, var(--accent)); color: var(--bg); border-radius: 22px; }

/* tap targets in the playful layout: at least 40 px on touch screens, most of them 44 px (pro-rules) */
@media (pointer: coarse) {
  .chip, .pick { min-height: 40px; }
  .swatch { width: 40px; height: 40px; }
  .goal-title, .cat-budget-title, .segmented button, .segmented a, summary { min-height: 40px; }
  .brand { min-height: 44px; }
}

/* The receipt line a pantry item came from (issue #125): marked when the receipt opens from the pantry */
.list-item.landing { background: var(--accent-soft); border-radius: var(--radius-sm); margin-inline: -8px; padding-inline: 8px; outline: none; }
.list-item.landing:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (prefers-reduced-motion: no-preference) {
  .list-item.landing { animation: landing 2.4s ease-out 0.3s both; }
  @keyframes landing { from { background: var(--accent-soft); } 70% { background: var(--accent-soft); } to { background: transparent; } }
}

/* sign-in, setup and links with a code (issue #134): no app navigation while signed out */
body.signed-out .topnav, body.signed-out .tabbar, body.signed-out .topbar .icon-btn,
body.signed-out .topbar #scan-top, body.signed-out .net-badge { display: none !important; }
.auth-wrap { max-width: 440px; margin: 0 auto; }
.auth-card details summary { cursor: pointer; }
/* folded sections (recognised text and photo of a receipt, sign-in help): a taller tap target, same look */
details.card > summary, .auth-card details > summary { padding-block: 10px; margin-block: -10px; }
.share-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

/* ------------------------------------------------------------------ games (optional module app/games, issue #135)
   Two kinds of disc that differ in colour and shape: player 1 a full disc in the accent colour, player 2 a ring
   with a dot in the second series colour – so the board reads without colour too. */
.games-entry { position: relative; }
.games-entry.has-dot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--critical, #d64545); box-shadow: 0 0 0 2px var(--bg); }
/* new in the pantry (issue #144) */
.pantry-notice { max-width: 1120px; margin: 0 auto; padding: 14px 16px 0; }
.pantry-new { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px;
  border-color: color-mix(in srgb, var(--good) 40%, var(--border)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.pantry-new-head { display: flex; align-items: center; gap: 12px; align-self: stretch; }
.pantry-new-head strong { flex: 1; min-width: 0; }
.pantry-new-lines { list-style: none; margin: 0; padding: 0 0 0 48px; display: flex; flex-direction: column; gap: 2px; }
.pantry-new > .btn { margin-left: 48px; }
.tag-new {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--text);
}
.pantry-origin { display: flex; flex-direction: column; gap: 4px; }
.games-notice { max-width: 1120px; margin: 0 auto; padding: 14px 16px 0; }
.games-turn { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 14px 16px; }
.games-turn .grow { display: flex; flex-direction: column; gap: 2px; }
.disc-mini { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -3px; flex: none; }
.disc-1, .disc-mini.disc-1 { background: var(--accent); }
.disc-2, .disc-mini.disc-2 { background: radial-gradient(circle, var(--series-fixed) 0 22%, transparent 23% 46%, var(--series-fixed) 47%); }
.disc-mini.ghost { opacity: 0.25; }
.four-card { max-width: 520px; margin: 0 auto; }
.four-legend { display: flex; gap: 18px; justify-content: center; color: var(--text-2); }
.four-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.four-status { text-align: center; font-weight: 700; min-height: 1.5em; margin: 0; }
.four-columns { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 0 8px; }
.four-col { min-height: 44px; border-radius: 12px; border: 1.5px solid transparent; background: transparent; cursor: pointer;
  display: grid; place-items: center; }
.four-col.chosen { border-color: var(--accent); background: var(--accent-soft); }
.four-col:disabled { cursor: default; opacity: 0.35; }
@media (hover: hover) { .four-col:not(:disabled):hover .disc-mini.ghost { opacity: 0.6; } }
.four-board { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; padding: 4px;
  background: var(--surface-2); border-radius: var(--radius-sm); }
.four-board td { padding: 0; }
.four-board.playable td { cursor: pointer; }
.four-board .disc { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; }
.four-board .disc.hole { background: var(--bg); box-shadow: inset 0 2px 4px color-mix(in srgb, #000 18%, transparent); }
.four-board .disc.last { outline: 2px dashed var(--text-2); outline-offset: 1px; }
.four-board .disc.win { outline: 3px solid var(--text); outline-offset: 1px; }
@media (prefers-reduced-motion: no-preference) {
  /* falls from above the board, as many cells as it really falls (fall-1 = top row … fall-6 = bottom row) */
  .four-board .disc.drop { --fall: 1; animation: four-drop calc(220ms + var(--fall) * 45ms) cubic-bezier(0.45, 0, 0.6, 1.25); }
  .four-board .disc.fall-2 { --fall: 2; } .four-board .disc.fall-3 { --fall: 3; }
  .four-board .disc.fall-4 { --fall: 4; } .four-board .disc.fall-5 { --fall: 5; } .four-board .disc.fall-6 { --fall: 6; }
  @keyframes four-drop { from { transform: translateY(calc(var(--fall) * -1 * (100% + 4px))); } to { transform: none; } }
}

/* End of a match (issue #141). games.js adds .end-full or .end-reduced (from motionLevel(), so a "motion" setting
   can switch it off) plus .end-win / .end-loss / .end-draw to .four-card for about 2 s, then only .ended-loss
   stays as the calm end state. Only transform and opacity move; nothing loops or takes clicks. */
#four-board { position: relative; }
.four-board .disc.win { position: relative; }
.four-board .disc.win::after { content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 3px solid var(--accent); opacity: 0; pointer-events: none; }
.four-card.ended-loss .four-board .disc:not(.win):not(.hole),
.four-card.end-loss .four-board .disc:not(.win):not(.hole) { opacity: 0.5; }

/* win: the four light up one after another, then a short burst */
.four-board .win-1 { --i: 1; } .four-board .win-2 { --i: 2; } .four-board .win-3 { --i: 3; }
/* after the last disc has landed (--land), 140 ms apart */
.four-card.end-full { --land: 400ms; }
.four-card.end-full.end-win .four-board .disc.win {
  animation: four-pop 420ms cubic-bezier(0.3, 0, 0.3, 1.5) calc(var(--land) + var(--i, 0) * 140ms) both; }
.four-card.end-full.end-win .four-board .disc.win.drop {   /* the winning move itself: first fall, then pop */
  animation: four-drop calc(220ms + var(--fall) * 45ms) cubic-bezier(0.45, 0, 0.6, 1.25),
             four-pop 420ms cubic-bezier(0.3, 0, 0.3, 1.5) calc(var(--land) + var(--i, 0) * 140ms) both; }
.four-card.end-full.end-win .four-board .disc.win::after { animation: four-ring 700ms ease-out calc(var(--land) + var(--i, 0) * 140ms) both; }
.four-card.end-full .four-status { animation: four-status 500ms ease-out both; }
.four-card.end-full.end-win .four-status { animation-delay: var(--land); }
@keyframes four-pop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes four-ring { 0% { opacity: 0.9; transform: scale(0.85); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes four-status { from { opacity: 0; transform: translateY(6px) scale(0.96); } to { opacity: 1; transform: none; } }

.four-burst { position: absolute; left: 50%; top: 45%; width: 0; height: 0; pointer-events: none; }   /* games.js moves it to the line */
/* in the winner's own disc colour: full dots and rings, like the two kinds of disc */
.four-burst { --dot: var(--accent); }
.four-burst.burst-2 { --dot: var(--series-fixed); }
.four-burst i { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--dot); opacity: 0; --x: 0; --y: -1; --d: 120px;
  animation: four-burst 950ms cubic-bezier(0.2, 0.7, 0.3, 1) 1000ms both; }   /* after --land and the four */
.four-burst i:nth-child(even) { background: transparent; border: 3px solid var(--dot); --d: 85px; }
.four-burst i:nth-child(1) { --x: 0; --y: -1; } .four-burst i:nth-child(2) { --x: 0.5; --y: -0.866; } .four-burst i:nth-child(3) { --x: 0.866; --y: -0.5; }
.four-burst i:nth-child(4) { --x: 1; --y: 0; } .four-burst i:nth-child(5) { --x: 0.866; --y: 0.5; } .four-burst i:nth-child(6) { --x: 0.5; --y: 0.866; }
.four-burst i:nth-child(7) { --x: 0; --y: 1; } .four-burst i:nth-child(8) { --x: -0.5; --y: 0.866; } .four-burst i:nth-child(9) { --x: -0.866; --y: 0.5; }
.four-burst i:nth-child(10) { --x: -1; --y: 0; } .four-burst i:nth-child(11) { --x: -0.866; --y: -0.5; } .four-burst i:nth-child(12) { --x: -0.5; --y: -0.866; }
@keyframes four-burst {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  12%, 55% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--x) * var(--d)), calc(var(--y) * var(--d))) scale(1); }
}

/* loss: friendly; the winning line shows once, calmly, and the other discs dim gently */
.four-card.end-full.end-loss .four-board .disc:not(.win):not(.hole) { animation: four-dim 1200ms ease-out both; }
.four-card.end-full.end-loss .four-board .disc.win::after { border-color: var(--text-2); animation: four-calm 1600ms ease-in-out var(--land) both; }
@keyframes four-dim { from { opacity: 1; } to { opacity: 0.5; } }
@keyframes four-calm { 0% { opacity: 0; transform: scale(1.1); } 40% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* draw: a quiet breath of the board */
.four-card.end-full.end-draw .four-board { animation: four-breath 1400ms ease-in-out both; }
@keyframes four-breath { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* reduced motion: only a short fade of the result (and the loss dimming) */
.four-card.end-reduced .four-status { animation: four-fade 300ms ease-out both; }
.four-card.end-reduced.end-loss .four-board .disc:not(.win):not(.hole) { animation: four-dim 300ms ease-out both; }
@keyframes four-fade { from { opacity: 0; } to { opacity: 1; } }

/* shopping list estimate (issue #153) */
.nowrap { white-space: nowrap; }

/* passkeys (issue #181) */
.auth-or { text-align: center; margin: 0; }
.recovery-key { columns: 2; column-gap: 24px; padding-left: 1.8em; margin: 0; font-variant-numeric: tabular-nums; user-select: all; }
.recovery-key li { padding: 3px 0; }
.recovery-key code { font-size: 1rem; letter-spacing: 0.02em; }
#recovery-form textarea { min-height: 0; font-family: inherit; }
#recovery-box summary { cursor: pointer; font-weight: 600; }
