/* The app's components: the rail, the page, the boxes, tables, bars, forms, the phone. What was
   base.html's <style> until the skins came; the tokens it uses are themes.css. */
  :root[data-theme="slave"] .rail::after { background-image: var(--rail-art); }
  :root[data-theme="slave"] details.free-bar:not([open]) > summary, :root[data-theme="slave"] .page-head { padding-bottom: 24px; }
  @media (max-width: 620px) {
    /* the rail is the phone's top bar: the ball at its right end, the chain's last link sprung */
    :root[data-theme="slave"] body .rail { position: relative; }
    :root[data-theme="slave"] body .rail::after { display: block; background-image: var(--ball); left: auto; right: 14px; top: 50%; bottom: auto;
      width: 64px; height: 34px; transform: translateY(-50%); opacity: .95; }
    /* the chalk marks get a line of their own under the date's figures */
    :root[data-theme="slave"] { --hero-art-size: 230px 30px; }
    :root[data-theme="slave"] .free-body { padding-bottom: 58px; }
  }

  /* what every theme dresses: the rail, the page's backdrop, the rounder boxes */
  :root[data-theme] .rail { background: var(--rail-bg); border-right-color: var(--rail-border); color: var(--rail-ink); }
  :root[data-theme] .rail-word { color: var(--rail-ink); }
  :root[data-theme] .rail-nav a { color: var(--rail-ink-2); }
  :root[data-theme] .rail-nav .ic { color: var(--rail-ink-3); }
  :root[data-theme] .rail-nav a:hover { background: var(--rail-hover); color: var(--rail-ink); }
  :root[data-theme] .rail-nav a.active { background: var(--rail-active); color: var(--rail-active-ink); }
  :root[data-theme] .rail-nav a.active .ic { color: var(--rail-active-ink); }
  :root[data-theme] .rail-collapse-btn, :root[data-theme] .rail-foot, :root[data-theme] .rail-foot a { color: var(--rail-ink-3); }
  :root[data-theme] .rail-collapse-btn:hover { background: var(--rail-hover); color: var(--rail-ink); }
  /* the ledger's ruling is Classic's; a theme's picture stands under the date, not the page */
  :root[data-theme] body { background-image: none; }
  :root[data-theme="aurora"] body { background-image: var(--page-art), var(--page-dots);
    background-size: 100% 100%, 100% 100%, 46px 46px; background-attachment: fixed; }

  /* a little picture in the rail's empty lower part */
  :root[data-theme] .rail::after { content: ""; position: absolute; left: 0; right: 0; bottom: 132px; height: 190px;
    background-repeat: no-repeat; background-position: center bottom; background-size: contain; pointer-events: none; opacity: .6; }
  :root[data-theme] .rail-top, :root[data-theme] .rail-nav, :root[data-theme] .rail-foot { position: relative; z-index: 1; }
  :root[data-theme="holiday"] .rail::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 194 190'%3E%3Ccircle cx='132' cy='64' r='26' fill='%23f6c46a' fill-opacity='.85'/%3E%3Cpath d='M0 150 C 30 138 60 162 97 150 S 160 138 194 150 V190 H0Z' fill='%230e7490' fill-opacity='.55'/%3E%3Cpath d='M0 164 C 34 154 64 176 100 164 S 164 154 194 166 V190 H0Z' fill='%2345c6d6' fill-opacity='.45'/%3E%3Cpath d='M58 152 C 62 120 64 96 72 70' stroke='%23c79a63' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3Cg fill='%233f7d4f' fill-opacity='.9'%3E%3Cpath d='M72 70 C 52 58 34 62 22 74 C 40 70 56 72 72 70Z'/%3E%3Cpath d='M72 70 C 88 54 108 54 120 64 C 102 64 88 66 72 70Z'/%3E%3Cpath d='M72 70 C 62 50 64 36 74 26 C 74 44 74 56 72 70Z'/%3E%3Cpath d='M72 70 C 52 76 42 92 42 104 C 52 90 62 80 72 70Z'/%3E%3Cpath d='M72 70 C 92 74 104 88 106 100 C 94 88 84 78 72 70Z'/%3E%3C/g%3E%3C/svg%3E");
  }
  :root[data-theme="bamboo"] .rail::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 194 190'%3E%3Cpath d='M150 190 C 146 130 136 80 118 20' stroke='%236f8f2a' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3Cg fill='%233e8a2f'%3E%3Cpath fill-opacity='.85' d='M122 40 C 92 30 60 38 40 58 C 72 54 98 50 122 40Z'/%3E%3Cpath fill-opacity='.7' d='M128 62 C 104 72 84 94 76 120 C 100 102 116 84 128 62Z'/%3E%3Cpath fill-opacity='.8' d='M136 92 C 164 84 184 96 192 116 C 166 106 150 100 136 92Z'/%3E%3Cpath fill-opacity='.65' d='M140 120 C 112 124 88 142 78 166 C 106 150 124 138 140 120Z'/%3E%3Cpath fill-opacity='.75' d='M126 50 C 150 36 176 38 190 54 C 166 52 146 52 126 50Z'/%3E%3C/g%3E%3Cpath d='M122 40 Q 80 44 40 58 M128 62 Q 96 88 76 120 M136 92 Q 166 98 192 116 M140 120 Q 104 138 78 166 M126 50 Q 160 46 190 54' stroke='%23d9f0b8' stroke-opacity='.55' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
  }
  :root[data-theme="fjord"] .rail::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 194 190'%3E%3Cpath d='M0 150 L34 92 L52 112 L84 58 L112 104 L128 86 L168 138 L194 120 V190 H0Z' fill='%23aac3d2' fill-opacity='.55'/%3E%3Cpath d='M84 58 L96 78 L88 76 L80 84 L72 78Z M34 92 L42 106 L34 104 L28 108Z M128 86 L138 100 L128 98 L122 102Z' fill='%23ffffff' fill-opacity='.9'/%3E%3Cpath d='M0 150 H194 V190 H0Z' fill='%235fb7d6' fill-opacity='.45'/%3E%3Cpath d='M0 158 C 40 154 60 162 100 158 S 160 154 194 160' stroke='%23d6ebf2' stroke-opacity='.5' fill='none'/%3E%3Cg transform='translate(132 128)'%3E%3Crect x='0' y='8' width='26' height='16' fill='%23b8412f'/%3E%3Cpath d='M-3 9 L13 -3 L29 9Z' fill='%23eef5f9'/%3E%3Crect x='10' y='14' width='6' height='10' fill='%23ffffff' fill-opacity='.85'/%3E%3C/g%3E%3Cg fill='%23143a2a' fill-opacity='.9'%3E%3Cpath d='M22 150 L30 128 L38 150Z'/%3E%3Cpath d='M36 150 L44 122 L52 150Z'/%3E%3Cpath d='M170 150 L177 131 L184 150Z'/%3E%3C/g%3E%3C/svg%3E");
  }
  :root[data-theme="autumn"] .rail::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 194 190'%3E%3Cpath d='M0 40 C 60 50 110 44 194 20' stroke='%23d3a47a' stroke-width='4' fill='none' stroke-linecap='round'/%3E%3Cg fill='%23f0a04b'%3E%3Cpath transform='translate(70 60) rotate(10) scale(.9)' d='M0 -26 L5 -15 L13 -19 L11 -9 L23 -11 L17 -1 L25 5 L11 7 L13 17 L4 12 L1 22 L1 34 L-1 34 L-1 22 L-4 12 L-13 17 L-11 7 L-25 5 L-17 -1 L-23 -11 L-11 -9 L-13 -19 L-5 -15Z'/%3E%3C/g%3E%3Cpath transform='translate(140 52) rotate(-15) scale(.8)' d='M0 -26 L5 -15 L13 -19 L11 -9 L23 -11 L17 -1 L25 5 L11 7 L13 17 L4 12 L1 22 L1 34 L-1 34 L-1 22 L-4 12 L-13 17 L-11 7 L-25 5 L-17 -1 L-23 -11 L-11 -9 L-13 -19 L-5 -15Z' fill='%23e0572b'/%3E%3Cpath transform='translate(110 110) rotate(35) scale(.75)' d='M0 -26 L5 -15 L13 -19 L11 -9 L23 -11 L17 -1 L25 5 L11 7 L13 17 L4 12 L1 22 L1 34 L-1 34 L-1 22 L-4 12 L-13 17 L-11 7 L-25 5 L-17 -1 L-23 -11 L-11 -9 L-13 -19 L-5 -15Z' fill='%23f2c14e' fill-opacity='.95'/%3E%3Cpath transform='translate(48 150) rotate(-40) scale(.7)' d='M0 -26 L5 -15 L13 -19 L11 -9 L23 -11 L17 -1 L25 5 L11 7 L13 17 L4 12 L1 22 L1 34 L-1 34 L-1 22 L-4 12 L-13 17 L-11 7 L-25 5 L-17 -1 L-23 -11 L-11 -9 L-13 -19 L-5 -15Z' fill='%23c8401e' fill-opacity='.9'/%3E%3Cpath transform='translate(150 168) rotate(70) scale(.6)' d='M0 -26 L5 -15 L13 -19 L11 -9 L23 -11 L17 -1 L25 5 L11 7 L13 17 L4 12 L1 22 L1 34 L-1 34 L-1 22 L-4 12 L-13 17 L-11 7 L-25 5 L-17 -1 L-23 -11 L-11 -9 L-13 -19 L-5 -15Z' fill='%23f0a04b' fill-opacity='.85'/%3E%3C/svg%3E");
  }
  :root[data-theme="aurora"] .rail::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 194 190'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%235ee3b1' stop-opacity='0'/%3E%3Cstop offset='.5' stop-color='%235ee3b1' stop-opacity='.7'/%3E%3Cstop offset='1' stop-color='%238b6cff' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M-10 70 C 30 20 70 110 110 50 S 170 30 204 60 L204 120 C 160 100 130 150 90 110 S 20 130 -10 120Z' fill='url(%23a)'/%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='20' cy='20' r='1.2'/%3E%3Ccircle cx='60' cy='12' r='.9'/%3E%3Ccircle cx='150' cy='18' r='1.3'/%3E%3Ccircle cx='178' cy='40' r='.8'/%3E%3Ccircle cx='100' cy='28' r='.8'/%3E%3Ccircle cx='36' cy='52' r='.7'/%3E%3C/g%3E%3Cpath d='M0 190 V160 L30 138 L58 156 L96 124 L130 150 L160 134 L194 152 V190Z' fill='%23050a14'/%3E%3C/svg%3E");
  }
  .rail.collapsed::after { display: none; }
  @media (max-width: 620px) { :root[data-theme] .rail::after { display: none; } }

  /* the picker */
  .theme-pick { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 12.5px; }
  .theme-pick select { font: inherit; font-size: 12.5px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink); }
  :root[data-theme] .rail .theme-pick { color: var(--rail-ink-2); }
  :root[data-theme] .rail .theme-pick select { background: rgba(255,255,255,.14); color: var(--rail-ink); border-color: var(--rail-ink-3); }
  :root[data-theme] .theme-pick select option { color: #222; background: #fff; }

  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body {
    background: var(--bg); color: var(--ink);
    font-family: var(--font-body);
    font-size: 14.5px; line-height: 1.55; display: flex; min-height: 100vh;
    /* Faint ledger ruling, fixed so it doesn't slide against the content. */
    background-image: repeating-linear-gradient(var(--rule) 0 1px, transparent 1px 40px);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
  }
  a { color: var(--accent); }
  ::selection { background: var(--accent-tint); color: var(--accent-strong); }
  /* where the keyboard is, always shown: !important, because a button stripped with "all: unset"
     (the sidebar's collapse button, the link-like buttons) lost its ring to that rule */
  :focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 2px; }
  main:focus, main:focus-visible { outline: none !important; }  /* the skip link's target: where reading goes on, not a control */
  /* past the menu to the page, for a keyboard: out of sight until it has the focus (WCAG 2.4.1) */
  .skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; padding: 10px 14px; border-radius: 8px;
               background: var(--surface); color: var(--ink); border: 2px solid var(--accent); font-weight: 600; }
  .skip-link:focus { top: 8px; }
  /* said to a screen reader, not shown: a page's heading where the page shows a figure instead */
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
             clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
  /* figures that stand under each other keep one width a digit */
  .kv .v, .stat-value, .tile .v, .spend-row .v, .bar-row .val, .now-day > summary { font-variant-numeric: tabular-nums; }

  /* ---- Collapsible rail ---- */
  .rail {
    width: 232px; flex: 0 0 232px; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 22px 14px; gap: 26px;
    position: sticky; top: 0; height: 100vh;
    transition: width .16s ease, flex-basis .16s ease, padding .16s ease;
  }
  .rail.collapsed { width: 58px; flex-basis: 58px; padding: 16px 8px; }
  .rail-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  .rail-brand { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; padding-left: 6px; }
  /* the turtle on its own, in the theme's accent: no tile, so it's as big as the bar allows,
     and the accent reads on the theme's ground in light and dark alike */
  .rail-mark { width: 46px; height: 32px; flex: 0 0 auto; color: var(--accent); display: flex; }
  /* on a theme's dark sidebar, the light end of its own colours (what its tile used to be) */
  :root[data-theme="fjord"] .rail-mark { color: #6cc3e0; }
  :root[data-theme="holiday"] .rail-mark { color: #3fc0d3; }
  :root[data-theme="autumn"] .rail-mark { color: #f2a653; }
  :root[data-theme="slave"] .rail-mark { color: #f07236; }
  /* the turtle (app/web/static/logo.svg), in the colour of whatever holds it: each theme's mark its own */
  .logo { display: block; width: 100%; height: 100%; background: currentColor;
          -webkit-mask: url("/logo.svg") center / contain no-repeat; mask: url("/logo.svg") center / contain no-repeat; }
  .rail-word { font-family: var(--font-head); font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; padding-right: 6px; }
  .rail.collapsed .rail-word, .rail.collapsed .rail-foot, .rail.collapsed .rail-brand { display: none; }
  .rail.collapsed .rail-nav .lbl { display: none; }
  .rail.collapsed .rail-top { justify-content: center; }
  .rail-collapse-btn {
    all: unset; cursor: pointer; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 5px;
    color: var(--ink-3); display: flex; align-items: center; justify-content: center;
    font-family: var(--font-num); font-size: 13px;
  }
  .rail-collapse-btn:hover { background: var(--surface-2); color: var(--ink); }
  .rail-nav { display: flex; flex-direction: column; gap: 3px; }
  .rail-nav a {
    text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; color: var(--ink-2);
    display: flex; align-items: center; gap: 12px; font-family: var(--font-body);
    white-space: nowrap; overflow: hidden;
    font-weight: 500;
  }
  .rail.collapsed .rail-nav a { justify-content: center; padding: 8px; }
  .rail-nav a:hover { background: var(--surface-2); color: var(--ink); }
  .rail-nav a.active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
  .rail-nav .ic { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .rail-nav a.active .ic { color: var(--accent-strong); }
  .rail-foot { margin-top: auto; font-size: 12.5px; color: var(--ink-3); padding: 0 8px; }
  /* Log out: a link in the rail's foot under the account, and the last line of the phone's More */
  .logout-form { margin: 0; }
  .logout-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; margin-top: 2px;
                 font: inherit; font-size: 12.5px; font-weight: 500; color: inherit; cursor: pointer; }
  .logout-link:hover { background: none; color: var(--ink); text-decoration: underline; }
  .logout-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .page { padding: 32px 36px 72px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; }
  /* a page with no menu beside it (the front page, privacy, terms, the questions) sits in the middle, not against the left edge */
  body:not(:has(> .rail)) .page { margin-inline: auto; width: 100%; box-sizing: border-box; }
  body:not(:has(> .rail)) .page:not(:has(.front)):not(:has(.auth)) > * { margin-inline: auto; width: 100%; box-sizing: border-box; }

  h1 { font-family: var(--font-head); font-weight: 700; font-size: 28px; margin: 0 0 4px; text-wrap: balance; letter-spacing: -.025em; line-height: 1.15; }
  h2 { font-family: var(--font-head); font-weight: 600; font-size: 16.5px; margin: 0; letter-spacing: -.01em; }
  h3 { font-family: var(--font-head); font-weight: 600; font-size: 14px; margin: 0; }
  .sub { color: var(--ink-2); font-size: 14px; margin: 0; line-height: 1.5; }
  /* a page's heading, as a line of its own like Today's date: the theme's picture faded into it */
  .page-head { padding: 18px 24px; border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow);
    background: var(--box-art), radial-gradient(480px 120px at 0% 0%, var(--accent-tint), transparent 70%), var(--surface); }
  .page-head h1 { font-size: 24px; margin: 0 0 2px; }
  .eyebrow { font-family: var(--font-num); font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 2px; }
  .note { font-size: 13px; color: var(--ink-3); }

  /* ---- Layout ---- */
  .grid { display: grid; gap: 20px; align-items: start; }
  .grid-2 { grid-template-columns: 1.3fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  @media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

  /* ---- Surfaces ---- */
  .panel {
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
    padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
  }
  .panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  /* A panel that is its own button: the header opens and closes it (details.panel.fold) */
  details.panel.fold { display: block; padding: 0; }
  details.panel.fold > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px;
    padding: 20px 24px; border-radius: var(--radius);
  }
  details.panel.fold > summary::-webkit-details-marker { display: none; }
  details.panel.fold > summary:hover { background: var(--surface-2); }
  details.panel.fold[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--border); }
  .fold-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .fold-text h2 { margin: 0; }
  .fold-text .sub { margin: 0; }
  .fold-caret { color: var(--ink-3); font-size: 18px; line-height: 1; transition: transform .15s; }
  details.panel.fold[open] > summary .fold-caret { transform: rotate(180deg); }
  .fold-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
  .tile {
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); padding: 16px 18px;
    display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
  }
  .tile .l { font-family: var(--font-num); font-size: 12px; color: var(--ink-2); text-transform: none; letter-spacing: .02em; font-weight: 500; }
  .tile .v { font-family: var(--font-num); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
  .tile .d { font-size: 12.5px; color: var(--ink-2); }

  /* ---- The headline readout: one number, given real size. ---- */
  .readout {
    background: var(--surface); border: 1px solid var(--edge); border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow);
    padding: 22px 24px; display: flex; align-items: flex-end; justify-content: space-between;
    gap: 20px; flex-wrap: wrap; position: relative; overflow: hidden;
  }
  .readout::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(480px 160px at 0% 0%, var(--accent-tint), transparent 70%); opacity: .7;
  }
  .readout-num {
    font-family: var(--font-num); font-weight: 700; font-size: clamp(34px, 5vw, 52px);
    letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--ink);
    position: relative; line-height: 1;
  }
  .readout-num .unit { font-size: .4em; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
  .readout-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; position: relative; }
  .readout-side > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: calc(var(--radius) - 2px);
    background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: inset 0 0 0 1px var(--border); }
  .stat-label { font-size: 12px; color: var(--ink-2); text-transform: none; letter-spacing: .02em; font-family: var(--font-num); font-weight: 500; }
  .stat-value { font-family: var(--font-num); font-size: 21px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }

  /* ---- Today's days-until-free, as one line that opens (dashboard.html) ---- */
  details.free-bar {
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow);
    position: relative; overflow: hidden;
  }
  details.free-bar::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--box-art), radial-gradient(480px 120px at 0% 0%, var(--accent-tint), transparent 70%); opacity: 1;
  }
  /* opened, the picture at its full size */
  details.free-bar[open]::before { background: var(--hero-art), radial-gradient(640px 240px at 0% 0%, var(--accent-tint), transparent 70%); }
  details.free-bar > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
    padding: 16px 24px; position: relative;
  }
  details.free-bar > summary::-webkit-details-marker { display: none; }
  .free-main { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 4px; min-width: 0; }
  .free-num { font-family: var(--font-display, var(--font-head)); font-weight: 700; font-size: 40px; line-height: 1;
    font-variant-numeric: normal; color: var(--accent-strong); letter-spacing: -.03em; }
  .free-unit { font-family: var(--font-body); font-size: 15.5px; color: var(--ink-2); font-weight: 500; }
  .free-pace { flex-basis: 100%; font-size: 14.5px; color: var(--ink-2); }
  /* a wide screen: the pace at the line's right end, the whole of it one row */
  @media (min-width: 1000px) { .free-pace { flex: 0 1 auto; margin-left: auto; } }
  .free-pace .good-text, .free-pace .bad-text { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px;
    margin-left: 4px; white-space: nowrap; background: var(--good-tint); }
  .free-pace .bad-text { background: var(--critical-tint); }
  .free-caret { color: var(--ink-3); font-size: 14px; transition: transform .15s ease; }
  details.free-bar:not([open]) .free-caret { transform: rotate(-90deg); }
  .free-body { padding: 4px 24px 24px; display: grid; gap: 14px; position: relative; }
  .free-body > .note, .free-body > .sub { margin: 0; }
  .free-body > .note { max-width: 74ch; font-size: 13.5px; }

  /* ---- Tables: fixed layout where a template asks for it. Auto layout collapses narrow
     columns until text wraps one character per line -- that is how the review page and
     an earlier JSON block both became unreadable. ---- */
  table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
  th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); }
  th { color: var(--ink-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-family: var(--font-num); }
  td.num, th.num { text-align: right; font-family: var(--font-num); }
  tr:last-child td { border-bottom: none; }
  .tbl-wrap { overflow-x: auto; }
  table.fixed { table-layout: fixed; }

  .kv { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
  .kv:last-child { border-bottom: none; }
  .kv .k { color: var(--ink-2); }
  .kv .v { font-family: var(--font-num); font-weight: 600; }

  .pill {
    display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-num);
    font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  }
  .pill.good { background: var(--good-tint); color: var(--good); }
  .pill.critical { background: var(--critical-tint); color: var(--critical); }
  .pill.warn { background: var(--warning-tint); color: var(--warning); }
  .pill.neutral { background: var(--surface-2); color: var(--ink-2); }

  /* ---- Bars ---- */
  .bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
  .bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
  .bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
  .bar-row .lbl { flex: 0 0 152px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar-row .val { flex: 0 0 76px; text-align: right; font-family: var(--font-num); }
  .progress-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
  .progress-fill { height: 100%; border-radius: 999px; background: var(--accent); }
  .progress-fill.over { background: var(--critical); }

  /* Compact reference list -- quieter than the accent bars, for data you scan not act on. */
  .spend-list { display: flex; flex-direction: column; gap: 1px; }
  .shop-tbl td { vertical-align: top; }
  .shop-tbl .shop-sec th { color: var(--ink); font-size: 13px; padding-top: 18px; border-bottom: none; text-transform: none; letter-spacing: 0; font-weight: 700; }
  .shop-tbl tr:first-child.shop-sec th { padding-top: 4px; }
  .shop-tbl td.num { white-space: nowrap; }
  .shop-tbl .usual-inline { display: none; }
  .shop-tbl .usual-src { font-size: 12px; white-space: normal; }
  .shop-tbl .unit { color: var(--ink-3); font-size: 12px; }
  .good-text { color: var(--good); font-weight: 600; }
  .bad-text { color: var(--critical); }
  /* On a phone the Usual column folds under Now instead of pushing the table sideways. */
  @media (max-width: 560px) {
    .shop-tbl .col-usual { display: none; }
    .shop-tbl .usual-inline { display: inline; }
  }
  .spend-row { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.9; }
  .spend-row .k { flex: 0 0 130px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .spend-row .t { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
  .spend-row .t i { display: block; height: 100%; background: var(--ink-3); opacity: .75; }
  .spend-row .v { flex: 0 0 62px; text-align: right; font-family: var(--font-num); color: var(--ink-2); }

  /* ---- Charts ---- */
  .cf-chart { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-top: 10px; }
  .cf-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .cf-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 96px; width: 100%; }
  .cf-bar { flex: 0 1 18px; max-width: 18px; border-radius: 2px 2px 0 0; }
  .cf-label { font-size: 12px; color: var(--ink-3); font-family: var(--font-num); }
  .legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
  .legend span { display: inline-flex; align-items: center; gap: 5px; }
  .legend .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
  .sparkwrap svg text { font-family: var(--font-num); }

  .donut {
    --pct: 0; width: 86px; height: 86px; border-radius: 50%; flex: 0 0 auto;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-3) 0);
    display: flex; align-items: center; justify-content: center;
  }
  .donut-inner {
    width: 62px; height: 62px; border-radius: 50%; background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-num); font-weight: 600; font-size: 15px;
  }
  .donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  .debt-progress-list { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 220px; }

  /* ---- Property identity: equity (accent) stacked over debt (grey), sized to the real
     split. The one mark here specific to a property portfolio. ---- */
  .stack {
    width: 20px; height: 14px; border-radius: 2px; overflow: hidden; display: inline-flex;
    flex-direction: column-reverse; flex: 0 0 auto; border: 1px solid var(--border); vertical-align: middle;
  }
  .stack > * { display: block; width: 100%; }
  .stack .eq { background: var(--accent); }
  .stack .db { background: var(--surface-3); }
  .prop-name { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

  /* ---- Forms ---- */
  label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
  input, select { font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); }
  input[type=file] { padding: 5px; }
  form.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: end; }
  /* Vertical form: the global label rule stacks label text above its control, so a form
     whose children are a file picker, a checkbox and a button needs its own column flow. */
  form.form-col { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
  form.form-col input[type=file] { max-width: 340px; }
  .check-row { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 12.5px; max-width: 62ch; line-height: 1.45; }
  .check-row input[type=checkbox] { width: auto; flex: 0 0 auto; margin-top: 2px; }
  button {
    font: inherit; font-family: var(--font-body); font-size: 14px; font-weight: 600;
    padding: 10px 18px; border-radius: 10px; border: none; background: var(--accent);
    color: var(--surface); cursor: pointer;
  }
  button:hover { background: var(--accent-strong); }
  .cancel-btn { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); }
  .cancel-btn:hover { background: var(--surface-2); color: var(--ink); }

  /* ---- Components the app depends on that the design mockup never had to carry:
     59 hint tooltips, and the inline row editing on Setup. Restyled, not dropped. ---- */
  .lbl-row { display: flex; align-items: center; gap: 5px; }
  .hint {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%; background: var(--surface-2); color: var(--ink-3);
    font-family: var(--font-num); font-size: 11px; font-weight: 600; cursor: help; flex-shrink: 0;
  }
  .hint-bubble {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 260px; background: var(--ink); color: var(--bg);
    font-family: var(--font-body); font-size: 13px; font-weight: 400; line-height: 1.45;
    padding: 8px 10px; border-radius: 6px; text-align: left;
    opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 30;
  }
  .hint:hover .hint-bubble, .hint:focus .hint-bubble { opacity: 1; }

  /* why(): an explanation kept near its figure but folded away (_ui.html) */
  details.why { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
  details.why > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 0; color: var(--ink-3); }
  details.why > summary::-webkit-details-marker { display: none; }
  details.why > summary::after { content: "▸"; font-size: 10px; transition: transform .12s ease; }
  details.why[open] > summary::after { transform: rotate(90deg); }
  details.why > summary:hover { color: var(--ink-2); }
  .why-body { margin-top: 6px; line-height: 1.5; max-width: 68ch; display: grid; gap: 6px; color: var(--ink-2); }
  .why-body p { margin: 0; }

  .row-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

  /* ---- Ledger rows ---- */
  .entry-tbl td { vertical-align: top; }
  .entry-tbl .num { text-align: right; }
  /* a receipt's items, folded (_ui.html bought_list) */
  details.bought-items > summary { cursor: pointer; list-style: none; }
  details.bought-items > summary::-webkit-details-marker { display: none; }
  details.bought-items > summary::before { content: "▸ "; color: var(--ink-3); }
  details.bought-items[open] > summary::before { content: "▾ "; }
  details.bought-items ul { list-style: none; margin: 6px 0 2px; padding: 0; display: grid; gap: 3px; font-size: 13px; }
  details.bought-items li { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
  /* a list item's "Wrong match?" (dashboard.html): the receipt lines it was matched from */
  details.wrong-kind { margin-top: 4px; }
  details.wrong-kind > summary { cursor: pointer; }
  details.wrong-kind form { display: inline-block; margin: 2px 4px 0 0; }
  details.wrong-kind p { margin: 4px 0; max-width: 32ch; }
  .tag {
    display: inline-block; font-family: var(--font-num); font-size: 11.5px; letter-spacing: .03em;
    padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2);  /* ink-3 on surface-3 is under 4.5:1 */
    vertical-align: 1px; white-space: nowrap;
  }
  .tag.good { background: var(--good-tint); color: var(--good); }
  .dup-group { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
  .dup-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
  .dup-dismiss { margin-left: auto; }
  .dup-row {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 5px 0 5px 12px; border-left: 2px solid var(--border); flex-wrap: wrap;
  }
  .dup-desc { flex: 1; min-width: 200px; font-size: 12.5px; }

  /* Unreviewed receipt batch: nothing linked to one before, so a finished batch could sit
     unnoticed. Loud enough to notice, quiet enough not to compete with the countdown. */
  .pending-batch {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; text-decoration: none;
    background: var(--warning-tint); border: 1px solid var(--warning); border-radius: var(--radius);
    padding: 12px 18px; color: var(--ink); font-size: 14px;
  }
  .pending-batch:hover { border-color: var(--ink-2); }
  .pending-batch span:nth-child(2) { flex: 1; min-width: 200px; }
  .pending-go { font-family: var(--font-num); font-weight: 600; color: var(--accent); white-space: nowrap; }
  /* Worth knowing (app/notices.py): the receipt banner's shape, in the calm colour -- news, not a problem */
  .notice { display: flex; align-items: center; gap: 4px; background: var(--good-tint); border: 1px solid transparent;
            border-radius: var(--radius); padding: 8px 8px 8px 18px; font-size: 14px; }
  .notice > a { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; text-decoration: none;
                color: var(--ink); padding: 6px 0; }
  .notice > a span:nth-child(2) { flex: 1; min-width: 200px; }
  .notice form { margin: 0; }
  .notice-x { background: none; border: 0; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
              min-width: 40px; min-height: 40px; border-radius: 6px; }
  .notice-x:hover { background: var(--surface); color: var(--ink); }
  .edit-btn, .delete-btn, .cancel-edit {
    font-family: var(--font-num); font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); cursor: pointer;
  }
  .edit-btn:hover { background: var(--accent-tint); color: var(--accent-strong); border-color: var(--accent); }
  .delete-btn:hover { background: var(--critical-tint); color: var(--critical); border-color: var(--critical); }
  .cancel-edit:hover { background: var(--surface-2); color: var(--ink); }
  .suggest-btn { background: var(--accent-tint); color: var(--accent-strong); font-size: 13px; padding: 6px 10px; }
  .suggest-btn:hover { background: var(--accent); color: var(--surface); }
  .suggest-note { font-size: 12.5px; color: var(--ink-3); }
  fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
  legend { font-family: var(--font-head); font-weight: 600; font-size: 14px; padding: 0 6px; }
  .reset-zone {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    border: 1px solid var(--critical); border-radius: var(--radius); padding: 14px 16px; background: var(--critical-tint);
  }

  /* ---- Phone: the rail becomes a horizontal strip rather than a tall list that would
     push every page's content below the fold. ---- */
  @media (max-width: 620px) {
    body { flex-direction: column; }
    .rail, .rail.collapsed {
      position: static; height: auto; width: 100%; flex: none; flex-direction: row; align-items: center;
      gap: 10px; padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto;
    }
    .rail .rail-collapse-btn, .rail .rail-foot a, .rail .rail-foot .logout-form { display: none; }
    .rail .rail-foot { display: block; margin: 0; padding: 0; flex: 0 0 auto; }
    .rail .theme-pick { margin: 0; }
    .rail .rail-brand, .rail.collapsed .rail-brand { display: flex; }
    .rail .rail-word, .rail.collapsed .rail-word { display: block; }
    .rail-nav, .rail.collapsed .rail-nav { flex-direction: row; gap: 4px; }
    .rail-nav a, .rail.collapsed .rail-nav a { padding: 6px 10px; }
    .rail-nav .ic, .rail.collapsed .rail-nav .ic { display: none; }
    .rail.collapsed .rail-nav .lbl { display: block; }
    .page { padding: 16px 14px 40px; gap: 14px; }
    .grid, .col { gap: 14px; }
    /* The 152px label reservation leaves no room for the bar itself at phone width. */
    .bar-row .lbl { flex-basis: 96px; }
    .bar-row .val { flex-basis: 46px; }
    .spend-row .k { flex-basis: 96px; }
    .readout-side { gap: 16px; }
  }

  /* ---- The phone: a bottom bar with the camera in the middle ---- */
  .phone-bar, .snap-busy { display: none; }
  @media (max-width: 620px) {
    .rail .rail-nav, .rail .rail-foot, .rail.collapsed .rail-nav { display: none !important; }
    .rail, .rail.collapsed { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
    body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
    .phone-bar {
      display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; align-items: flex-end; justify-content: space-around;
      padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
      box-shadow: 0 -4px 18px rgba(0,0,0,.08);
    }
    :root[data-theme] .phone-bar { background: var(--surface); }
    .phone-bar > a, .phone-bar .more > summary {
      flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; text-decoration: none;
      color: var(--ink-3); font-size: 11.5px; font-weight: 500; font-family: var(--font-body); list-style: none; cursor: pointer;
    }
    .phone-bar .more > summary::-webkit-details-marker { display: none; }
    .phone-bar a.active { color: var(--accent); }
    .phone-bar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .phone-bar .more { flex: 1; display: flex; }
    .snap-form { flex: 0 0 auto; margin: 0 4px; }
    .snap { width: 60px; height: 60px; margin-top: -26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
      background: var(--accent); color: var(--surface); box-shadow: 0 6px 16px rgba(0,0,0,.22); cursor: pointer; border: 4px solid var(--surface); }
    .snap svg { width: 28px; height: 28px; stroke-width: 2; }
    .snap input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
    .more-sheet { position: fixed; left: 10px; right: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 41;
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.25);
      padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
    .more-sheet a { padding: 12px; border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--surface-2); font-size: 14px; }
    .more-sheet a.active { color: var(--accent-strong); background: var(--accent-tint); }
    .more-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 4px 2px; color: var(--ink-2); }
    .more-picks .theme-pick { flex: 1 1 150px; min-width: 0; margin: 0; font-size: 13.5px; }
    .more-logout { grid-column: 1 / -1; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
    .more-logout .logout-link { width: 100%; justify-content: center; min-height: 44px; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
    .more-logout .logout-link:hover { background: var(--surface-2); text-decoration: none; }
    .more-picks .theme-pick select { flex: 1 1 auto; min-width: 0; }
    .more-picks .theme-pick select { font-size: 13px; padding: 6px; background: var(--surface); color: var(--ink); border-color: var(--border); }
    .snap-busy:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 60; align-items: center; justify-content: center;
      background: rgba(0,0,0,.45); color: #fff; font-size: 16px; text-align: center; }
    .snap-spin { width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid rgba(255,255,255,.3);
      border-top-color: #fff; animation: snapspin 0.9s linear infinite; }
    @keyframes snapspin { to { transform: rotate(360deg); } }
    /* ---- Read and tapped with a thumb: text a phone can read, targets a finger can hit ---- */
    body { font-size: 15.5px; }
    h1 { font-size: 25px; }
    .page-head { padding: 14px 16px; }
    .page-head h1 { font-size: 22px; }
    details.free-bar > summary { padding: 14px 16px; }
    .free-body { padding: 2px 16px 18px; }
    .free-num { font-size: 36px; }
    .free-unit { font-size: 15px; }
    .free-pace { font-size: 14px; }
    .free-pace .good-text, .free-pace .bad-text { margin-left: 0; }
    .readout-side { grid-template-columns: 1fr 1fr; gap: 10px; }
    .readout-side > div { padding: 12px 14px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 12.5px; }
    th, td { padding: 8px 6px; }  /* a table's columns closer: more of them fit the screen */
    .notice { padding: 6px 4px 6px 16px; align-items: flex-start; }
    .notice > a { gap: 6px 10px; padding: 8px 0; }
    .notice > a span:nth-child(2) { flex-basis: 100%; min-width: 0; order: 2; }
    .notice > a .pending-go { margin-left: auto; }
    .sub { font-size: 14px; }
    .note, .kv .k .note { font-size: 13px; }
    th { font-size: 12px; }
    .ftag { font-size: 12px !important; }
    td, .kv { font-size: 14px; }
    .eyebrow, .stat-label, .tile .l, .cf-label { font-size: 12px; }
    .tag, .pill { font-size: 12px; }
    [style*="font-size:10"], [style*="font-size:11"], [style*="font-size:12px"], [style*="font-size:12.5px"],
    [style*="font-size: 12"] { font-size: 13.5px !important; }
    button, .delete-btn, .cancel-edit { font-size: 14px; min-height: 40px; padding-left: 12px; padding-right: 12px; }
    /* 16px: below it, an iPhone zooms the whole page in when a field is tapped */
    input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; min-height: 42px; max-width: 100%; }
    input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: 0 0 auto; }
    summary { min-height: 40px; }
    .hint { width: 22px; height: 22px; font-size: 12px; }
    /* a field's explanation: a sheet above the bottom bar, not a bubble off the edge */
    .hint-bubble { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(92px + env(safe-area-inset-bottom));
      transform: none; width: auto; max-width: none; font-size: 14px; padding: 12px 14px; box-shadow: 0 8px 26px rgba(0,0,0,.3); }
    .row { flex-wrap: wrap; }
    /* a form on a phone: one field a line, the full width -- room for its label and its tags */
    .row > label, .form-col > label, .buy-form .row > label { flex: 1 1 100%; min-width: 0; max-width: 100%; }
    .row > label input:not([type=checkbox]):not([type=radio]), .row > label select, .row > label textarea,
    .form-col > label input:not([type=checkbox]):not([type=radio]) { width: 100%; max-width: none !important; }
    .row > label.check, .row > label.fl-check, .buy-form label.check { flex: 1 1 auto; }
    .lbl-row { flex-wrap: wrap; row-gap: 4px; }
    form.row { grid-template-columns: 1fr; gap: 12px; }
    .kv .v { white-space: nowrap; }  /* an amount on one line: "1 366 kr", not "1 366 / kr" */
    /* what sets its own small size: sized again for a phone */
    .page button, .page .edit-btn { font-size: 14px; }
    .spend-row .k, .spend-row .v, .page .d, #flow-example, .bud-head, .bud-sub td, .bud-pays { font-size: 13px !important; }
    .page th, .yr-row.head, .tx-sum .l { font-size: 12px !important; }
    .month-nav a, a.month-step { display: inline-block; padding: 10px 12px; margin: -10px -4px; }
    .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    p, td, li, .sub, .note { overflow-wrap: break-word; }
    img, svg, canvas, video { max-width: 100%; }
    .panel, .tile { min-width: 0; }
    .page { padding-left: 12px; padding-right: 12px; }
    .panel { padding: 18px 18px; }
    /* a closed box says what it is in two lines; opened, all of it */
    details.panel.fold:not([open]) > summary .fold-text .sub { display: -webkit-box; -webkit-line-clamp: 2;
      -webkit-box-orient: vertical; overflow: hidden; }
    /* how to still make the month: what to do (at most, a day), not what's left besides */
    .drill-tbl th:nth-child(2), .drill-tbl td:nth-child(2) { display: none; }
    details.panel.fold > summary { padding: 14px; }
    .fold-body { padding: 14px; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
