* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --ink: #172128;
  --blue: #155397;
  --blue-dark: #0d417b;
  --muted: #4d5e69;
  --line: #d8dfe3;
  --canvas: #edf2f4;
  --tint: #f2f6fa;
  --danger: #902a23;
  --pad: 1rem;
}
body { margin: 0; background: var(--canvas); color: var(--ink); font: 1rem/1.45 system-ui, sans-serif; }
[hidden] { display: none !important; }
.shell { width: min(100%, 49rem); margin: auto; min-height: 100dvh; background: white; display: flex; flex-direction: column; }
.masthead, .tabs, main, .composer { padding-inline: var(--pad); }
.masthead {
  display: grid; grid-template-columns: 1fr auto; align-items: start; gap: .2rem .5rem;
  border-top: 5px solid var(--blue); padding-top: 1.5rem;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2rem; letter-spacing: -.04em; line-height: 1.16; }
.masthead h1 { display: flex; align-items: center; gap: .5rem; }
.masthead h1 img { flex: none; }
.header-actions { display: grid; justify-items: end; }
#shop-menu { white-space: nowrap; font-size: .875rem; }
h2 { font-size: 1.35rem; letter-spacing: -.025em; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.3; }
p + p { margin-top: .65rem; }
#summary { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; }
.tabs { display: flex; gap: .5rem; margin-top: .9rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { color: var(--muted); border: 0; background: transparent; padding-inline: .5rem; min-width: 44px; border-radius: 0; }
.tabs button:first-child { margin-inline-start: -.5rem; }
.tabs [aria-current] { color: var(--blue); box-shadow: inset 0 -3px var(--blue); }
main { flex: 1; padding-block: 1rem 1.6rem; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .8rem; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem .78rem;
  border: 1px solid #aebfce; border-radius: .45rem; color: var(--blue);
  background: white; text-decoration: none; font-weight: 650; cursor: pointer;
}
button:hover, .button:hover { background: var(--tint); }
button:disabled { opacity: .58; cursor: wait; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { background: #cee2f7; color: var(--ink); }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.primary:hover { background: var(--blue-dark); }
.text-button { padding-inline: .3rem; border-color: transparent; background: transparent; }
.danger { color: var(--danger); }
.group { margin-top: 1.1rem; }
.group > h3 { background: #ebf1f4; color: #374b58; border-radius: .2rem; padding: .4rem .65rem; font-size: .83rem; }
.rows, .changes { margin: 0; padding: 0; list-style: none; }
.row, .change { display: flex; gap: .65rem; align-items: center; justify-content: space-between; min-height: 4.2rem; border-bottom: 1px solid var(--line); padding: .45rem 0; }
.row-name { min-width: 0; text-align: left; background: transparent; border: 0; padding: .3rem 0; color: var(--ink); display: block; overflow-wrap: anywhere; }
.row-name strong { font-size: 1.03rem; font-weight: 660; display: block; }
small, .muted { color: var(--muted); }
.row-name small { font-size: .82rem; font-weight: 450; display: block; margin-top: .1rem; }
.stepper { display: flex; flex: none; align-items: center; border: 1px solid #bac9d5; border-radius: .5rem; }
.stepper button { padding: 0; width: 44px; font-size: 1.25rem; border: 0; }
.stepper span { min-width: 1.25rem; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.composer { position: sticky; bottom: 0; z-index: 1; background: var(--tint); border-top: 1px solid #bccddd; padding-block: .75rem max(.9rem, env(safe-area-inset-bottom)); }
form { display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; font-weight: 620; }
.composer label { margin-bottom: .35rem; font-size: .88rem; }
.composer form { display: block; }
.field { display: flex; gap: .25rem; align-items: center; background: white; border: 1px solid #9eafbc; border-radius: .5rem; padding: .19rem; }
input, textarea, select { width: 100%; min-height: 44px; border: 1px solid #9eafbc; background: white; color: var(--ink); padding: .55rem; border-radius: .4rem; }
.field input { border: 0; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 5rem; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .48rem; margin-top: .6rem; }
.assistant-message { margin-bottom: .5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem; }
#assistant-reply { max-height: min(14rem, 28dvh); overflow: auto; overscroll-behavior: contain; padding: .25rem; overflow-wrap: anywhere; }
.preview-section { margin-top: 1.3rem; }
.change { min-height: 2.8rem; }
.change small { display: block; margin-top: .25rem; }
.have-ingredient { display: flex; font-size: .875rem; margin-inline-start: -.3rem; }
.change span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.preview { display: flex; flex-direction: column; align-items: stretch; }
.preview > .text-button { align-self: start; margin-bottom: .6rem; }
.apply { position: sticky; bottom: 0; padding: .75rem 0; background: white; margin-top: auto; }
.apply button { width: 100%; }
.meal { border-bottom: 1px solid var(--line); padding-block: .7rem; }
.meal summary { cursor: pointer; min-height: 44px; padding: .4rem 0; font-weight: 650; }
.meal summary span { font-weight: 450; color: var(--muted); }
.ingredients { background: var(--tint); border-radius: .4rem; padding: .7rem 1rem; }
dialog { width: min(calc(100% - 1.5rem), 32rem); max-height: 92dvh; border: 1px solid #aebfce; border-radius: .9rem; padding: 1rem; color: var(--ink); }
dialog::backdrop { background: #17212866; }
dialog header { display: flex; gap: .5rem; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
fieldset { margin: 0; min-width: 0; padding: .7rem; border: 1px solid var(--line); border-radius: .4rem; }
.headcounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr)); gap: .45rem; }
.check { display: flex; align-items: center; gap: .6rem; }
.check input { width: 1rem; min-height: 1rem; }
.notice { background: var(--tint); border: 1px solid #cddae5; padding: .75rem; border-radius: .45rem; margin-block: .7rem; }
.error { color: var(--danger); }
.toast { position: fixed; right: max(.75rem, calc((100vw - 47rem) / 2)); bottom: 7.3rem; max-width: calc(100% - 1.5rem); z-index: 2; background: var(--ink); color: white; border-radius: .5rem; padding: .4rem .7rem; }
.toast button { margin-left: .4rem; }
@media (max-width: 22rem) {
  .masthead h1 { font-size: 1.65rem; }
  .row { flex-wrap: wrap; }
  .stepper { margin-left: auto; }
}
@media (min-width: 650px) {
  :root { --pad: 2.25rem; }
  .shell { margin: 1.5rem auto; min-height: calc(100dvh - 3rem); }
  h1 { font-size: 2.35rem; }
}
