/* Hearth & Vow companion app. The planner's Garden identity: ivory, paper, sage and a touch of gold. */
:root {
  --ivory: #f7f3ea;
  --ivory-2: #efe9db;
  --paper: #fffdf8;
  --white: #ffffff;
  --ink: #2a2c25;
  --ink-soft: #585b4e;
  --ink-faint: #66695c;        /* 4.5:1 on paper and ivory */
  --line: #e6e2d5;
  --line-strong: #cfd1c3;
  --sage: #7d8a66;
  --sage-deep: #515d3c;
  --sage-darker: #434d31;
  --sage-soft: #e6eadb;
  --gold: #a88c55;
  --gold-deep: #7a6434;        /* text on gold-soft, 5:1 */
  --gold-soft: #f3ecdb;
  --warn: #b5654a;
  --warn-deep: #8f4630;
  --warn-soft: #f7e5dd;

  --display: 'Sorts Mill Goudy', 'Goudy Old Style', Garamond, Georgia, 'Times New Roman', serif;
  --body: 'Jost', 'Century Gothic', 'Avenir Next', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --radius: 20px;
  --shadow: 0 1px 2px rgba(42, 44, 37, 0.04), 0 10px 28px -18px rgba(42, 44, 37, 0.22);
  --tabbar-h: 66px;
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--ivory); overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--ivory); color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  overflow-x: hidden;
}
body.no-tabs { padding-bottom: env(safe-area-inset-bottom); }
html.has-sheet body { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--sage-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
:focus-visible { outline: 2.5px solid var(--sage-deep); outline-offset: 2px; }
h1:focus, main:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }
.icon { flex: none; }
.inline-icon { display: inline-block; vertical-align: -3px; }

/* ---------- layout ---------- */
#app { display: block; }
.screen {
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) var(--gutter-r) 28px var(--gutter-l);
  display: flex; flex-direction: column; gap: 16px;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13.5px; line-height: 1.45; }
.center { text-align: center; }
.pad { padding: 18px; }
.pad-x { padding: 0 16px 12px; }
.warn { color: var(--warn-deep); }
.boot { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink-soft); }
.noscript { padding: 24px; text-align: center; }

/* ---------- headers ---------- */
.top { display: flex; flex-direction: column; gap: 2px; padding: 2px 2px 2px; }
.top-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top-text { min-width: 0; }
.kicker { font: 500 11.5px/1.3 var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--sage-deep); margin-bottom: 6px; }
.top h1 { font: 400 34px/1.08 var(--display); letter-spacing: -0.005em; color: var(--ink); }
.top-sub { color: var(--ink-soft); font-size: 15px; margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 2px; margin: -6px 0 6px -10px; min-height: 44px; padding: 0 12px 0 6px; color: var(--sage-deep); font-weight: 500; font-size: 15px; text-decoration: none; align-self: flex-start; border-radius: 999px; }
.section-title { font: 400 22px/1.2 var(--display); margin: 8px 2px -4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.section-head .section-title { margin: 0 2px; }

/* home */
.home-top { position: relative; padding-right: 96px; min-height: 120px; }
.home-sprig { position: absolute; right: -4px; top: 4px; width: 112px; height: auto; opacity: 0.95; transform: rotate(-8deg); }
.home-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.big-num { font: 400 68px/0.92 var(--display); color: var(--sage-deep); letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.big-unit { font: 400 29px/1.15 var(--display); color: var(--ink); }

/* ---------- cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 6px 18px; }
.card-title { font: 400 21px/1.25 var(--display); color: var(--ink); }
.list-card > .card-title, .tips > .card-title { padding: 16px 18px 6px; }
.card-sub { font-size: 13.5px; color: var(--ink-faint); margin-top: 2px; }
.link-more { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -8px -6px -8px 0; padding: 0 6px; color: var(--sage-deep); font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; }
.card-foot-link { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 50px; padding: 0 16px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--sage-deep); font: 500 14.5px var(--body); text-decoration: none; cursor: pointer; border-radius: 0 0 var(--radius) var(--radius); }
.card-foot-link:hover, .list-row:hover, .pay-main:hover { background-color: rgba(230, 234, 219, 0.35); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font: 500 15.5px/1.2 var(--body); letter-spacing: 0.01em; text-decoration: none; cursor: pointer; text-align: center;
  transition: background-color .18s, color .18s, border-color .18s, transform .12s;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--sage-deep); color: var(--paper); box-shadow: 0 6px 16px -10px rgba(81, 93, 60, 0.8); }
.btn-primary:hover { background: var(--sage-darker); }
.btn-secondary { background: var(--sage-soft); color: var(--sage-deep); }
.btn-secondary:hover { background: #dce2cc; }
.btn-quiet { background: transparent; color: var(--sage-deep); border-color: var(--line-strong); }
.btn-quiet:hover { background: rgba(230, 234, 219, 0.5); }
.btn-danger { background: var(--warn-deep); color: var(--white); }
.btn-danger-quiet { background: transparent; color: var(--warn-deep); border-color: #e8cabd; }
.btn-link { background: transparent; color: var(--sage-deep); }
.btn-link:hover { background: rgba(230, 234, 219, 0.5); }
.btn-small { min-height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-pill { position: relative; min-height: 36px; padding: 0 14px; font-size: 13.5px; background: var(--sage-soft); color: var(--sage-deep); border-radius: 999px; }
.btn-pill::after { content: ''; position: absolute; inset: -5px -2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row > .btn { flex: 1 1 auto; }
label.btn:has(+ input:focus-visible), label.quick-btn:has(+ input:focus-visible) { outline: 2.5px solid var(--sage-deep); outline-offset: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 999px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; padding: 0; }
.icon-btn:hover { background: rgba(42, 44, 37, 0.05); }
.btn-round { background: var(--sage-deep); color: var(--paper); box-shadow: 0 6px 14px -8px rgba(81, 93, 60, 0.9); }
.btn-round:hover { background: var(--sage-darker); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 253, 248, 0.4); border-top-color: var(--paper); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; min-width: 0; }
.field[hidden] { display: none; }
.field-label { display: flex; align-items: center; gap: 8px; font: 500 13.5px/1.3 var(--body); color: var(--ink-soft); margin-bottom: 6px; }
.field-hint { font-size: 12.5px; line-height: 1.4; color: var(--ink-faint); margin-top: 6px; }
.input {
  display: block; width: 100%; min-height: 50px; padding: 12px 14px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--white);
  font: 400 16px/1.3 var(--body); color: var(--ink);
  -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-faint); opacity: 1; }   /* 4.5:1 on white */
.input:focus { outline: none; border-color: var(--sage-deep); box-shadow: 0 0 0 3px rgba(125, 138, 102, 0.22); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input[type="date"].input { min-height: 50px; line-height: 24px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.55; }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.select { padding-right: 40px; background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23585b4e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; text-overflow: ellipsis; }
.select-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.select-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money { display: flex; align-items: center; min-height: 50px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--white); padding-left: 14px; transition: border-color .15s, box-shadow .15s; }
.money:focus-within { border-color: var(--sage-deep); box-shadow: 0 0 0 3px rgba(125, 138, 102, 0.22); }
.money-sym { color: var(--ink-faint); margin-right: 4px; white-space: nowrap; }
.money .input { border: 0; box-shadow: none; background: transparent; padding-left: 0; min-height: 48px; font-variant-numeric: tabular-nums; }
.field-check .input, .field-check .money { border-color: var(--gold); background-color: #fffaf0; }
.field-check .money .input { background: transparent; }
.check-badge { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; background: var(--gold-soft); color: var(--gold-deep); padding: 2px 8px; border-radius: 999px; font-weight: 500; }
.form-error { color: var(--warn-deep); font-size: 14px; }
.form-error:empty { display: none; }
fieldset.group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
fieldset.group legend { font: 400 20px/1.2 var(--display); padding: 0; margin-bottom: 14px; color: var(--ink); }
.review > fieldset.group + fieldset.group, .review > details.group { margin-top: 10px; }
details.more-details > summary, details.lines > summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 44px; color: var(--sage-deep); font-weight: 500; cursor: pointer; }
details.more-details > summary::-webkit-details-marker, details.lines > summary::-webkit-details-marker { display: none; }
details.more-details > summary::after, details.lines > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); margin: -4px 0 0 6px; transition: transform .2s; }
details[open].more-details > summary::after, details[open].lines > summary::after { transform: rotate(225deg); margin-top: 4px; }
.lines ul { list-style: none; padding: 0; margin: 4px 0 0; }
.lines li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.lines li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

.segmented { display: flex; gap: 2px; background: var(--ivory-2); border-radius: 999px; padding: 4px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 8px; border-radius: 999px; font: 500 14.5px var(--body); color: var(--ink-soft); cursor: pointer; transition: background-color .18s, color .18s; white-space: nowrap; }
.segmented input:checked + label { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(42, 44, 37, 0.12); }
.segmented input:focus-visible + label { outline: 2.5px solid var(--sage-deep); outline-offset: 1px; }
.seg-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(42, 44, 37, 0.07); font-size: 12px; font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-btn { background: var(--ivory-2); color: var(--ink); font-size: 24px; line-height: 1; }
.stepper-input { width: 76px; text-align: center; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.stepper-input::-webkit-outer-spin-button, .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- chips and callouts ---------- */
.chip { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 13.5px; line-height: 1.35; color: var(--sage-deep); background: var(--sage-soft); padding: 8px 14px; border-radius: 16px; }
.chip-quiet { background: var(--ivory-2); color: var(--ink-soft); }
.chip-warn { background: var(--warn-soft); color: var(--warn-deep); }
.chip-tiny { padding: 3px 9px 3px 7px; font-size: 12px; gap: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.stack > .chips { justify-content: flex-start; margin-top: -4px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font: 400 14px var(--body); color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--sage); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--sage-soft); font-size: 14px; line-height: 1.45; }
.callout .icon { color: var(--sage-deep); margin-top: 1px; }
.callout-gold { background: var(--gold-soft); }
.callout-gold .icon { color: var(--gold-deep); }
.callout-warn { background: var(--warn-soft); }
.callout-warn .icon { color: var(--warn-deep); }
.confidence { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--sage-deep); }
.conf-medium, .conf-low { color: var(--gold-deep); }

/* ---------- empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 20px 24px; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 4px; border-radius: 50%; background: var(--ivory); border: 1px solid var(--line); color: var(--gold-deep); }
.empty h3 { font: 400 20px/1.25 var(--display); }
.empty p { max-width: 32ch; color: var(--ink-soft); font-size: 14.5px; }
.empty .btn, .empty .chips { margin-top: 8px; }

/* ---------- budget ring and bars ---------- */
.budget-body { display: flex; align-items: center; gap: 20px; padding: 6px 18px 18px; }
.ring-wrap { position: relative; flex: none; }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: var(--ivory-2); }
.ring-paid { stroke: var(--sage-deep); }
.ring-committed { stroke: var(--gold); }
.ring-over .ring-track { stroke: var(--warn-soft); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 24px; }
.ring-value { display: block; font: 400 20px/1.1 var(--display); font-variant-numeric: lining-nums; max-width: 100%; white-space: nowrap; overflow-wrap: normal; }
.ring-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-top: 3px; }
.ring-over + .ring-center .ring-value { color: var(--warn-deep); }
.budget-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
.legend { list-style: none; margin: 0; padding: 0; }
/* narrow (phones): the label sits above its amount, so seven-digit amounts never run into "Committed" */
.legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr); column-gap: 10px; row-gap: 1px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.legend li .legend-value { grid-column: 2; }
@container (min-width: 250px) {
  .legend li { grid-template-columns: 10px auto minmax(0, 1fr); padding: 8px 0; }
  .legend li .legend-value { grid-column: auto; text-align: right; }
}
.legend li:last-child { border-bottom: 0; }
.legend-label { color: var(--ink-soft); }
.legend-value { display: block; min-width: 0; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-paid { background: var(--sage-deep); }
.dot-committed { background: var(--gold); }
.dot-left { background: var(--ivory-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.bar { display: flex; height: 8px; border-radius: 999px; background: var(--ivory-2); overflow: hidden; }
.bar-paid { background: var(--sage-deep); }
.bar-committed { background: var(--gold); }

.totals { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); }
.stat-value { display: block; min-width: 0; font: 400 25px/1.15 var(--display); font-variant-numeric: lining-nums; white-space: nowrap; }   /* never "…": fitText shrinks it */
.stat.paid .stat-label::before, .stat.committed .stat-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--sage-deep); }
.stat.committed .stat-label::before { background: var(--gold); }
.stat.warn .stat-value { color: var(--warn-deep); }
.stat-edit { text-align: left; background: var(--ivory); border: 1px dashed var(--line-strong); border-radius: 14px; padding: 8px 10px; margin: -9px -11px; cursor: pointer; color: inherit; }
.stat-edit .stat-label { color: var(--sage-deep); }
.totals-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.totals-foot .btn { margin: -4px 0; }

.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-card { display: block; padding: 14px 16px 12px; text-decoration: none; color: inherit; transition: border-color .15s, transform .12s; }
.cat-card:active { transform: scale(0.992); }
.cat-card:hover { border-color: var(--line-strong); }
.cat-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin-bottom: 10px; }
.cat-top h3 { flex: 1 1 11ch; min-width: 0; }
.nowrap { white-space: nowrap; }
.cat-top + .cat-bottom { margin-top: 0; }
.cat-top h3 { font: 400 19px/1.25 var(--display); }
.cat-amount { flex: 0 1 auto; max-width: 100%; margin-left: auto; text-align: right; font-size: 13.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cat-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ink-faint); min-height: 22px; }

.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-card { overflow: hidden; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 6px 2px 18px; }
.item-head h3 { font: 400 20px/1.25 var(--display); }
.item-head p { font-size: 14px; }
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 18px 14px; }
.num { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.num-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.num-value { display: block; min-width: 0; font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.paid .num-value { color: var(--sage-deep); }
.num.due .num-value { color: var(--gold-deep); }
.mini-pays { list-style: none; margin: 0; padding: 0; }
.mini-pay { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); padding: 0 12px 0 18px; min-height: 54px; }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage-deep); flex: none; }
.mini-upcoming .mini-dot { background: var(--gold); }
.mini-overdue .mini-dot { background: var(--warn); }
.mini-text { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-soft); }
.mini-overdue .mini-text { color: var(--warn-deep); font-weight: 500; }
.mini-amount { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: 4px; }
.mini-photo { color: var(--sage-deep); }

.split-list { list-style: none; margin: 0; padding: 0; }
.split-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.split-name { display: flex; flex-direction: column; font-size: 15px; }
.split-share { font-size: 12.5px; color: var(--ink-faint); }
.split-amount { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 94px; padding: 14px 6px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); font: 500 13.5px/1.2 var(--body); color: var(--ink); text-decoration: none; cursor: pointer; text-align: center; transition: transform .12s, border-color .15s; }
.quick-btn:active { transform: scale(0.97); }
.quick-btn:hover { border-color: var(--line-strong); }
.quick-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); }
.quick-btn:first-child .quick-mark { background: var(--sage-deep); color: var(--paper); }

/* ---------- lists ---------- */
.list-card { overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 12px 14px 12px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
.list-card > .list-row:first-child { border-top: 0; }
.row-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 13px; background: var(--ivory); color: var(--sage-deep); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 500; font-size: 15.5px; line-height: 1.3; }
.row-sub { font-size: 13.5px; color: var(--ink-faint); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { color: var(--line-strong); }

.pay-list > .pay-row + .pay-row { border-top: 1px solid var(--line); }
.card-head + .pay-list { border-top: 1px solid var(--line); }
.pay-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px 10px 16px; }
.thumb { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; overflow: hidden; border-radius: 13px; border: 1px solid var(--line); background: var(--ivory); color: var(--ink-faint); cursor: pointer; }
.thumb:disabled { cursor: default; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pay-paid .thumb:disabled { color: var(--sage-deep); background: var(--sage-soft); border-color: transparent; }
.pay-overdue .thumb:disabled { color: var(--warn-deep); background: var(--warn-soft); border-color: transparent; }
.pay-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; min-height: 48px; justify-content: center; padding: 2px 0; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 8px; }
.pay-title { font-weight: 500; font-size: 15.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-sub { font-size: 13.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-when { font-size: 12.5px; color: var(--ink-faint); }
.pay-overdue .pay-when { color: var(--warn-deep); font-weight: 500; }
.pay-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pay-amount { font-weight: 500; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-paid .pay-amount { color: var(--sage-deep); }
.pay-refund .pay-amount { color: var(--gold-deep); }
.seg-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 4px 0; margin-bottom: 10px; }
.seg-total span { font-size: 11.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-faint); }
.seg-total strong { display: block; min-width: 0; font: 400 27px/1.1 var(--display); font-variant-numeric: lining-nums; text-align: right; }
.seg-total.warn strong { color: var(--warn-deep); }

/* ---------- tasks ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; border-top: 1px solid var(--line); }
.task-label { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; min-height: 50px; padding: 13px 12px 13px 18px; cursor: pointer; }
.task-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.task-box { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 8px; border: 1.6px solid var(--line-strong); background: var(--white); color: transparent; transition: background-color .15s, border-color .15s; }
.task-check:checked + .task-box { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--paper); }
.task-check:focus-visible + .task-box { outline: 2.5px solid var(--sage-deep); outline-offset: 2px; }
.task-title { font-size: 15px; line-height: 1.45; padding-top: 1px; }
.task.done .task-title { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: rgba(88, 91, 78, 0.45); }
.task-del { color: var(--ink-faint); margin-right: 6px; }
.all-done { display: flex; align-items: center; gap: 8px; padding: 14px 18px; color: var(--sage-deep); font-size: 14.5px; border-top: 1px solid var(--line); }
.progress-card { display: flex; flex-direction: column; gap: 12px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.progress-top strong { font: 400 26px var(--display); margin-right: 2px; }
.periods { display: flex; flex-direction: column; gap: 10px; }
.period { overflow: hidden; }
.period-now { border-color: rgba(81, 93, 60, 0.4); }
.period-head { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 12px 12px 18px; cursor: pointer; }
.period-head::-webkit-details-marker { display: none; }
.period-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.period-name { font: 400 19px/1.25 var(--display); }
.period-date { font-size: 13px; color: var(--ink-faint); }
.period-now .period-date { color: var(--sage-deep); font-weight: 500; }
.period-late .period-date { color: var(--warn-deep); }
.period-count { font-size: 12.5px; font-variant-numeric: tabular-nums; background: var(--ivory); border-radius: 999px; padding: 4px 10px; color: var(--ink-soft); white-space: nowrap; }
.period-count.complete { background: var(--sage-soft); color: var(--sage-deep); }
.period-chev { color: var(--ink-faint); transition: transform .2s; }
details[open] > .period-head .period-chev { transform: rotate(180deg); }
.add-task { display: flex; gap: 8px; align-items: center; padding: 10px 12px 14px 18px; border-top: 1px solid var(--line); }
.add-task .input { min-height: 46px; }
.add-task .btn-round { width: 44px; height: 44px; }

/* ---------- scan ---------- */
.scan-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 20px 20px; text-align: center; background: radial-gradient(120% 70% at 50% 0%, #fbf7ee 0%, var(--paper) 70%); }
.scan-hero h2 { font: 400 26px/1.15 var(--display); margin-top: 6px; }
.scan-hero > p { font-size: 15px; max-width: 30ch; }
.scan-art { position: relative; display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; background: var(--ivory); border: 1px solid var(--line); }
.scan-paper { display: flex; flex-direction: column; gap: 7px; width: 54px; height: 70px; padding: 13px 10px; background: var(--white); border-radius: 6px; box-shadow: 0 8px 16px -8px rgba(42, 44, 37, 0.35); transform: rotate(-5deg); }
.scan-paper i { display: block; height: 4px; border-radius: 2px; background: var(--ivory-2); }
.scan-paper i.short { width: 58%; background: var(--gold); opacity: 0.7; margin-top: auto; }
.scan-spark { position: absolute; right: 10px; top: 8px; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--paper); color: var(--gold-deep); box-shadow: 0 4px 12px -6px rgba(42, 44, 37, 0.4); }
.scan-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 10px; }
.tips { padding: 0 4px; }
.tips > .card-title { padding: 4px 0 6px; font-size: 18px; }
.tips ul { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 14.5px; display: flex; flex-direction: column; gap: 4px; }
.tips li::marker { color: var(--gold); }
.stack-sm { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.review-head { display: flex; align-items: center; gap: 12px; }
.review-thumb { flex: none; width: 48px; height: 48px; padding: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--ivory); cursor: zoom-in; }
.review-thumb img { width: 100%; height: 100%; object-fit: cover; }
.note-callout { border-radius: 14px; background: var(--gold-soft); font-size: 14px; line-height: 1.45; }
.note-callout > summary { list-style: none; display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 12px 14px; cursor: pointer; }
.note-callout > summary::-webkit-details-marker { display: none; }
.note-callout > summary .icon { color: var(--gold-deep); margin-top: 1px; }
.note-line { min-width: 0; flex: 1; }
.note-callout:not([open]) .note-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-callout:not([open]) > summary::after { content: 'More'; flex: none; color: var(--gold-deep); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.photo-peek { border: 1px solid var(--line); border-radius: 16px; background: var(--ivory); overflow: hidden; }
.photo-peek > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; font-weight: 500; color: var(--sage-deep); cursor: pointer; }
.photo-peek > summary::-webkit-details-marker { display: none; }
.photo-peek-hint { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--ink-faint); }
.photo-peek-img { display: block; width: 100%; padding: 0 8px 8px; border: 0; background: none; cursor: zoom-in; }
.photo-peek-img img { width: 100%; max-height: 34vh; max-height: 34dvh; object-fit: contain; border-radius: 10px; background: var(--white); }
.fx .fx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fx-label { white-space: nowrap; font-weight: 500; }
.fx { display: block; }
.fx-rate { width: 5.5em; flex: 0 1 5.5em; min-height: 44px; padding: 8px 12px; }
.fx-row .btn { padding: 0 16px; }
.fx-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.fx-check input { width: 22px; height: 22px; accent-color: var(--sage-deep); flex: none; }
.foot-stack { display: flex; flex-direction: column; gap: 8px; }
.check-note { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; margin: -6px 0 -4px; border: 0; background: none; color: var(--gold-deep); font: 500 14px var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.check-note[hidden] { display: none; }
.review-photo { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--ivory); text-align: left; font: 500 14px var(--body); color: var(--ink-soft); cursor: pointer; }
.review-photo img { width: 58px; height: 58px; object-fit: cover; border-radius: 11px; }
.review-photo span { display: inline-flex; align-items: center; gap: 6px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--ivory); border: 1px solid var(--line); }
.plan-label { font-weight: 500; font-size: 14.5px; }
.foot-row > .btn { flex: 1 1 0; }
.review [hidden], .foot-row > [hidden] { display: none !important; }
.photo-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-box .review-photo { flex: 1 1 200px; }
.proc { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 0 18px; text-align: center; }
.proc-photo { position: relative; width: 172px; height: 228px; overflow: hidden; border-radius: 16px; background: var(--ivory); box-shadow: 0 16px 36px -18px rgba(42, 44, 37, 0.5); }
.proc-photo img { width: 100%; height: 100%; object-fit: cover; }
.proc-line { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 14px 2px rgba(168, 140, 85, 0.65); animation: scanline 1.8s ease-in-out infinite alternate; }
@keyframes scanline { to { top: calc(100% - 3px); } }
.proc-status { font: 400 21px/1.3 var(--display); }

/* ---------- welcome ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(env(safe-area-inset-bottom) + 20px); gap: 20px; }
.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 4px; }
.welcome-mark { position: relative; width: min(196px, 52vw); margin-bottom: 6px; }
.welcome-emblem { width: 100%; height: auto; }
.monogram { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.06em; font: 400 clamp(40px, 13vw, 54px)/1 var(--display); color: var(--sage-deep); letter-spacing: 0.01em; padding-bottom: 4px; }
.monogram em { font-style: italic; font-size: 0.62em; color: var(--gold); align-self: center; margin: 0.28em 0.04em 0; }
.welcome-hero h1, .welcome-head h1 { font: 400 34px/1.1 var(--display); }
.lede { color: var(--ink-soft); font-size: 16px; max-width: 32ch; margin: 6px auto 0; }
.welcome-head { margin-top: 6px; }
.welcome-head .lede { margin-left: 0; }
.features { list-style: none; margin: 0; padding: 18px; display: flex; flex-direction: column; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.features li { display: flex; gap: 14px; align-items: flex-start; }
.feature-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); }
.features h3 { font: 500 15.5px/1.3 var(--body); margin-top: 2px; }
.features p { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.welcome-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.steps { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.steps span { width: 6px; height: 6px; border-radius: 3px; background: var(--line-strong); transition: width .2s; }
.steps span.on { width: 20px; background: var(--sage-deep); }

/* ---------- small cards ---------- */
.install-card, .nudge { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.nudge { align-items: flex-start; background: linear-gradient(180deg, #fcf8ee, var(--paper)); border-color: rgba(168, 140, 85, 0.35); }
.install-mark, .nudge-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 13px; background: var(--ivory); color: var(--sage-deep); }
.nudge-mark { background: var(--gold-soft); color: var(--gold-deep); }
.install-text, .nudge-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.install-text h3, .nudge-text h3 { font: 500 15.5px/1.3 var(--body); }
.install-text p, .nudge-text p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.nudge-text .btn-row { margin-top: 8px; }
.nudge-text .btn-row > .btn { flex: 0 0 auto; }
.unlock-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 20px 20px; text-align: center; background: linear-gradient(180deg, #fbf6ea, var(--paper) 70%); border-color: rgba(168, 140, 85, 0.35); }
.unlock-mark { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); }
.unlock-card h3 { font: 400 22px/1.2 var(--display); margin-top: 4px; }
.unlock-card p { font-size: 14.5px; color: var(--ink-soft); max-width: 34ch; }
.unlock-card .btn-row { justify-content: center; margin-top: 6px; }
.unlock-card .btn-row > .btn { flex: 0 1 auto; }

/* ---------- guests ---------- */
.guest-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 16px 8px 12px; text-align: center; }
.gstat strong { display: block; font: 400 28px/1.1 var(--display); font-variant-numeric: lining-nums; }
.gstat span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.gstat.ok strong { color: var(--sage-deep); }
.gstat.no strong { color: var(--warn-deep); }
.gstat.wait strong { color: var(--gold-deep); }
.gstat-foot { grid-column: 1 / -1; margin: 12px 8px 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.search-row { position: relative; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search-row .input { padding-left: 46px; border-radius: 999px; background: var(--paper); }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); font: 500 14px var(--body); letter-spacing: 0.04em; }
.rsvp { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.rsvp-attending { background: var(--sage-soft); color: var(--sage-deep); }
.rsvp-declined { background: var(--warn-soft); color: var(--warn-deep); }
.rsvp-awaiting { background: var(--gold-soft); color: var(--gold-deep); }

/* ---------- settings & more ---------- */
.set-section { scroll-margin-top: calc(env(safe-area-inset-top) + 12px); }
.set-section > p { font-size: 15px; color: var(--ink-soft); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.link-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.link-list li::marker { color: var(--gold); }
.link-list a { display: inline-flex; align-items: center; min-height: 44px; }
.colophon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 4px; color: var(--ink-faint); font-size: 13px; }
.choice-list { list-style: none; margin: 0; padding: 0; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.choice[aria-selected="true"] { color: var(--sage-deep); }
.choice-code { width: 46px; flex: none; font-weight: 500; color: var(--sage-deep); font-variant-numeric: tabular-nums; }
.choice-name { flex: 1; min-width: 0; }
.choice-tick { color: var(--sage-deep); }
.choice-head { padding: 16px 4px 6px; font-size: 11.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-faint); }
.choice-empty { padding: 20px 4px; color: var(--ink-soft); }
.sticky-search { position: sticky; top: -4px; z-index: 1; padding: 4px 0 8px; background: var(--paper); }
.fatal { align-items: center; justify-content: center; text-align: center; min-height: 90vh; }
.fatal h1 { font: 400 30px var(--display); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
  padding: 6px max(8px, env(safe-area-inset-right), calc((100vw - 640px) / 2)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left), calc((100vw - 640px) / 2));
  background: rgba(255, 253, 248, 0.94);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -24px rgba(42, 44, 37, 0.35);
}
body.no-tabs .tabbar { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 54px; color: var(--ink-faint); text-decoration: none; font: 500 11px/1 var(--body); letter-spacing: 0.03em; border-radius: 14px; }
.tab-icon { display: grid; place-items: center; height: 28px; }
.tab[aria-current="page"] { color: var(--sage-deep); }
.tab[aria-current="page"] .icon { stroke-width: 2; }
.tab-raised .tab-icon {
  width: 60px; height: 60px; margin-top: -30px; border-radius: 50%;
  background: var(--sage-deep); color: var(--paper);
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px rgba(168, 140, 85, 0.45), 0 12px 22px -8px rgba(81, 93, 60, 0.7);
  transition: transform .15s, background-color .15s;
}
.tab-raised:active .tab-icon { transform: scale(0.95); }
.tab-raised[aria-current="page"] .tab-icon { background: var(--sage-darker); }
.tab-raised .tab-label { margin-top: 2px; }

/* ---------- sheets ---------- */
/* --kb: the height the on-screen keyboard covers (iOS); the sheet sits above it, its Save button visible */
.layer { position: fixed; inset: 0 0 var(--kb, 0px) 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(42, 44, 37, 0.4); opacity: 0; transition: opacity .25s; }
.sheet {
  position: relative; width: 100%; max-width: 640px;
  max-height: calc(100vh - env(safe-area-inset-top) - 16px - var(--kb, 0px)); max-height: calc(100dvh - env(safe-area-inset-top) - 16px - var(--kb, 0px));
  display: flex; flex-direction: column; background: var(--paper);
  border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(42, 44, 37, 0.2);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.sheet-full { height: calc(100vh - env(safe-area-inset-top) - 10px - var(--kb, 0px)); height: calc(100dvh - env(safe-area-inset-top) - 10px - var(--kb, 0px)); }
.layer.open .sheet-backdrop { opacity: 1; }
.layer.open .sheet { transform: none; }
.sheet-grab { width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--line-strong); flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 14px 6px 22px; flex: none; }
.sheet-head h2:focus, .sheet:focus { outline: none; }
.sheet-head h2 { font: 400 25px/1.2 var(--display); padding-top: 6px; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 22px 22px; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.sheet-dialog .sheet-body { padding-bottom: 8px; }
.dialog-text { color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.sheet-dialog .btn-row > .btn { flex: 1 1 0; }
.sheet-proc .sheet-head { padding-top: 0; }

/* ---------- toasts, viewer ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 70; width: min(560px, calc(100% - 32px)); pointer-events: none; }
body.no-tabs .toasts { bottom: calc(env(safe-area-inset-bottom) + 16px); }
/* while a sheet is open its Save button sits at the bottom: show messages at the top instead */
html.has-sheet .toasts { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; }
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px 12px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); font-size: 14.5px; line-height: 1.4; box-shadow: 0 14px 32px -14px rgba(0, 0, 0, 0.5); animation: toast-in .28s cubic-bezier(.2, .8, .2, 1); pointer-events: auto; }
.toast-action { min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: #e6d3a3; font-weight: 500; cursor: pointer; white-space: nowrap; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(22, 23, 19, 0.95); }
.viewer-scroll { width: 100%; height: 100%; overflow: auto; display: flex; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top) + 60px) 12px calc(env(safe-area-inset-bottom) + 24px); touch-action: pan-x pan-y pinch-zoom; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer-x { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: max(10px, env(safe-area-inset-right)); color: var(--white); background: rgba(255, 255, 255, 0.14); }
.viewer-x:hover { background: rgba(255, 255, 255, 0.24); }

/* ---------- sizes ---------- */
/* phones: an item's four amounts as a 2 x 2 grid, so seven-digit amounts are never cut off */
@media (max-width: 419px) {
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
}
@media (max-width: 359px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .big-num { font-size: 56px; }
  .top h1, .welcome-hero h1, .welcome-head h1 { font-size: 30px; }
  .budget-body { flex-direction: column; align-items: stretch; }
  .budget-body .ring-wrap { align-self: center; }
  .quick-btn { font-size: 12.5px; }
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-top { padding-right: 70px; }
  .home-sprig { width: 84px; }
}
@media (min-width: 700px) {
  .screen { padding-top: calc(env(safe-area-inset-top) + 36px); gap: 18px; }
  .cat-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; max-height: min(86vh, 900px); }
  .sheet-full { height: min(86vh, 900px); }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 12px; }
  .sheet-foot { padding-bottom: 14px; border-radius: 0 0 26px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- on-device receipt reader ---------- */
.btn[hidden], .proc-bar[hidden] { display: none !important; }
.proc-bar { width: min(260px, 100%); height: 8px; border-radius: 999px; background: var(--ivory-2); overflow: hidden; }
.proc-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--sage), var(--gold)); transition: width .25s ease-out; }
.proc-note { max-width: 32ch; }
.reader-chips { justify-content: flex-start; }
.ask-cloud { align-self: flex-start; }
.reader-choice .segmented { border-radius: 18px; }
.reader-choice .segmented label { white-space: normal; border-radius: 14px; min-height: 58px; padding: 6px 8px; text-align: center; }
.seg-two { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2; }
.seg-two strong { font-weight: 500; font-size: 14.5px; }
.seg-two small { font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.lang-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.lang-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.lang-row input { width: 20px; height: 20px; accent-color: var(--sage-deep); flex: none; }
.lang-name { flex: 1; }
.lang-size { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .proc-fill { transition: none; } }
