/* Ramekin design system (S1, 2026-11-16). Loaded LAST, after style.css and theme.css, so these rules win.
   The rules (AUDIT-2026-11-16.md section 5):
   - Buttons: four kinds, two sizes. Primary (.btn.primary, one per screen, flat, tomato-pink), Secondary (.btn, tonal),
     Text link (.btn.link or .ds-link), Icon button (.icon-btn / .round-btn, 44 px, round). Danger is a Secondary in red.
     Sizes: normal (44 px) and .small (36 px). No 3D bottom edges anywhere.
   - Chips are filters or choices, never actions. One look, a clear selected state.
   - Type: one sans for reading and tapping, the display face only for screen titles and Rami moments.
     Six sizes: 12, 14, 16, 18, 24, 32. Weights regular (400) and semibold (600), bold (700) for titles only.
   - Space in 4 px steps. Three radii: 8, 14, full. Two shadows.
   - Colour: --pop is the one action colour, Mulberry (--accent) is brand and selection, butter is Rami only.
   - Icons: one line set (icons.css). No emoji in controls (icons.js swaps them). Emoji stay in Rami's speech, stickers and celebrations.
   New screens use the ds- classes below (.ds-list, .ds-row, .ds-sheet-head, .ds-section, .ds-empty). */

:root {
  --fs-12: .75rem; --fs-14: .875rem; --fs-16: 1rem; --fs-18: 1.125rem; --fs-24: 1.5rem; --fs-32: 2rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --rad-s: 8px; --rad-m: 14px; --rad-full: 999px;
  --elev-1: var(--sh1); --elev-2: var(--sh2);
  --action: var(--pop); --action-press: var(--pop-d); --action-ink: #fff;
  --tap: 44px; --btn-h: 44px; --btn-h-s: 36px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--btn-h); padding: 0 var(--sp-5); border: 1px solid transparent; border-radius: var(--rad-m);
  background: var(--soft); color: var(--accent-deep); box-shadow: none;
  font-family: var(--sans); font-size: var(--fs-16); font-weight: 600; letter-spacing: 0; line-height: 1.2; text-transform: none;
  transition: background .12s, transform .12s; cursor: pointer;
}
.btn:active { transform: scale(.98); background: color-mix(in srgb, var(--accent) 18%, var(--soft)); }
.btn:focus-visible, .icon-btn:focus-visible, .round-btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.small { min-height: var(--btn-h-s); padding: 0 var(--sp-4); border-radius: var(--rad-m); font-size: var(--fs-14); }
.btn.big { min-height: 56px; font-size: var(--fs-18); }
.btn.primary, .btn.primary.small, .btn.primary.big {
  background: var(--action); color: var(--action-ink); border-color: transparent; box-shadow: none; font-weight: 600; letter-spacing: 0;
}
.btn.primary:active { background: var(--action-press); transform: scale(.98); box-shadow: none; }
.btn.primary:disabled, .btn:disabled { opacity: .5; transform: none; box-shadow: none; cursor: default; }
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn.danger:active { background: color-mix(in srgb, var(--danger) 22%, transparent); }
/* Text link: low-priority actions. Never a pill. */
.btn.link{
  min-height: var(--tap); padding: 0 var(--sp-1); background: none; border: 0; border-radius: var(--rad-s);
  color: var(--accent-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.btn.link:active{ background: var(--line-soft); transform: none; }
/* Icon buttons: round, 44 px minimum, need an aria-label. */
.icon-btn, .round-btn {
  display: inline-grid; place-items: center; min-width: var(--tap); width: var(--tap); height: var(--tap); padding: 0;
  border-radius: var(--rad-full); box-shadow: none;
}
.icon-btn { border: 0; background: none; color: var(--ink); }
.icon-btn:active { background: var(--soft); }
.round-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
/* The floating add button: flat, lifted by a soft shadow, no 3D edge. */
.fab { background: var(--action); color: var(--action-ink); border-radius: var(--rad-full); box-shadow: var(--elev-2); }
.fab:active { background: var(--action-press); transform: scale(.94); box-shadow: var(--elev-1); }
/* Celebration buttons: still big and bold (a Rami moment), but flat like the rest. */
.cele-cta { background: var(--action); border-radius: var(--rad-full); box-shadow: var(--elev-2); font-family: var(--sans); font-weight: 700; font-size: var(--fs-18); letter-spacing: 0; text-transform: none; }
.cele-cta:active { background: var(--action-press); transform: scale(.98); box-shadow: var(--elev-1); }
/* Tonight card sits on a coloured background: primary in white, secondary translucent. */
.tonight .btn.hcook, .tonight .hcook { min-height: var(--btn-h); border-radius: var(--rad-m); font: 600 var(--fs-16) var(--sans); box-shadow: none; }
.tonight .btn.hghost, .tonight .hghost { min-height: var(--btn-h); border-radius: var(--rad-m); font: 600 var(--fs-16) var(--sans); }

/* ---------- Chips (filters and choices, never actions) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--btn-h-s); padding: 0 var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--rad-full); background: transparent; color: var(--ink); box-shadow: none;
  font-family: var(--sans); font-size: var(--fs-14); font-weight: 600;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Type ---------- */
/* Sentences are never in the italic display face: only screen titles and Rami moments use it. */
h1.home-title { font-family: var(--serif); font-style: normal; font-weight: 600; font-size: var(--fs-24); color: var(--ink); letter-spacing: -.02em; }
.greet { font-family: var(--sans); font-style: normal; font-size: var(--fs-16); font-weight: 600; }
.empty p { font-family: var(--sans); font-style: normal; font-size: var(--fs-16); }
.login > p.muted, .login h1 + p.muted { font-family: var(--sans); font-style: normal; font-size: var(--fs-18); }
.ing-group { font-family: var(--sans); font-style: normal; font-weight: 600; font-size: var(--fs-14); letter-spacing: .02em; }
.modal h2 { font-size: var(--fs-24); }
.aisle { font-size: var(--fs-12); font-weight: 600; letter-spacing: .08em; }

/* ---------- Building blocks for new and reworked screens ---------- */
/* A list of tappable rows: icon, label, optional value, chevron. One line per row: if it needs a second line, the label is wrong. */
.ds-list { margin: 0 0 var(--sp-4); padding: 0; background: var(--card); border-radius: var(--rad-m); box-shadow: var(--elev-1); overflow: hidden; list-style: none; }
.ds-row {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 52px; padding: 0 var(--sp-4);
  border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink); text-align: left; text-decoration: none;
  font: 400 var(--fs-16)/1.3 var(--sans); cursor: pointer;
}
.ds-list > .ds-row:last-child, .ds-list > :last-child > .ds-row { border-bottom: 0; }
.ds-row:active { background: var(--line-soft); }
.ds-row > .ic:first-child { flex: none; width: 22px; height: 22px; color: var(--accent-deep); }
.ds-row .ds-label { flex: 1; min-width: 0; font-weight: 600; }
.ds-row .ds-value { flex: none; color: var(--muted); font-size: var(--fs-14); }
.ds-row::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: .6; margin-right: 2px; }
.ds-row.no-chev::after { display: none; }
.ds-row .ds-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--action); }
.ds-section { margin: var(--sp-6) var(--sp-1) var(--sp-2); font: 600 var(--fs-12) var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* Sheet header: title on the left, a 44 px close button on the right. */
.ds-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: 0 0 var(--sp-3); }
.ds-sheet-head h2 { margin: 0; font-size: var(--fs-24); }
/* Empty state: one line and one button. */
.ds-empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--muted); font: 400 var(--fs-16) var(--sans); }
.ds-empty .btn { margin-top: var(--sp-3); }
/* Information is never a pill: plain status text. */
.ds-status { color: var(--muted); font-size: var(--fs-14); }

/* ---------- Home (S3): Rami's line, ONE "right now" card, then the recipes ---------- */
#now > * { display: none; }
#now > .now-on { display: block; }
#now .nudge ~ .nudge { display: none; }   /* "Ramekin noticed": one at a time; dismissing it shows the next */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- S4: solid tab bar, one add button that never covers content, quieter Plan and recipe page ---------- */
nav.tabs {
  left: 0; right: 0; bottom: 0; max-width: none; margin: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 4px;
  border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--card); box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
nav.tabs a { max-width: 160px; border-radius: var(--rad-m); }
#app { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }   /* room for the tab bar and the add button, so the last row is never hidden */
.fab { right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); width: 56px; height: 56px; animation: none; }
body.cooking .fab { display: none; }
/* Plan: an empty day is one quiet line */
.day.dayempty { display: block; padding: 10px 16px; min-height: 0; background: transparent; box-shadow: none; border: 1px dashed var(--line); cursor: pointer; }
.day.dayempty h3 { font-size: var(--fs-14); font-weight: 600; color: var(--muted); margin: 0; }
.day.dayempty .dayadd { font: 600 var(--fs-14) var(--sans); color: var(--accent-deep); }
.day.dayempty.past { opacity: .55; }
/* Recipe page: cost is plain text, not a pill */
.costline { background: none; padding: 4px 0; border-radius: 0; }

/* ---------- S5: Kitchen (Freezer / Fridge / Pantry) ---------- */
.kseg { margin: 0 0 10px; }
.ds-row .ds-value.ds-warn { color: var(--pop); font-weight: 600; }

/* ---------- S6: Rami's guide ("?" tips, New dots, the new-kitchen card) ---------- */
.qbtn { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 8px; padding: 0; border: 0; border-radius: var(--rad-full); background: var(--soft); color: var(--accent-deep); font: 700 var(--fs-16)/1 var(--sans); vertical-align: middle; cursor: pointer; }
.qbtn::after { content: ""; position: absolute; inset: -8px; }   /* 44 px tap area */
#rami { position: relative; }
.qbtn.ramiq { position: absolute; left: 46px; top: 0; margin: 0; box-shadow: var(--elev-1); background: var(--card); }
nav.tabs a.newdot i { position: relative; }
nav.tabs a.newdot i::after { content: ""; position: absolute; top: -1px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%; background: var(--action); }
.ds-row .ds-dot { margin-right: 2px; }
.guidecard { margin: 8px 0 14px; }
/* Anything marked hidden really hides, even when a class (like .btn) sets its own display */
[hidden] { display: none !important; }

/* ---------- S8: small named styles that replace repeated inline style="" (marked !important so they behave exactly like the inline style they replaced) ---------- */
.m0 { margin: 0 !important; }
.wfull { width: 100% !important; }
.mt6 { margin-top: 6px !important; } .mt8 { margin-top: 8px !important; } .mt10 { margin-top: 10px !important; } .mt12 { margin-top: 12px !important; }
.t14 { font-size: var(--fs-14) !important; }
.t12 { font-size: var(--fs-12) !important; }
.tap { cursor: pointer !important; }
.nounder { text-decoration: none !important; }

/* ---------- Design system finish (2026-11-16 evening): every control is one of a few roles, each with one look ----------
   Primary · Secondary (two sizes) · Text link · Icon button (plain, or "raised" when it floats over content) · Stepper −/+ · Chip · Segment.
   Rows (day rows, Rami's bubble, recipe titles) are rows, not buttons. Tap areas are at least 44 px even when the visible shape is smaller. */
.btn.primary, .btn.primary.small, .btn.primary.big { border-radius: var(--rad-m); }
.btn:where(:not(.primary):not(.danger):not(.link)) { color: var(--accent-deep); background: var(--soft); border-color: transparent; }
.btn.small { position: relative; }
.btn.small::after { content: ""; position: absolute; inset: -4px 0; }           /* 36 px to look at, 44 px to tap */
/* Tonight card: its two buttons are the standard Primary and Secondary */
.tonight .btn.hcook, .tonight .hcook { background: var(--action); color: var(--action-ink); border: 0; border-radius: var(--rad-m); font: 600 var(--fs-16) var(--sans); box-shadow: none; }
.tonight .btn.hghost, .tonight .hghost { background: var(--soft); color: var(--accent-deep); border: 0; border-radius: var(--rad-m); font: 600 var(--fs-16) var(--sans); }
/* Icon buttons: one plain look; "raised" where it floats over a photo or another element */
.icon-btn, .round-btn, .qbtn { display: inline-grid; place-items: center; min-width: var(--tap); width: var(--tap); height: var(--tap); padding: 0; border: 0;
  border-radius: var(--rad-full); background: transparent; color: var(--ink); font: 400 1.3rem/1 var(--sans); box-shadow: none; vertical-align: middle; }
.icon-btn .ic, .round-btn .ic, .qbtn .ic { width: 22px; height: 22px; }
.icon-btn:active, .round-btn:active, .qbtn:active { background: var(--soft); }
.round-btn, .topbar .icon-btn, .qbtn.ramiq { background: var(--card); box-shadow: var(--elev-1); }
.qbtn::after, .qbtn.ramiq::after { content: none; }
h1 .qbtn, h2 .qbtn { margin-left: 2px; color: var(--accent-deep); }
.qbtn.ramiq { position: absolute; left: 40px; top: -6px; }
/* Steppers (servings, portions, freezer packs): one round −/+ */
.stepper { gap: 2px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.stepper button, .gitem .stepper button, .stp button, .stp .icon-btn, .ing .sc button { display: inline-grid; place-items: center; width: 40px; height: 40px; min-width: 40px; padding: 0;
  border: 0; border-radius: var(--rad-full); background: var(--soft); color: var(--accent-deep); font: 600 var(--fs-18)/1 var(--sans); position: relative; }
.stepper button::after, .stp button::after, .ing .sc button::after { content: ""; position: absolute; inset: -2px; }
/* Rating stars: a 44 px tap each, the star itself stays the same size */
.stars button { position: relative; min-width: 36px; height: 44px; padding: 0 2px; border-radius: var(--rad-full); }
/* Segments (Cookbooks / All recipes, the Kitchen switch, the Rami tabs): one look */
.seg { display: flex; padding: 4px; border: 0; border-radius: var(--rad-full); background: var(--soft); box-shadow: none; }
.seg button, .hubtabs a { min-height: 40px; border: 0; border-radius: var(--rad-full); background: transparent; color: var(--muted); font: 600 var(--fs-14) var(--sans); box-shadow: none; }
.seg button.on, .hubtabs a.on { background: var(--card); color: var(--accent-deep); box-shadow: var(--elev-1); }
.hubtabs { padding: 4px; gap: 2px; }
/* Chips: 36 px to look at, 44 px to tap */
.chip { position: relative; }
.chip::after { content: ""; position: absolute; inset: -4px 0; }
/* Small text links (undo, I have it, change, Edit in Kitchen): a bigger invisible tap area */
small a, .muted a, .ds-status a, .ghave a, a[data-cp], a[data-cb] { position: relative; }
small a::after, .muted a::after, .ds-status a::after, .ghave a::after, a[data-cp]::after, a[data-cb]::after { content: ""; position: absolute; inset: -8px -4px; }
/* Floating add button: the + glyph on the scale */
.fab { font: 300 var(--fs-32)/1 var(--sans); }
/* Recipe titles in "What can I make?" are row titles */
b[data-open] { display: inline-block; padding: 8px 0; }
/* the last odd ones: every plain icon button is ink, round and 44 px whatever row it sits in; label-wrapped buttons keep the Secondary colour; the streak number sits on the scale */
.icon-btn, .qbtn, h1 .qbtn, h2 .qbtn { color: var(--ink) !important; min-width: var(--tap) !important; min-height: var(--tap) !important; border-radius: var(--rad-full) !important; }
.topbar .icon-btn { border-radius: var(--rad-full); }
label > span.btn:not(.primary) { color: var(--accent-deep); }
.play-streak .flame { font-size: var(--fs-24); }
.stp, b.stp { display: inline-flex; align-items: center; gap: 12px; }
.stepper { gap: 8px; }
/* Rami-screen titles ("Small wins.", "My dishes.") use the display face at screen-title weight, like every other title */
h1.yr-big, .yr-big, .yr-share h3 { font-family: var(--serif); font-style: normal; font-weight: 650; letter-spacing: -.025em; }

/* 4.2.3: for a new account's first week the help button says "Help" */
.qbtn.ramiq.withtext { position: static; display: flex; width: fit-content; min-width: var(--tap); margin: 2px 0 0 auto; padding: 0 14px 0 10px; gap: 6px; grid-auto-flow: column; align-items: center; background: none; box-shadow: none; font-size: var(--fs-14); font-weight: 600; }
.qbtn.ramiq.withtext .ic { width: 20px; height: 20px; }
/* 4.4.1: link-style controls inside a line of text get a 44 px tap area */
.ghave-yes, .undo, [data-undo]{ position: relative; }
.ghave-yes::after, .undo::after, [data-undo]::after { content: ""; position: absolute; inset: -12px -8px; }
#toast button { min-height: var(--tap); min-width: var(--tap); padding: 0 8px; }

/* 4.1.2 the Pro money line on Home's last-30-days strip */
.valuestrip .vsave { margin: 2px 0 8px; font-size: var(--fs-16); color: var(--ink); }

/* 4.6.3 the Sunday card */
.weekcard .vhead { font: 700 var(--fs-12) var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.weekcard .vcols { display: flex; gap: 18px; }
.weekcard .vcols b { display: block; font-size: var(--fs-24); line-height: 1.1; }
.weekcard .vcols span { font-size: var(--fs-12); color: var(--muted); }

/* 4.7.1 accessibility: Rami's line wraps instead of running off the screen at the largest text sizes */
.ramihost .rh-b { min-width: 0; overflow-wrap: anywhere; }
.rh-rank { flex-wrap: wrap; }
.rh-rank b { white-space: normal; }
.rh-rank .rh-bar { flex: 1 1 40px; min-width: 0; }

/* 4.4.3 the instant preview while an import is being tidied */
.peekbox { margin: 10px 0; }
.peeklist { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-14); }

/* Survey banner: one slim bar at the top of Home while the pricing survey is open */
.svbanner { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; background: var(--soft); border-radius: var(--rad-m); }
.svtap { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 6px 10px 14px; min-height: var(--tap); border: 0; background: none; color: var(--accent-deep); font: inherit; text-align: left; cursor: pointer; }
.svtap b { font-size: var(--fs-16); }
.svtap span { font-size: var(--fs-14); color: var(--muted); }

/* The survey's pick-up-to-3 list uses square tick boxes so it does not look like a one-answer list */
.sv-multi input[type=checkbox] { border-radius: 6px !important; }
