/* Components (docs/design/DESIGN.md → Components). Flat: no shadows except tab bar and sheet. */

/* --- cards --------------------------------------------------------------------- */
.card { background: var(--card); border-radius: var(--radius-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.card.hero { border-radius: var(--radius-hero); padding: 20px 20px 16px; }
.card.pad-lg { padding: 18px 20px; gap: 10px; }
.card .figure.positive { color: var(--positive); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; gap: 12px; }
.section-head a { font-size: 15px; font-weight: 600; color: var(--text-2); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; }
.group-head h2, .group-head h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-2); }
.group-head .total { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.group { display: flex; flex-direction: column; gap: 6px; }
.footnote { padding: 0 16px; font-size: 13px; line-height: 18px; color: var(--text-2); }

/* --- grouped list -------------------------------------------------------------- */
.list { background: var(--card); border-radius: var(--radius-card); overflow: hidden; list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 0 16px; width: 100%; text-align: left; background: none; border: 0; color: inherit; }
a.row, button.row, label.row { cursor: pointer; }
a.row:hover, button.row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
a.row:focus-visible, button.row:focus-visible { outline-offset: -3px; border-radius: var(--radius-card); }
.row-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 10px 0; }
.list > li + li .row-body, .list > .row + .row .row-body, .list > * + .row .row-body, .row.sep .row-body { border-top: 0.5px solid var(--separator); }
.row.tall .row-body { min-height: 60px; padding: 11px 0; }
.row.short .row-body { min-height: 44px; padding: 6px 0; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub.wrap, .row-title.wrap { white-space: normal; }
.row-value { flex: none; font-size: 17px; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row-value .amount { color: var(--text); }
.row-action { flex: none; font-size: 15px; font-weight: 600; }
.row-action.warn { color: var(--warn-fg); }
.chevron { flex: none; color: var(--text-3); }
.row.danger { justify-content: center; color: var(--danger); min-height: 44px; font-size: 17px; }
.row.danger .row-body { justify-content: center; }
.list .row-footer { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 0.5px solid var(--separator); flex-wrap: wrap; }
.list .row-footer .caption { flex: 1; min-width: 8rem; }
.bar { height: 6px; border-radius: 3px; background: var(--fill-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--c-fill, var(--chart)); }
.share-row .row-body { flex-direction: column; align-items: stretch; gap: 7px; padding: 12px 0; }
.share-row .share-top { display: flex; justify-content: space-between; gap: 12px; font-size: 17px; }

/* --- icon tiles ---------------------------------------------------------------- */
.tile {
  flex: none; width: 32px; height: 32px; border-radius: var(--radius-tile);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-tint, var(--cat-grey-tint)); color: var(--c-glyph, var(--cat-grey-glyph));
  font-size: 15px; font-weight: 700;
}
.tile.round { width: 38px; height: 38px; border-radius: 50%; }
.tile.md { width: 36px; height: 36px; }
.tile.sm { width: 30px; height: 30px; border-radius: 8px; }
.tile.xl { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; }
.tile.neutral { background: var(--fill-soft); color: var(--text); }
.avatar { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--cat-indigo-tint); color: var(--cat-indigo-glyph); font-size: 16px; font-weight: 600; flex: none; }

/* --- pills --------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; line-height: 16px; border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; background: var(--fill-soft); color: var(--text-2); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); padding: 1px 7px; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.indigo { background: var(--cat-indigo-tint); color: var(--cat-indigo-glyph); }
.pill.danger { background: var(--cat-coral-tint); color: var(--negative); }
.pill.lg { font-size: 13px; border-radius: 10px; padding: 3px 9px; }
.pace { align-self: flex-start; }
.pace.below { background: var(--positive-bg); color: var(--positive); }
.pace.above { background: var(--warn-bg); color: var(--warn-fg); }

/* --- buttons ------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 18px; border: 0;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--text);
}
.btn.primary { background: var(--control); color: var(--control-text); padding: 0 16px; }
.btn.soft { background: var(--fill-soft); }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 16px; }
.btn.lg { height: 54px; border-radius: 27px; font-size: 17px; padding: 0 22px; }
.btn.md { height: 50px; border-radius: 25px; font-size: 17px; padding: 0 20px; }
.btn.block { display: flex; width: 100%; }
.btn.card-bg { background: var(--card); }
.btn.danger { background: var(--card); color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 18px; border: 0; background: var(--fill); color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-2); font-size: 15px; font-weight: 600; }
.inline-form { display: inline; margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* --- segmented control --------------------------------------------------------- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.segmented input:checked + span { background: var(--segment-on); box-shadow: var(--segment-shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* --- filter chips -------------------------------------------------------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip-menu { position: relative; flex: none; }
.chip-menu > summary { list-style: none; }
.chip-menu > summary::-webkit-details-marker { display: none; }
.chip, .chip-menu > summary {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 14px; border-radius: 17px; border: 0;
  background: var(--card); color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip.on, .chip-menu.on > summary { background: var(--control); color: var(--control-text); }
.chip-menu[open] > summary svg { transform: rotate(180deg); }
.chip-options {
  position: fixed; z-index: 30; margin-top: 6px; min-width: 220px; max-width: calc(100vw - 32px); max-height: 60vh; overflow-y: auto;
  background: var(--card); border-radius: 14px; padding: 6px 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.chip-options a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; font-size: 17px; }
.chip-options a[aria-current="true"] { font-weight: 600; }
.chip-options a[aria-current="true"]::after { content: "✓"; margin-left: auto; color: var(--text-2); }
.chip-options a:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.chip-options hr { border: 0; border-top: 0.5px solid var(--separator); margin: 4px 0; }

/* --- search -------------------------------------------------------------------- */
.search { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 20px; background: var(--fill); color: var(--text-2); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 17px; color: var(--text); outline: none; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--text-2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- toggle (iOS switch on a real checkbox) ---------------------------------------- */
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative;
  width: 51px; height: 31px; border-radius: 16px; margin: 0; background: var(--fill); cursor: pointer;
  transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px;
  background: #FFFFFF; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.switch:checked { background: var(--toggle-on); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- forms (grouped list rows with label + control) ---------------------------------- */
.field { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; }
.list > .field + .field, .list > * + .field, .field.sep { border-top: 0.5px solid var(--separator); }
.field > .label { flex: none; width: 120px; font-size: 17px; }
.field > .label.wide { width: auto; flex: 1; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=search], .field input:not([type]), .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 17px; color: var(--text); text-align: right; padding: 12px 0;
}
.field select { -webkit-appearance: none; appearance: none; text-align-last: right; cursor: pointer; color: var(--text-2); }
.field select:focus-visible, .field input:focus-visible, .field textarea:focus-visible { outline: none; }
.field:focus-within { box-shadow: inset 3px 0 0 var(--focus); }
.field.stack { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 16px; }
.field.stack > .label { width: auto; }
.field.stack textarea, .field.stack input, .field.stack select { text-align: left; padding: 4px 0; }
.field textarea { resize: vertical; min-height: 64px; line-height: 1.35; }
.field .mono { font-family: var(--mono); }
.field input[type=color] { width: 44px; height: 32px; padding: 0; border: 0; background: none; }
.field input[type=file] { font-size: 15px; text-align: left; }
.field.check { gap: 12px; }
.field.check input[type=checkbox]:not(.switch) { width: 22px; height: 22px; accent-color: var(--control); }
.input-plain { width: 100%; border: 0; border-radius: 14px; background: var(--card); padding: 14px 16px; font-size: 17px; color: var(--text); }
.helper { padding: 0 16px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.code-input { font-family: var(--mono); letter-spacing: 0.12em; }

/* Colour key picker (radio swatches). */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.swatch-opt { position: relative; }
.swatch-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch-opt span { display: block; width: 32px; height: 32px; border-radius: 16px; background: var(--c-fill); box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.08); }
.swatch-opt input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.swatch-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 5px; background: var(--c-fill); flex: none; }

/* --- banners ------------------------------------------------------------------- */
.banner { border-radius: 14px; padding: 10px 14px; font-size: 15px; line-height: 20px; background: var(--card); }
.banner.ok { background: var(--ok-bg); color: var(--ok-fg); }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.error { background: var(--cat-coral-tint); color: var(--negative); }
.banner a { text-decoration: underline; }

/* --- empty state ----------------------------------------------------------------- */
.empty { background: var(--card); border-radius: var(--radius-card); padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.empty .tile { width: 48px; height: 48px; border-radius: 14px; }
.empty h2 { font-size: 17px; font-weight: 600; }
.empty p { font-size: 15px; color: var(--text-2); max-width: 340px; }

/* --- charts ---------------------------------------------------------------------- */
.chart-box { position: relative; height: 120px; margin-top: 12px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .line { width: 14px; height: 3px; border-radius: 2px; background: var(--chart); }
.legend .dashed { width: 14px; height: 0; border-top: 2px dashed var(--chart-avg); }
.chart-fallback { display: flex; align-items: flex-end; gap: 2px; height: 100%; }

/* --- sheet / modal ----------------------------------------------------------------- */
dialog.sheet {
  border: 0; padding: 0; margin: 0; color: var(--text); background: var(--bg);
  width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh;
  top: auto; bottom: 0; left: 0; right: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.sheet::backdrop { background: var(--scrim); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-scroll { overflow-y: auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
.grabber { align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--text-3); flex: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sheet-head h1, .sheet-head h2 { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.sheet-hero .amount { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
/* Same content as a full page when JavaScript is off. */
.sheet-page { max-width: 560px; }
@media (min-width: 1024px) {
  dialog.sheet { top: 50%; left: 50%; bottom: auto; right: auto; transform: translate(-50%, -50%); width: 480px; max-height: 86vh; border-radius: 24px; }
  dialog.sheet[open] { animation: none; }
  .grabber { display: none; }
}

/* --- misc ------------------------------------------------------------------------ */
.desc-original { font-family: var(--mono); font-size: 13px; color: var(--text-2); word-break: break-word; text-align: right; }
.kv { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.kv + .kv { border-top: 0.5px solid var(--separator); }
.kv > :first-child { flex: none; width: 120px; font-size: 17px; }
.kv > :last-child { flex: 1; min-width: 0; text-align: right; color: var(--text-2); font-size: 17px; word-break: break-word; }
.load-more { display: flex; justify-content: center; padding: 8px 0; }
.totals { display: flex; justify-content: space-between; gap: 12px; padding: 0 4px; font-size: 13px; color: var(--text-2); }
.htmx-request .spinner, .htmx-request.spinner { opacity: 1; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-top: 0.5px solid var(--separator); vertical-align: top; }
.table th { color: var(--text-2); font-weight: 600; border-top: 0; }
.table-wrap { overflow-x: auto; }
.qr { width: 200px; height: 200px; padding: 10px; background: #FFFFFF; border-radius: 16px; align-self: center; }
.secret, .codes { font-family: var(--mono); font-size: 15px; word-break: break-all; }
.codes { columns: 2; padding: 4px 16px 4px 36px; line-height: 1.8; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 21px; }
.prose p + p { margin-top: 8px; }
.prose { font-size: 15px; line-height: 21px; }
.prose a, .steps a { text-decoration: underline; }

/* Desktop layouts */
@media (min-width: 1024px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .home-grid > .col { display: flex; flex-direction: column; gap: var(--section-gap); }
  .two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .two-col > .col { display: flex; flex-direction: column; gap: var(--section-gap); }
  .narrow { max-width: 720px; }
}
.home-grid > .col, .two-col > .col { display: flex; flex-direction: column; gap: var(--section-gap); }
.home-grid, .two-col { display: flex; flex-direction: column; gap: var(--section-gap); }
@media (min-width: 1024px) { .home-grid, .two-col { display: grid; } }

/* Share bars: widths as classes (the CSP forbids style attributes). */
.bar > span.w-0, .segbar > span.w-0 { width: 0%; }
.bar > span.w-1, .segbar > span.w-1 { width: 1%; }
.bar > span.w-2, .segbar > span.w-2 { width: 2%; }
.bar > span.w-3, .segbar > span.w-3 { width: 3%; }
.bar > span.w-4, .segbar > span.w-4 { width: 4%; }
.bar > span.w-5, .segbar > span.w-5 { width: 5%; }
.bar > span.w-6, .segbar > span.w-6 { width: 6%; }
.bar > span.w-7, .segbar > span.w-7 { width: 7%; }
.bar > span.w-8, .segbar > span.w-8 { width: 8%; }
.bar > span.w-9, .segbar > span.w-9 { width: 9%; }
.bar > span.w-10, .segbar > span.w-10 { width: 10%; }
.bar > span.w-11, .segbar > span.w-11 { width: 11%; }
.bar > span.w-12, .segbar > span.w-12 { width: 12%; }
.bar > span.w-13, .segbar > span.w-13 { width: 13%; }
.bar > span.w-14, .segbar > span.w-14 { width: 14%; }
.bar > span.w-15, .segbar > span.w-15 { width: 15%; }
.bar > span.w-16, .segbar > span.w-16 { width: 16%; }
.bar > span.w-17, .segbar > span.w-17 { width: 17%; }
.bar > span.w-18, .segbar > span.w-18 { width: 18%; }
.bar > span.w-19, .segbar > span.w-19 { width: 19%; }
.bar > span.w-20, .segbar > span.w-20 { width: 20%; }
.bar > span.w-21, .segbar > span.w-21 { width: 21%; }
.bar > span.w-22, .segbar > span.w-22 { width: 22%; }
.bar > span.w-23, .segbar > span.w-23 { width: 23%; }
.bar > span.w-24, .segbar > span.w-24 { width: 24%; }
.bar > span.w-25, .segbar > span.w-25 { width: 25%; }
.bar > span.w-26, .segbar > span.w-26 { width: 26%; }
.bar > span.w-27, .segbar > span.w-27 { width: 27%; }
.bar > span.w-28, .segbar > span.w-28 { width: 28%; }
.bar > span.w-29, .segbar > span.w-29 { width: 29%; }
.bar > span.w-30, .segbar > span.w-30 { width: 30%; }
.bar > span.w-31, .segbar > span.w-31 { width: 31%; }
.bar > span.w-32, .segbar > span.w-32 { width: 32%; }
.bar > span.w-33, .segbar > span.w-33 { width: 33%; }
.bar > span.w-34, .segbar > span.w-34 { width: 34%; }
.bar > span.w-35, .segbar > span.w-35 { width: 35%; }
.bar > span.w-36, .segbar > span.w-36 { width: 36%; }
.bar > span.w-37, .segbar > span.w-37 { width: 37%; }
.bar > span.w-38, .segbar > span.w-38 { width: 38%; }
.bar > span.w-39, .segbar > span.w-39 { width: 39%; }
.bar > span.w-40, .segbar > span.w-40 { width: 40%; }
.bar > span.w-41, .segbar > span.w-41 { width: 41%; }
.bar > span.w-42, .segbar > span.w-42 { width: 42%; }
.bar > span.w-43, .segbar > span.w-43 { width: 43%; }
.bar > span.w-44, .segbar > span.w-44 { width: 44%; }
.bar > span.w-45, .segbar > span.w-45 { width: 45%; }
.bar > span.w-46, .segbar > span.w-46 { width: 46%; }
.bar > span.w-47, .segbar > span.w-47 { width: 47%; }
.bar > span.w-48, .segbar > span.w-48 { width: 48%; }
.bar > span.w-49, .segbar > span.w-49 { width: 49%; }
.bar > span.w-50, .segbar > span.w-50 { width: 50%; }
.bar > span.w-51, .segbar > span.w-51 { width: 51%; }
.bar > span.w-52, .segbar > span.w-52 { width: 52%; }
.bar > span.w-53, .segbar > span.w-53 { width: 53%; }
.bar > span.w-54, .segbar > span.w-54 { width: 54%; }
.bar > span.w-55, .segbar > span.w-55 { width: 55%; }
.bar > span.w-56, .segbar > span.w-56 { width: 56%; }
.bar > span.w-57, .segbar > span.w-57 { width: 57%; }
.bar > span.w-58, .segbar > span.w-58 { width: 58%; }
.bar > span.w-59, .segbar > span.w-59 { width: 59%; }
.bar > span.w-60, .segbar > span.w-60 { width: 60%; }
.bar > span.w-61, .segbar > span.w-61 { width: 61%; }
.bar > span.w-62, .segbar > span.w-62 { width: 62%; }
.bar > span.w-63, .segbar > span.w-63 { width: 63%; }
.bar > span.w-64, .segbar > span.w-64 { width: 64%; }
.bar > span.w-65, .segbar > span.w-65 { width: 65%; }
.bar > span.w-66, .segbar > span.w-66 { width: 66%; }
.bar > span.w-67, .segbar > span.w-67 { width: 67%; }
.bar > span.w-68, .segbar > span.w-68 { width: 68%; }
.bar > span.w-69, .segbar > span.w-69 { width: 69%; }
.bar > span.w-70, .segbar > span.w-70 { width: 70%; }
.bar > span.w-71, .segbar > span.w-71 { width: 71%; }
.bar > span.w-72, .segbar > span.w-72 { width: 72%; }
.bar > span.w-73, .segbar > span.w-73 { width: 73%; }
.bar > span.w-74, .segbar > span.w-74 { width: 74%; }
.bar > span.w-75, .segbar > span.w-75 { width: 75%; }
.bar > span.w-76, .segbar > span.w-76 { width: 76%; }
.bar > span.w-77, .segbar > span.w-77 { width: 77%; }
.bar > span.w-78, .segbar > span.w-78 { width: 78%; }
.bar > span.w-79, .segbar > span.w-79 { width: 79%; }
.bar > span.w-80, .segbar > span.w-80 { width: 80%; }
.bar > span.w-81, .segbar > span.w-81 { width: 81%; }
.bar > span.w-82, .segbar > span.w-82 { width: 82%; }
.bar > span.w-83, .segbar > span.w-83 { width: 83%; }
.bar > span.w-84, .segbar > span.w-84 { width: 84%; }
.bar > span.w-85, .segbar > span.w-85 { width: 85%; }
.bar > span.w-86, .segbar > span.w-86 { width: 86%; }
.bar > span.w-87, .segbar > span.w-87 { width: 87%; }
.bar > span.w-88, .segbar > span.w-88 { width: 88%; }
.bar > span.w-89, .segbar > span.w-89 { width: 89%; }
.bar > span.w-90, .segbar > span.w-90 { width: 90%; }
.bar > span.w-91, .segbar > span.w-91 { width: 91%; }
.bar > span.w-92, .segbar > span.w-92 { width: 92%; }
.bar > span.w-93, .segbar > span.w-93 { width: 93%; }
.bar > span.w-94, .segbar > span.w-94 { width: 94%; }
.bar > span.w-95, .segbar > span.w-95 { width: 95%; }
.bar > span.w-96, .segbar > span.w-96 { width: 96%; }
.bar > span.w-97, .segbar > span.w-97 { width: 97%; }
.bar > span.w-98, .segbar > span.w-98 { width: 98%; }
.bar > span.w-99, .segbar > span.w-99 { width: 99%; }
.bar > span.w-100, .segbar > span.w-100 { width: 100%; }
.hero-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-figure { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.skip-link:focus { position: fixed !important; z-index: 50; top: 8px; left: 8px; width: auto; height: auto; clip: auto; clip-path: none; padding: 8px 14px; border-radius: 12px; background: var(--control); color: var(--control-text); }
button.switch { border: 0; padding: 0; }
button.switch[aria-checked="true"] { background: var(--toggle-on); }
button.switch[aria-checked="true"]::after { transform: translateX(20px); }
form > button.row.danger { margin-top: 14px; min-height: 44px; display: flex; justify-content: center; align-items: center; font-size: 17px; }
.sync-status .row-footer { border-top: 0.5px solid var(--separator); }
.sync-status .kv:first-child { border-top: 0; }
details > summary.btn { list-style: none; width: fit-content; cursor: pointer; }
details > summary.btn::-webkit-details-marker { display: none; }
details[open] > summary.btn { margin-bottom: 4px; }
.list.inset { margin: 10px 0; background: var(--fill-soft); }
.field .segmented { flex: 1; max-width: 260px; margin-left: auto; }
.field .mono, input.mono { font-family: var(--mono); font-size: 14px; }
fieldset.field { border: 0; margin: 0; min-width: 0; }
fieldset.picker { padding: 12px 16px 6px; }
fieldset.picker legend { padding: 0; margin-bottom: 4px; float: left; width: 100%; }
fieldset.picker .swatches { padding: 4px 0 6px; clear: both; }
.swatch-opt span.inherit { background: repeating-linear-gradient(45deg, var(--fill), var(--fill) 4px, var(--card) 4px, var(--card) 8px); }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-opt > span:not(.visually-hidden) { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--fill-soft); color: var(--text); }
.icon-opt input:checked + span { background: var(--control); color: var(--control-text); }
.icon-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.row.child { padding-left: 60px; }
.row.child .row-title { font-size: 15px; }
.order { display: flex; flex-direction: column; gap: 2px; flex: none; }
.order form { margin: 0; }
button.icon { margin: 0; width: 28px; height: 22px; padding: 0; border-radius: 6px; background: var(--fill-soft); color: var(--text); border: 0; font-size: 13px; line-height: 1; }
button.icon:disabled { opacity: 0.35; cursor: default; }
.row.disabled .row-title, .row.disabled .row-sub { color: var(--text-3); }
a.row-body:hover .row-title { text-decoration: underline; text-decoration-color: var(--text-3); }
.row > .row-actions { flex: none; display: flex; align-items: center; gap: 10px; }
.row > .row-actions form { margin: 0; }
/* Fixes after the screenshot review */
.row-value .amount.negative { color: var(--negative); }
.row-value .amount.positive { color: var(--positive); }
.row-value .amount.text-2 { color: var(--text-2); }
form > button.row.danger { background: var(--card); border-radius: var(--radius-card); width: 100%; border: 0; }
#results { display: flex; flex-direction: column; gap: 12px; }
#results .group.day { margin-top: 8px; }
.sheet-form { display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 1024px) {
  body.has-shell { background: linear-gradient(to right, transparent 239.5px, var(--separator) 239.5px, var(--separator) 240px, transparent 240px) var(--bg); }
  .tabbar { border-right: 0; }
}

/* --- Trends (Phase 8b) ------------------------------------------------------------ */
.trends-body { display: flex; flex-direction: column; gap: 16px; }
.range { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: 18px; background: var(--fill); }
.range > a, .range > span { display: flex; align-items: center; justify-content: center; height: 32px; border-radius: 15px; font-size: 14px; font-weight: 600; color: var(--text); }
.range > a[aria-current="page"] { background: var(--segment-on); box-shadow: var(--segment-shadow); }
.range > span[aria-disabled="true"] { color: var(--text-3); cursor: not-allowed; }
.range > a:focus-visible { outline-offset: -2px; border-radius: 15px; }
.trend-grid { display: flex; flex-direction: column; gap: 16px; }
.trend-card { gap: 4px; padding: 16px 16px 14px; }
.trend-card h2.secondary { font-weight: 400; }
.figure-lg { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.4px; }
.figure-lg .unit { font-size: 17px; font-weight: 500; letter-spacing: 0; color: var(--text-2); }
.card-line { font-size: 15px; }
.card-line.positive { color: var(--positive); font-weight: 500; }
.card-line.negative { color: var(--negative); font-weight: 500; }
.card-title { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.chart-box.bars { height: 170px; margin-top: 14px; }
.chart-box.net { height: 130px; margin-top: 14px; }
.chart-box.line { height: 130px; margin-top: 10px; }
.chart-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-2); }
.chart-legend li, .chart-legend a { display: flex; align-items: center; gap: 6px; }
.chart-legend a { color: inherit; }
.chart-legend li.dim { opacity: 0.45; }
.chart-legend .sq { width: 10px; height: 10px; border-radius: 3px; background: var(--c-fill); flex: none; }
.chart-legend .saved .sq { background: var(--chart); }
.as-table { margin-top: 8px; }
.as-table summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); list-style: none; width: fit-content; }
.as-table summary::-webkit-details-marker { display: none; }
.as-table summary::after { content: " ▾"; }
.as-table[open] summary::after { content: " ▴"; }
.as-table .table { margin-top: 8px; font-variant-numeric: tabular-nums; }
.as-table .table .num, .table th.num { text-align: right; }
.change-row .sq-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c-fill); flex: none; }
.change-pct { font-weight: 600; font-size: 17px; }
.changes .footnote { padding: 0 4px; }
.share-row .bar, .bar { display: block; }
.share-row .share-top { display: flex; }
@media (min-width: 1024px) {
  .trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .trends .range { max-width: 420px; }
  .changes { max-width: calc(50% - 10px); }
}

/* --- Subscriptions (Phase 8c) ------------------------------------------------------- */
.subs-body { display: flex; flex-direction: column; gap: var(--section-gap); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-options { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; padding: 6px; border-radius: 14px; background: var(--card); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.06); }
.menu-options form { margin: 0; }
.menu-options button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font-size: 15px; color: var(--text); text-align: left; cursor: pointer; }
.menu-options button:hover { background: var(--fill-soft); }
.hero-amount .unit, .hero-figure .unit { font-size: 17px; font-weight: 500; letter-spacing: 0; color: var(--text-2); }
.subs-total { gap: 4px; }
.subs-total .card-line { color: var(--text); opacity: 0.85; }
.segbar { display: flex; gap: 3px; height: 12px; margin-top: 14px; }
.segbar > span { display: block; flex: 0 1 auto; min-width: 6px; height: 12px; border-radius: 6px; background: var(--c-fill); }
.type-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; font-size: 13px; }
.type-legend li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.type-legend .sq { width: 10px; height: 10px; border-radius: 3px; background: var(--c-fill); flex: none; }
.type-legend .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-legend .amount { color: var(--text-2); }
.upcoming-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.upcoming-card { height: 100%; background: var(--card); border-radius: var(--radius-card); padding: 12px; display: flex; flex-direction: column; gap: 8px; color: inherit; }
.upcoming-card .tile.md { width: 34px; height: 34px; border-radius: 11px; }
.upcoming-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.upcoming-text .name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-card > .amount { font-size: 15px; }
.suggestion { border-radius: var(--radius-hero); padding: 16px; gap: 12px; }
.suggestion-top { display: flex; align-items: center; gap: 12px; }
.tile.lg { width: 40px; height: 40px; border-radius: 12px; }
.tile.warn-tile { background: var(--warn-bg); color: var(--warn-fg); }
.suggestion-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; color: inherit; }
.overline-warn { font-size: 13px; font-weight: 600; color: var(--warn-fg); }
.suggestion-title { font-size: 17px; font-weight: 600; }
.btn-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn-pair form { margin: 0; }
.btn-pair .btn.md { height: 44px; border-radius: 22px; font-size: 15px; padding: 0 8px; }
.section-head.stack { flex-direction: column; align-items: flex-start; gap: 2px; }
.row-title.strong { font-weight: 600; }
.row-text .badge { align-self: flex-start; margin-top: 2px; }
.row-value .caption { font-size: 12px; }
.list .row-footer.missed { gap: 8px; padding: 10px 16px 12px 66px; border-top: 0; }
.row-footer.missed form { margin: 0; }
.row-footer.missed .caption { flex: 1 1 100%; }
@media (min-width: 1024px) { .row-footer.missed .caption { flex: 1 1 0; } }
.field > .label.long { width: 150px; }
details.collapsible > summary { list-style: none; cursor: pointer; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary .section-title::after { content: " ▾"; font-size: 15px; color: var(--text-2); }
details.collapsible[open] > summary .section-title::after { content: " ▴"; }
details.collapsible[open] > summary { margin-bottom: 8px; }
.field .unit-after { flex: none; font-size: 17px; color: var(--text-2); }
.field input[type=date] { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 17px; color: var(--text); text-align: right; padding: 12px 0; justify-content: flex-end; }
.field input[type=date]::-webkit-date-and-time-value { text-align: right; }
.field.repeats { padding: 10px 16px 12px; }
.field.repeats legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 17px; }
.field.repeats .segmented { clear: both; max-width: none; margin: 0; }
.field.repeats .segmented span { font-size: 14px; }
.custom-only, .match-only, .match-only-text { display: none; }
form:has(input[name="frequency"][value="custom"]:checked) .custom-only { display: flex; }
form:has(input[name="match_enabled"]:checked) .match-only { display: flex; }
form:has(input[name="match_enabled"]:checked) .match-only-text { display: block; }
form:has(input[name="match_enabled"]:checked) .match-off-text { display: none; }
.field [aria-invalid="true"] { color: var(--negative); }
.helper.error { color: var(--negative); }
.helper.centred { text-align: center; margin-top: 6px; }
@media (max-width: 380px) { .upcoming-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Passkeys and sessions (Phase 8d) ------------------------------------------------- */
.title-2 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.group-stack { display: flex; flex-direction: column; gap: 14px; }
.password-fallback { display: flex; flex-direction: column; gap: 12px; }
.password-fallback > summary.btn { width: 100%; list-style: none; cursor: pointer; }
.password-fallback > summary::-webkit-details-marker { display: none; }
.password-fallback[open] > summary { margin-bottom: 12px; }
.auth-body > .btn.lg, .password-fallback > summary { justify-content: center; }
.passkey-row { list-style: none; }
.passkey-row.sep > .row .row-body { border-top: 0.5px solid var(--separator); }
.passkey-row .row-footer { padding-left: 58px; }
.passkey-row .rename { display: flex; flex: 1; gap: 8px; min-width: 12rem; margin: 0; }
.passkey-row form { margin: 0; }
.input-inline { flex: 1; min-width: 0; border: 0; border-radius: 10px; background: var(--fill-soft); padding: 6px 10px; font-size: 15px; color: var(--text); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pills:empty { display: none; }
.step-up .sheet-hero p { max-width: 340px; }
.btn[aria-busy="true"] { opacity: 0.6; }
dialog#passkey-offer .sheet-scroll { gap: 14px; }
