/* Stewbert - one stylesheet, mobile first. The cook is holding a phone in a kitchen. */
:root {
  --ink: #23201c;
  --muted: #6b655c;
  --paper: #fbf8f2;
  --card: #ffffff;
  --accent: #b5502b;
  --accent-ink: #ffffff;
  --line: #e6dfd3;
  --error: #a12d2d;
  --ok: #3c7a4a;
}
* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--accent); }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
header.top .brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--ink); }
header.top nav a { margin-left: 16px; text-decoration: none; }
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }
footer {
  max-width: 720px; margin: 0 auto; padding: 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 14px;
}
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 28px 0 8px; }
p { margin: 0 0 14px; }
.lead { font-size: 1.1rem; }
.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }
.hero { padding: 12px 0 8px; }
.steps ol { padding-left: 22px; }
.steps li { margin-bottom: 10px; }
.promise { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.narrow { max-width: 520px; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.button, button {
  display: inline-block; padding: 12px 20px; border-radius: 10px; border: 0;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }
form label { display: block; font-weight: 600; margin: 12px 0 6px; }
form input, form select {
  width: 100%; padding: 12px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); margin-bottom: 14px;
}
@media (min-width: 640px) {
  body { font-size: 18px; }
  h1 { font-size: 2.3rem; }
}

/* the kitchen */
.start { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px; }
button.secondary, .button.secondary { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
ul.plans { list-style: none; padding: 0; }
ul.plans li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }

/* a plan's page: the head and the progress bar */
.plan-head h1 { margin-bottom: 8px; font-size: 1.5rem; }
.plan-head p { margin-bottom: 4px; }
ol.progress {
  list-style: none; padding: 0; margin: 0 0 10px; display: flex; gap: 0;
  counter-reset: step;
}
ol.progress li { flex: 1; text-align: center; position: relative; font-size: 0.78rem; color: var(--muted); }
ol.progress li .dot {
  display: block; width: 12px; height: 12px; border-radius: 50%; margin: 0 auto 4px;
  background: var(--card); border: 2px solid var(--line); position: relative; z-index: 1;
}
ol.progress li::before {
  content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: var(--line);
}
ol.progress li:first-child::before { display: none; }
ol.progress li.done .dot { background: var(--ok); border-color: var(--ok); }
ol.progress li.done::before, ol.progress li.now::before { background: var(--ok); }
ol.progress li.done { color: var(--ink); }
ol.progress li.now { color: var(--ink); font-weight: 700; }
ol.progress li.now .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px #f3d9cd; }
.ask { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin: 8px 0 4px; font-size: 0.95rem; }

/* the conversation */
.chat { margin: 12px 0 20px; }
#thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border-radius: 12px; padding: 12px 14px; max-width: 100%; scroll-margin-top: 72px; }
.msg.user { background: #efe6d8; align-self: flex-end; max-width: 92%; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); }
.msg.pending { opacity: 0.85; }
.msg .who { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.msg .body p:last-child { margin-bottom: 0; }
.msg .body table { border-collapse: collapse; margin: 8px 0; }
.msg .body td, .msg .body th, .doc td, .doc th { border: 1px solid var(--line); padding: 4px 8px; }
.msg .photos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg .photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.msg.thinking .body { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: 0.35; animation: pulse 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* the composer sticks to the bottom of the screen while the thread is in view */
.composer {
  position: sticky; bottom: 0; z-index: 4; margin-top: 12px; padding: 10px 0 10px;
  background: linear-gradient(to bottom, rgba(251, 248, 242, 0), var(--paper) 18%);
}
.composer textarea {
  width: 100%; padding: 12px 14px; font: inherit; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); resize: none; min-height: 48px; max-height: 180px; display: block; margin: 0 0 8px;
}
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-row .send { margin-left: auto; min-width: 96px; }
.photo-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 10px; margin: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--accent); font-weight: 600; cursor: pointer;
}
.photo-button input { position: absolute; left: -9999px; }
.composer.busy .photo-button { opacity: 0.55; pointer-events: none; }
.small { font-size: 0.85rem; }
.visually-hidden { position: absolute; left: -9999px; }

/* the store buttons, in the flow once the list is handed over */
.handoff-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 14px; margin: 14px 0 0; }
.handoff-title { font-weight: 700; margin-bottom: 10px; }
.handoff { margin-bottom: 10px; }
.handoff .button { display: block; text-align: center; }
.handoff p { margin: 6px 0 0; }
.share-manage { margin-top: 6px; }
.share-manage summary { cursor: pointer; }
.share-actions { display: flex; gap: 8px; margin-top: 8px; }
button.small { padding: 6px 12px; font-size: 0.85rem; }

/* the engine's documents */
.board { margin-top: 18px; }
.board details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-bottom: 10px; }
.board summary { cursor: pointer; font-weight: 600; }
.doc { overflow-x: auto; }

/* the public list page and the store pages */
ul.ingredients { padding-left: 22px; font-size: 1.05rem; }
ul.ingredients li { margin-bottom: 6px; }
label.choice { display: flex; gap: 10px; align-items: baseline; font-weight: 400; padding: 8px 0; border-bottom: 1px solid var(--line); }
label.choice input { width: auto; margin: 0; }
fieldset.match { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin: 0 0 12px; }
fieldset.match legend { font-weight: 600; padding: 0 6px; }

/* the setup screen: one screen of chips and toggles */
.setup h1 { margin-bottom: 6px; }
.setup-form fieldset.section { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px 14px 8px; margin: 0 0 14px; }
.setup-form legend { font-weight: 700; padding: 0 6px; }
.setup-form .row { display: flex; flex-wrap: wrap; gap: 12px; }
.setup-form .row > * { flex: 1 1 160px; }
.setup-form .stack { display: block; font-weight: 600; margin: 6px 0; }
.setup-form .stack input { margin-top: 6px; margin-bottom: 8px; font-weight: 400; }
.setup-form .label { display: block; font-weight: 600; margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip { position: relative; margin: 0; font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; line-height: 1.2; }
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup-form input[type=text], .setup-form input[type=number], .setup-form input[type=date] { margin-bottom: 8px; }
.setup-form .toggle { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 6px 0; }
.setup-form .toggle input { width: 22px; height: 22px; margin: 0; }
.setup-form label.choice { font-weight: 500; }
.setup-form label.choice input.inline { width: auto; flex: 1; margin: 0 0 0 6px; padding: 6px 10px; }
.zip-row { align-items: center; }
.zip-row input { flex: 1 1 120px; margin: 0; }
.zip-row button { flex: 0 0 auto; }
button.wide { width: 100%; padding: 14px; font-size: 1.05rem; margin: 4px 0 20px; }
.error-list { margin-bottom: 12px; }
#autostart { display: none; }

/* round 2: the progress bar lives in the sticky header; the menu card; photo previews */
header.top { display: block; padding: 0; }
header.top .top-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; }
.subheader { padding: 6px 16px 8px; border-top: 1px solid var(--line); max-width: 720px; margin: 0 auto; }
.subheader ol.progress { margin: 0; }
.subheader .ask { margin: 6px 0 0; padding: 6px 10px; font-size: 0.9rem; }
.plan-head { margin-bottom: 4px; }
.plan-head p { margin: 0 0 8px; font-size: 0.95rem; }
.pick-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px; margin: 14px 0 0; }
.pick-card.busy { opacity: 0.6; pointer-events: none; }
.pick-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 400; margin: 0; cursor: pointer; }
.pick-row input { width: 22px; height: 22px; margin: 2px 0 0; flex: 0 0 auto; }
.pick-row input:disabled + .pick-text { opacity: 0.5; }
.pick-text { flex: 1; line-height: 1.4; }
.pick-out { margin-top: 8px; }
.pick-out summary { cursor: pointer; }
.pick-out ul { padding-left: 20px; margin: 6px 0 0; }
.pick-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.previews { display: flex; flex-wrap: wrap; gap: 6px; }
.previews:not(:empty) { margin-bottom: 8px; }
.preview { position: relative; display: inline-block; }
.preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.preview .remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 14px; line-height: 22px; background: var(--ink); color: #fff; }
.doc.house ul { padding-left: 18px; margin: 8px 0; }
.doc.house li { margin-bottom: 4px; }

/* voice: a mic on the composer, replies read aloud when asked */
.mic-button { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--accent); font-weight: 600; cursor: pointer; }
.mic-button[hidden] { display: none; }
.mic-button.listening { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); animation: listen 1.2s infinite ease-in-out; }
@keyframes listen { 0%, 100% { box-shadow: 0 0 0 0 rgba(181, 80, 43, 0.45); } 50% { box-shadow: 0 0 0 8px rgba(181, 80, 43, 0); } }
.speak-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 0.85rem; color: var(--muted); margin: 0; cursor: pointer; }
.speak-toggle input { width: 18px; height: 18px; margin: 0; }
.composer-row .send { margin-left: auto; }

/* the blueprint page: the kitchen on the left, the business on the right */
.blueprint h1 { font-size: 1.7rem; }
.blueprint .pair { display: grid; grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 14px; background: var(--card); }
.blueprint .pair > div { padding: 14px 16px; }
.blueprint .kitchen { background: #f6efe3; }
.blueprint .tag { display: inline-block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.blueprint .pair p { margin: 0; }
.blueprint .steps ol { padding-left: 22px; }
.blueprint .steps li { margin-bottom: 10px; }
@media (min-width: 720px) {
  .blueprint h1 { font-size: 2.1rem; }
  .blueprint .pair { grid-template-columns: 1fr 1fr; }
  .blueprint .kitchen { border-right: 1px solid var(--line); }
}

/* the kitchen page: tools as chips, food as a four-column table, one row per item */
.kitchen-page h1 { margin-bottom: 6px; }
.notice { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 10px; padding: 8px 12px; }
table.food { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0 10px; }
table.food th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 0 4px 4px; }
table.food th:nth-child(1) { width: 38%; }
table.food th:nth-child(2) { width: 20%; }
table.food th:nth-child(3) { width: 19%; }
table.food th:nth-child(4) { width: 23%; }
table.food td { padding: 3px 2px; vertical-align: middle; }
table.food input, table.food select { width: 100%; margin: 0; padding: 8px 6px; font-size: 0.9rem; min-width: 0; }
table.food input[type=date] { padding: 7px 2px; }
table.food .item-cell { display: flex; align-items: center; gap: 4px; }
table.food .item-cell input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 18px; padding: 0; }
table.food .item-cell .spacer { flex: 0 0 18px; }
table.food tr.new input, table.food tr.new select { background: var(--paper); }
@media (max-width: 420px) {
  table.food input, table.food select { font-size: 0.8rem; padding: 7px 4px; }
  table.food th { font-size: 0.65rem; }
}
