@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap;
  src: url(/static/fonts/bricolage-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2013-2014, U+20AC; }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap;
  src: url(/static/fonts/bricolage-latin-ext.woff2) format("woff2"); unicode-range: U+0100-024F; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/manrope-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2013-2014, U+20AC; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/manrope-latin-ext.woff2) format("woff2"); unicode-range: U+0100-024F; }

:root {
  /* neutrals, light */
  --bg:        #f7f6f2;   /* page: a hair warmer than white, no longer beige */
  --surface:   #ffffff;   /* cards, the sticky bar */
  --surface-2: #f1efe9;   /* inset fields, chips at rest, skeletons */
  --ink:       #17171a;
  --ink-2:     #4c4a45;   /* secondary text: product names, meta rows */
  --muted:     #6f6c64;   /* captions, labels */
  --line:      #e6e3dc;
  --line-2:    #d5d1c7;   /* control borders */
  /* accent: one green */
  --accent:      #17804a; /* buttons, selected chips, meter, active tab */
  --accent-ink:  #146f41; /* accent as text, hover */
  --accent-soft: #e4f3ea;
  --on-accent:   #ffffff;
  /* semantic, separate from the accent */
  --promo:      #b45309;  --promo-soft: #fdf1e1;   /* "akcija" */
  --est:        #a64e26;  --est-soft:   #f8e7df;   /* "įvertis", "vid. kaina"; 4.7:1 on est-soft */
  --over:       #c62828;                         /* over budget */
  /* shape */
  --r-sm: 10px; --r: 14px; --r-lg: 22px; --pill: 999px;
  /* depth: layered shadows on every card, a glow on the accent, glass on
     what sticks; the halo is the ambient light behind the page */
  --shadow-1: 0 1px 2px rgba(20, 20, 10, .05), 0 10px 28px -14px rgba(20, 20, 10, .22);
  --shadow-2: 0 2px 4px rgba(20, 20, 10, .06), 0 24px 56px -20px rgba(20, 20, 10, .35);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .7);
  --glow: 0 10px 32px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  --ring: 0 0 0 4px var(--accent-soft);
  --glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --halo-1: color-mix(in srgb, var(--accent) 16%, transparent);
  --halo-2: color-mix(in srgb, var(--promo) 9%, transparent);
  /* type */
  --display: "Bricolage Grotesque", "Segoe UI", Arial, sans-serif;
  --ui: "Manrope", "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0e; --surface: #181817; --surface-2: #222220;
    --ink: #f2f1ec; --ink-2: #c9c6bd; --muted: #8f8b82;
    --line: #2a2a27; --line-2: #3a3935;
    --accent: #4cc07a; --accent-ink: #7ad49a; --accent-soft: #173224; --on-accent: #0f0f0e;
    --promo: #f5a524; --promo-soft: #3a2a10;
    --est: #e8794f;   --est-soft: #3a2419;
    --over: #ff6b6b;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 36px -16px rgba(0, 0, 0, .75);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, .5), 0 28px 64px -20px rgba(0, 0, 0, .9);
    --edge: inset 0 1px 0 rgba(255, 255, 255, .06);
    --glow: 0 10px 36px -8px color-mix(in srgb, var(--accent) 55%, transparent);
    --glass: color-mix(in srgb, var(--surface) 68%, transparent);
    --halo-1: color-mix(in srgb, var(--accent) 18%, transparent);
    --halo-2: color-mix(in srgb, var(--promo) 10%, transparent);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
/* The halo: two soft lights behind the page, fixed so they do not scroll. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 12% -8%, var(--halo-1), transparent 65%),
    radial-gradient(45% 40% at 100% 5%, var(--halo-2), transparent 65%);
}
@media (min-width: 640px) { body { font-size: 16px; } }
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1, h2 { font-family: var(--display); letter-spacing: -.02em; }
p { margin: 0; }
button, input, output { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- motion ---------- */
/* A section rises in when it is shown; everything else answers in 120 ms
   where it is declared. Reduced motion turns all of it off. */
.in { animation: rise .16s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--edge);
}

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1040px; margin: 0 auto; min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand img { border-radius: 7px; box-shadow: var(--shadow-1); }
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill:empty { display: none; }

/* ---------- ask ---------- */
.ask { max-width: 640px; margin: 0 auto; }
.ask h1 { font-size: 32px; line-height: 1.05; margin: 32px 0 12px; font-weight: 700; }
.ask h1 em { display: block; font-style: normal; color: var(--accent-ink); }
.lead { color: var(--ink-2); font-size: 18px; line-height: 1.4; margin-bottom: 32px; max-width: 56ch; }

.form { display: grid; gap: 24px; }
.col { display: grid; gap: 20px; align-content: start; }
.field { display: grid; gap: 8px; }
.field > label, .field > .label { font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { color: var(--muted); font-size: 13px; min-height: 1.3em; }
.fine { color: var(--muted); font-size: 13px; }

.amount { display: inline-flex; justify-self: start; align-items: baseline; gap: 8px; padding: 0 4px 2px 0; border-bottom: 2px solid var(--line-2); transition: border-color .12s; }
.amount input {
  width: 2.4ch; min-width: 1.4ch; max-width: 100%; border: 0; background: transparent; outline: none;
  font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; padding: 0; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.amount input::-webkit-outer-spin-button, .amount input::-webkit-inner-spin-button { -webkit-appearance: none; }
.amount .cur { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--muted); }
.amount:focus-within { border-color: var(--accent); }
.amount:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button { height: 36px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color .12s, color .12s, border-color .12s, box-shadow .12s; }
.quick button:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); box-shadow: var(--shadow-1); }
.quick button[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

.stepper { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--shadow-1), var(--edge); transition: border-color .12s, background-color .12s, transform .12s, box-shadow .12s; }
.stepper button:hover { border-color: var(--accent); box-shadow: var(--shadow-2), var(--edge); }
.stepper button:active { background: var(--accent-soft); transform: scale(.94); }
.stepper output { text-align: center; font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--pill); background: var(--surface-2); color: var(--ink-2); font-weight: 600; transition: background-color .12s, color .12s, border-color .12s, box-shadow .12s; }
.chip span .i { width: 18px; height: 18px; display: none; margin-left: -4px; }
.chip.toggle input:checked + span .i { display: block; }
.chip:hover input:not(:checked) + span { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); box-shadow: var(--shadow-1); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--ring); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.est span::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--est); margin-left: 2px; }
.chip.est input:checked + span::after { background: var(--on-accent); opacity: .85; }

.tiers { display: grid; gap: 8px; }
.tier {
  position: relative; display: grid; gap: 2px; padding: 14px 44px 14px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); cursor: pointer;
  box-shadow: var(--shadow-1), var(--edge);
  transition: transform .12s, box-shadow .12s, border-color .12s, background-color .12s;
}
.tier input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tier:hover { transform: translateY(-1px); box-shadow: var(--shadow-2), var(--edge); border-color: var(--accent); }
.tier:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring), var(--shadow-1); }
.tier:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-name { font-weight: 700; font-size: 16px; }
.t-desc { color: var(--ink-2); font-size: 13px; }
.t-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--accent); color: var(--on-accent); opacity: 0; transform: scale(.7); transition: opacity .12s, transform .15s; }
.tier:has(input:checked) .t-check { opacity: 1; transform: scale(1); }

.more { border-top: 1px solid var(--line); padding-top: 8px; }
.more summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--accent-ink); list-style: none; padding: 10px 0; }
.more summary::-webkit-details-marker { display: none; }
.more summary .i { transition: transform .15s; }
.more[open] summary .i { transform: rotate(180deg); }
.more-in { display: grid; gap: 16px; padding-top: 8px; }
.more input[type=text] { height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); outline: none; width: 100%; transition: border-color .12s, box-shadow .12s, background-color .12s; }
.more input[type=text]:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .knob { flex: none; width: 44px; height: 26px; border-radius: var(--pill); background: var(--line-2); position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.wake { padding: 2px 4px; color: var(--ink-2); font-size: 13px; }
.switch.wake .knob { width: 38px; height: 22px; }
.switch.wake .knob::after { width: 16px; height: 16px; }
.switch.wake input:checked + .knob::after { transform: translateX(16px); }
.wake-note { color: var(--muted); font-weight: 600; font-size: 12px; }
.wake-note.on { color: var(--accent-ink); }
.wake-note:empty { display: none; }

.submit { display: grid; gap: 12px; }
.primary {
  height: 52px; padding: 0 24px; border: 0; border-radius: var(--r); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff) 0%, var(--accent) 60%);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .22);
  font-size: 18px; font-weight: 700; letter-spacing: .01em;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.primary:hover { transform: translateY(-1px); filter: saturate(1.1) brightness(1.03); box-shadow: 0 14px 36px -10px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: .6; cursor: default; transform: none; }
.ghost { height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-1), var(--edge); transition: border-color .12s, color .12s, box-shadow .12s, transform .12s; }
.ghost:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); box-shadow: var(--shadow-2), var(--edge); }
.ghost .i { width: 18px; height: 18px; }
/* signed in with Google: the day's quota and a way out, under the button */
.who { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.quota { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.quota .i { width: 16px; height: 16px; }
.linkish { border: 0; background: none; padding: 6px 0; color: var(--accent-ink); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }

@media (min-width: 640px) {
  .tiers { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .ask { max-width: 880px; }
  .ask h1 { font-size: 44px; }
  .form { grid-template-columns: 1fr 1fr; gap: 32px 40px; }
  .submit { grid-column: 1 / -1; }
  .tiers { grid-template-columns: 1fr; }
}

/* ---------- progress ---------- */
.progress { max-width: 640px; margin: 24px auto 0; }
.prog { padding: 24px 20px; display: grid; gap: 20px; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prog-head h2 { font-size: 28px; }
.elapsed { font-family: var(--display); font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.stages li { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; }
.stages li::before { content: ""; position: absolute; top: 7px; right: 50%; left: -50%; height: 2px; background: var(--line-2); }
.stages li:first-child::before { display: none; }
.stages li.done::before, .stages li.active::before { background: var(--accent); }
.dot { position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); transition: background-color .2s, border-color .2s; }
.stages li.done .dot { background: var(--accent); border-color: var(--accent); }
.stages li.active .dot { background: var(--accent); border-color: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 22%, transparent), var(--glow); }
}
.lbl { display: grid; font-size: 12px; font-weight: 600; color: var(--muted); }
.stages li.active .lbl { color: var(--ink); }
.lbl small { font-size: 11px; font-weight: 500; color: var(--muted); min-height: 1.3em; }
.prog-text { color: var(--ink-2); }
.recap { display: flex; flex-wrap: wrap; gap: 6px; }
.recap span { padding: 4px 10px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.skeleton { display: grid; gap: 14px; padding-top: 4px; }
.sk {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-sum { display: grid; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sk-big { width: 40%; height: 32px; border-radius: 8px; }
.sk-meter { width: 100%; height: 6px; border-radius: var(--pill); }
.sk-row { display: grid; grid-template-columns: 24px 1fr 56px; gap: 12px; align-items: center; }
.sk-c { width: 24px; height: 24px; border-radius: 50%; }
.sk-txt { display: grid; gap: 6px; }
.sk-t { height: 12px; }
.sk-s { height: 9px; }
.sk-p { height: 12px; }
.w30 { width: 30%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; }
.prog-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.error { max-width: 640px; margin: 24px auto 0; padding: 28px 24px; display: grid; gap: 10px; justify-items: start; }
.error h2 { color: var(--over); }

/* ---------- result ---------- */
#result { max-width: 720px; margin: 0 auto; overflow-anchor: none; }
.res { display: grid; gap: 16px; }
.rail { display: grid; gap: 14px; align-content: start; }
.summary { margin-top: 20px; padding: 20px; display: grid; gap: 12px; }
.summary .totals { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.summary .big { font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.summary .of { color: var(--ink-2); font-size: 16px; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06); }
.meter > span { display: block; height: 100%; border-radius: var(--pill); background: linear-gradient(90deg, var(--accent-ink), var(--accent)); box-shadow: var(--glow); animation: fill .6s cubic-bezier(.2, .8, .2, 1); }
.meter > span.over { background: linear-gradient(90deg, var(--over), color-mix(in srgb, var(--over) 75%, #fff)); box-shadow: 0 0 16px -4px var(--over); }
@keyframes fill { from { width: 0; } }
.summary .left { font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.summary .left.over { color: var(--over); }
.summary .meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.est-tag { color: var(--est); font-weight: 600; }
.est-share { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--est-soft); border: 1px solid color-mix(in srgb, var(--est) 22%, transparent); color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.est-share .i { flex: none; width: 18px; height: 18px; color: var(--est); margin-top: 1px; }
.est-share strong { color: var(--est); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* the total in the top bar, while the summary is scrolled away */
.top-total { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 8px; width: 100%; padding: 8px 0; }
.tt-num { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tt-of { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.tt-meter { grid-column: 1 / -1; height: 4px; margin-top: 6px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; }
.tt-meter > span { display: block; height: 100%; border-radius: var(--pill); background: var(--accent); box-shadow: var(--glow); }
.tt-meter > span.over { background: var(--over); }
.top.total-on { box-shadow: var(--shadow-2); }
.top.total-on .brand, .top.total-on .pill { display: none; }

.seg-wrap { position: sticky; top: 53px; z-index: 10; margin: 0 -8px; padding: 8px 8px 12px; }
/* the glass behind the control fades out at its foot, so it has no edge at rest */
.seg-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.seg button { height: 36px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background-color .12s, color .12s, box-shadow .12s; }
.seg button .n { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--pill); background: var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.seg button:hover:not([aria-selected=true]) { color: var(--ink); }
.seg button[aria-selected=true] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-1), var(--edge); }
.seg button[aria-selected=true] .n { background: var(--accent-soft); color: var(--accent-ink); }
.panel { display: grid; gap: 14px; }

.group { padding: 0 0 4px; overflow: clip; }
.group h3 {
  position: sticky; top: 115px; z-index: 5;
  display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.group h3 span { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.line { position: relative; display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; min-height: 56px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; transition: background-color .12s; }
.line:first-of-type { border-top: 0; }
.line:hover { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.line input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.line .check { width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--on-accent); display: grid; place-items: center; transition: background-color .12s, border-color .12s, box-shadow .12s; }
.line .check .i { width: 16px; height: 16px; stroke-width: 2.5; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .15s; }
.line input:checked ~ .check { background: var(--accent); border-color: var(--accent); box-shadow: var(--ring); animation: tick .15s ease-out; }
.line input:checked ~ .check .i { opacity: 1; transform: scale(1); }
.line input:focus-visible ~ .check { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes tick { from { transform: scale(.9); } to { transform: scale(1); } }
.line .what { display: grid; gap: 2px; min-width: 0; }
.line .name { font-weight: 600; }
.line .prod { color: var(--ink-2); font-size: 13px; }
a.prod { text-decoration: underline; text-decoration-color: var(--line, currentColor); text-underline-offset: 2px; }
a.prod:hover { color: var(--ink); }
.line .uses { color: var(--muted); font-size: 12px; }
.line .right { display: grid; justify-items: end; gap: 2px; }
.line .price { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line .qty { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line .unit { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line.done .what, .line.done .right { opacity: .5; }
.line.done .name { text-decoration: line-through; }
.badge { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: var(--pill); background: var(--promo-soft); color: var(--promo); font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: 2px; }
.badge.est { background: var(--est-soft); color: var(--est); }
.badge.chg { background: var(--accent-soft); color: var(--accent-ink); }
.swap-btn { justify-self: start; margin-top: 4px; padding: 4px 0; border: 0; background: none; color: var(--accent-ink); font-size: 12px; font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; cursor: pointer; }
.swap-btn:hover { color: var(--accent); }
.swap-btn[aria-expanded=true] { text-decoration: none; }
.swap { display: grid; gap: 8px; margin: 0 12px 12px 52px; padding: 12px; border-radius: var(--r); background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); border: 1px solid var(--line); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04); animation: rise .18s ease-out; }
.swap[hidden] { display: none; }
.swap-h { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.alt { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; padding: 10px 12px; text-align: left; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; box-shadow: var(--shadow-1), var(--edge); cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s; }
.alt:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-2), var(--edge), var(--glow); }
.alt-name { font-size: 13px; font-weight: 600; min-width: 0; }
.alt-meta { grid-column: 1; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.alt-price { grid-column: 2; grid-row: 1 / 3; display: grid; justify-items: end; align-content: start; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alt-price small { font-size: 11px; font-weight: 700; color: var(--muted); }
.alt-price small.up { color: var(--promo); }
.alt-price small.down { color: var(--accent-ink); }
.alt-new { grid-column: 1 / -1; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.swap .undo { justify-self: start; }
.badge.card { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--promo) 35%, transparent); }
.banner { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--est-soft); border: 1px solid color-mix(in srgb, var(--est) 25%, transparent); color: var(--ink); font-size: 13px; line-height: 1.4; }
.banner .i { color: var(--est); margin-top: 1px; }

.asides { display: grid; gap: 14px; }
.aside summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); transition: color .12s; }
.aside summary::-webkit-details-marker { display: none; }
.aside summary .i { width: 18px; height: 18px; transition: transform .15s; }
.aside[open] summary { color: var(--ink); }
.aside[open] summary .i { transform: rotate(180deg); }
.aside-in { padding: 0 16px 16px; display: grid; gap: 8px; font-size: 14px; }
.aside ul { margin: 0; padding-left: 18px; }
.aside li { margin: 2px 0; }
.aside .notes { white-space: pre-line; }
.feedback { padding: 16px; display: grid; gap: 12px; }
.feedback h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fb-thumbs { display: flex; gap: 8px; }
.fb-thumb { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 600; box-shadow: var(--shadow-1), var(--edge); cursor: pointer; transition: border-color .12s, background-color .12s, color .12s, box-shadow .12s, transform .12s; }
.fb-thumb:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.fb-thumb[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--ring), var(--glow); }
.fb-more { display: grid; gap: 8px; }
.fb-more[hidden] { display: none; }
.fb-label { font-size: 13px; font-weight: 600; }
.fb-label span { color: var(--muted); font-weight: 400; }
.feedback textarea { width: 100%; min-height: 72px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.feedback textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.fb-send { justify-self: start; height: 44px; padding: 0 20px; font-size: 15px; }
.fb-msg { margin: 0; color: var(--over); font-size: 13px; }
.fb-msg:empty { display: none; }
.fb-done { margin: 0; color: var(--accent-ink); font-weight: 600; }

/* ---------- plan ---------- */
.plan { display: grid; gap: 12px; }
.day { padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.day h3 { display: flex; align-items: baseline; gap: 6px; }
.day .dnum { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.day .dlbl { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.meal { display: grid; grid-template-columns: 88px 1fr; gap: 8px; align-items: start; }
.meal .slot { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding-top: 8px; }
.rchip {
  display: grid; gap: 2px; text-align: left; width: 100%; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font-weight: 600; line-height: 1.3;
  transition: border-color .12s, background-color .12s, box-shadow .12s, transform .12s;
}
.rchip:hover { border-color: var(--accent); background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.rchip .serv { color: var(--ink-2); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- recipes ---------- */
.recipe { position: relative; padding: 16px 18px; display: grid; gap: 10px; scroll-margin-top: 128px; }
.recipe h3 { font-family: var(--display); font-size: 22px; line-height: 1.15; }
.recipe .meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.recipe .time-fix { color: var(--ink-2); font-weight: 600; }
.ings { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 24px; }
.ings li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; break-inside: avoid; padding: 3px 0; border-bottom: 1px dotted var(--line-2); font-size: 14px; }
.ings .amt { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recipe .steps { white-space: pre-line; }
.recipe.flash::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); animation: fade 1.2s ease-out forwards; }
@keyframes fade { from { opacity: 1; } to { opacity: 0; } }

.foot { max-width: 1040px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 12px; }
.foot p { margin: 0 0 8px; line-height: 1.5; }


/* ---------- result, desktop: the summary is a sticky rail ---------- */
@media (min-width: 900px) {
  .amount input, .summary .big { font-size: 56px; }
  #result { max-width: 1040px; }
  .res { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  .main { order: 1; min-width: 0; }
  .rail { order: 2; position: sticky; top: 69px; max-height: calc(100vh - 85px); overflow-y: auto; margin-top: 20px; padding: 2px; }
  .summary { margin-top: 0; }
  .plan { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
  .day { display: grid; grid-template-rows: subgrid; grid-row: span 4; gap: 8px; padding: 12px 10px; }
  .plan.slots-1 .day { grid-row: span 2; }
  .plan.slots-2 .day { grid-row: span 3; }
  .day .dnum { font-size: 24px; }
  .meal { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 4px; }
  .meal .slot { padding-top: 0; font-size: 11px; }
  .rchip { padding: 8px 10px; font-size: 13px; align-content: start; height: 100%; }
}

@media (max-width: 480px) {
  .ings { columns: 1; }
  .meal { grid-template-columns: 1fr; gap: 4px; }
  .meal .slot { padding-top: 0; }
}

@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .top, .foot, .actions, .seg-wrap, .stages, #topTotal, .progress, #ask, .ghost, .swap-btn, .swap, .wake, .feedback { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .panel[hidden] { display: grid !important; }
  .line { cursor: default; }
  .line .check { border-color: #999; }
  .group h3 { position: static; }
}
