/* Doerr Dough — design option A: warm and homemade. Fraunces headings, Nunito Sans body. */
:root {
  --bg: #FBF6EE; --surface: #FFFFFF; --surface-2: #F4ECDF; --border: #EADFCF; --border-strong: #D9C9B2;
  --text: #3B2A1E; --muted: #7A6555;
  --primary: #9A5B2A; --primary-hover: #84491D; --primary-ink: #FFFFFF; --primary-soft: #F3E3D2;
  --accent: #D9A441; --accent-soft: #FAEFD6; --accent-ink: #5C3F06;
  --ok: #4E7D3A; --ok-soft: #E5F0DD; --danger: #B3402E; --danger-soft: #F8E1DC;
  --crust: #A8652F; --crust-dark: #7E4520; --crumb: #F4E3C3; --golden: #E2B465; --choc: #4A2A18; --herb: #5E7F3C; --cinnamon: #8A4A22;
  --shadow-art: rgba(122, 82, 40, 0.16); --shadow: 0 1px 2px rgba(80, 50, 20, 0.06), 0 4px 14px rgba(80, 50, 20, 0.06);
  --radius: 14px; --radius-sm: 10px;
  --font-head: 'Fraunces', Georgia, serif; --font-body: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
:root.dark {
  --bg: #1E1712; --surface: #2A211A; --surface-2: #33281F; --border: #3D3127; --border-strong: #54443A;
  --text: #F3E9DC; --muted: #B8A796;
  --primary: #E0A36A; --primary-hover: #EBB680; --primary-ink: #1E1712; --primary-soft: #3D2C1E;
  --accent: #E8C063; --accent-soft: #3A3020; --accent-ink: #F6DFA4;
  --ok: #8CC56E; --ok-soft: #24321C; --danger: #F08A78; --danger-soft: #3D221D;
  --crust: #C27A3E; --crust-dark: #8E5428; --crumb: #EBD3A8; --golden: #D9A65A; --choc: #2E180C; --herb: #8DB062; --cinnamon: #7A3F1C;
  --shadow-art: rgba(0, 0, 0, 0.35); --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0 0 0.4rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 0.6rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell: only <main> scrolls, so the bottom bar never drifts on iPhone */
.shell { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar { flex: none; display: flex; align-items: center; gap: 0.6rem; padding: calc(env(safe-area-inset-top) + 0.6rem) max(1rem, env(safe-area-inset-right)) 0.6rem max(1rem, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.topbar .title { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .demo-tag { font-size: 0.72rem; background: var(--accent-soft); color: var(--accent-ink); padding: 2px 8px; border-radius: 99px; font-weight: 700; }
main { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wrap { max-width: 760px; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-left)) 2rem max(1rem, env(safe-area-inset-right)); }
.bottombar { flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 0.6rem max(1rem, env(safe-area-inset-right)) calc(0.6rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.bottombar:empty { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0.55rem 1.1rem; border-radius: 12px; border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; transition: background 0.15s, transform 0.05s; color: var(--text); background: transparent; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.ghost { color: var(--muted); padding: 0.4rem 0.6rem; min-height: 40px; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0.3rem 0.8rem; font-size: 0.9rem; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: none; background: transparent; color: var(--muted); font-size: 1.25rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Cards and lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.hero { background: var(--primary-soft); border: none; box-shadow: none; }
.hero .when { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 0.2rem; }
.chip { border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 99px; padding: 0.35rem 0.85rem; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; min-height: 38px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip small { font-weight: 400; opacity: 0.85; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--accent-ink); }
.badge.no { background: var(--danger-soft); color: var(--danger); }
.notice { border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; margin-bottom: 1rem; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.notice.no { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* Menu */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 0.85rem; }
.item { display: flex; gap: 0.85rem; align-items: center; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0.75rem; box-shadow: var(--shadow); transition: border-color 0.15s; }
.item.in-cart { border-color: var(--primary); }
.item.out { opacity: 0.6; }
.pic { width: 92px; height: 92px; flex: none; border-radius: 12px; background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic .art { width: 88%; height: auto; }
.pic.big { width: 100%; height: 180px; }
.pic.big .art { width: 60%; }
.item-body { flex: 1; min-width: 0; }
.item-name { font-weight: 800; line-height: 1.25; }
.item-desc { color: var(--muted); font-size: 0.875rem; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.price { font-weight: 800; color: var(--primary); }
.stepper { display: inline-flex; align-items: center; gap: 0.35rem; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 1.2rem; font-weight: 700; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.stepper button.plus { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.stepper button[disabled] { opacity: 0.35; cursor: default; }
.stepper .n { min-width: 1.4rem; text-align: center; font-weight: 800; }
.add-btn { min-height: 36px; padding: 0.3rem 0.9rem; border-radius: 99px; border: none; background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 800; cursor: pointer; }
.add-btn[disabled] { background: var(--surface-2); color: var(--muted); cursor: default; }

.cartbar { display: flex; align-items: center; gap: 0.75rem; max-width: 760px; margin: 0 auto; }
.cartbar .sum { flex: 1; line-height: 1.25; }
.cartbar .sum b { font-size: 1.1rem; }

/* Lines, forms */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.lines li:last-child { border-bottom: none; }
.lines .total { font-weight: 800; font-size: 1.05rem; }
label.field { display: block; margin-bottom: 0.85rem; }
label.field > span { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
.field-label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
.time-range { grid-template-columns: 1fr 1fr !important; }
.time-range label.field > span { font-weight: 400; color: var(--muted); }
input[type=time] { -webkit-appearance: none; appearance: none; min-height: 2.75rem; text-align: left; }
label.field > small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; min-height: 44px; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
@media (hover: none) and (pointer: coarse) { input, select, textarea { font-size: max(16px, 1em); } }
.err { color: var(--danger); font-size: 0.875rem; font-weight: 600; margin-top: 0.3rem; }
.pay-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.5rem; }
.pay-choice { display: flex; align-items: center; gap: 0.5rem; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; cursor: pointer; font-weight: 700; background: var(--surface); min-height: 48px; }
.pay-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pay-choice input { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
.check { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* Done screen */
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0.5rem auto 0.75rem; }
.paybtns { display: grid; gap: 0.5rem; margin-top: 0.75rem; }

/* Admin */
.tabbar { display: flex; max-width: 760px; margin: 0 auto; }
.tabbar button { flex: 1; border: none; background: none; font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.2rem 0; cursor: pointer; min-height: 48px; }
.tabbar button .ic { font-size: 1.3rem; line-height: 1.1; }
.tabbar button.on { color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; }
.stat b { display: block; font-size: 1.3rem; font-family: var(--font-head); }
.stat span { font-size: 0.8rem; color: var(--muted); }
.order { border-bottom: 1px solid var(--border); padding: 0.8rem 0; }
.order:last-child { border-bottom: none; }
.order.cancelled { opacity: 0.55; }
.order .who { font-weight: 800; }
.order .what { font-size: 0.92rem; }
.order .acts { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-top: 0.4rem; }
.bake li span:last-child { font-weight: 800; }
.menu-admin .item { cursor: pointer; }
.photo-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.art-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.art-pick label { border: 1.5px solid var(--border); border-radius: 10px; padding: 4px; cursor: pointer; background: var(--surface-2); }
.art-pick label:has(input:checked) { border-color: var(--primary); }
.art-pick input { position: absolute; opacity: 0; }
.art-pick .art { width: 100%; height: auto; display: block; }

/* Dialogs and toasts */
dialog { border: none; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
dialog::backdrop { background: rgba(30, 20, 10, 0.45); }
dialog .dlg { padding: 1.1rem; overflow-y: auto; max-height: calc(100dvh - 2rem); }
dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
dialog .dlg-head h2 { margin: 0; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(90px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 0.4rem; pointer-events: none; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 0.6rem 1rem; border-radius: 12px; font-weight: 700; font-size: 0.92rem; max-width: calc(100vw - 2rem); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); animation: pop 0.2s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Dark mode switch */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 1rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { position: relative; width: 48px; height: 28px; flex: none; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-strong); transition: background 0.2s; }
.switch .slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: 0.5; }
.dark-switch { display: grid; gap: 0.6rem; }

.center-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 2rem; text-align: center; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin: 1.4rem 0 0.6rem; }
.section-title h2 { margin: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.lines li.staff-row { flex-wrap: wrap; align-items: center; row-gap: 0.2rem; }
.staff-row .btn { white-space: nowrap; }
.preview-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.55rem max(1rem, env(safe-area-inset-left)); background: var(--accent-soft); color: var(--accent-ink); font-size: 0.875rem; border-bottom: 1px solid var(--border); }

/* Collapsible Settings sections (Payments, earlier versions) */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '\25B8'; opacity: 0.6; transition: transform 0.15s; display: inline-block; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary h3 { margin: 0; }
details.card.fold[open] > summary { margin-bottom: 0.6rem; }
details.fold:not(.card) > summary { padding: 0.25rem 0; }

/* Settings that need "Save settings" sit in one box with the button */
.save-group { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0.75rem; margin-bottom: 1.5rem; }
.save-group .card { margin-bottom: 0.6rem; }
.group-label { font-weight: 700; font-size: 0.95rem; margin: 0 0.25rem 0.6rem; }
.group-label span { font-weight: 400; color: var(--muted); }

/* Sizes and ingredients on menu items (v1.21) */
.sizes { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 2px 0 8px; }
/* Size slider (v1.25): one track, equal segments, a primary-colored thumb that slides to the picked size */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; max-width: 260px; margin: 2px 0 8px; padding: 3px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); transform: translateX(calc(100% * var(--i))); border-radius: 99px; background: var(--primary); box-shadow: 0 1px 3px var(--shadow-art); transition: transform 0.22s ease; }
.seg.still .seg-thumb { transition: none; }
.seg button { position: relative; z-index: 1; min-height: 36px; padding: 0.2rem 0.5rem; border: none; background: none; border-radius: 99px; font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); cursor: pointer; transition: color 0.2s; white-space: nowrap; }
.seg button.on { color: var(--primary-ink); }
.seg button small { font-weight: 400; opacity: 0.85; }
@media (prefers-reduced-motion: reduce) { .seg-thumb, .seg button { transition: none; } }
.chip.sm { min-height: 36px; padding: 0.25rem 0.75rem; font-size: 0.85rem; }
.ingr { margin-top: 6px; }
.ingr summary { cursor: pointer; color: var(--primary); font-size: 0.85rem; font-weight: 700; min-height: 32px; display: flex; align-items: center; gap: 0.3rem; list-style: none; }
.ingr summary::-webkit-details-marker { display: none; }
.ingr summary::before { content: '▸'; transition: transform 0.15s; }
.ingr[open] summary::before { transform: rotate(90deg); }
.ingr p { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--muted); }
.size-row { display: grid; grid-template-columns: 1fr 6.5rem auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.stock-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.stock-row span { flex: 1; }
.stock-row input { width: 7rem; flex: none; }
.chip small { font-weight: 400; }

/* Bundle editor: two item pickers, stacked with a + between */
.bundle-picks { display: flex; flex-direction: column; gap: 0.2rem; }
.bundle-picks > span { text-align: center; font-weight: 700; line-height: 1; }
.bundle-picks select { width: 100%; min-width: 0; }

/* Bundles (v1.24): two items' pictures together, and a small label above the name */
.pic.combo { position: relative; }
.pic.combo > span { position: absolute; width: 72%; display: flex; align-items: center; justify-content: center; }
.pic.combo .combo-a { left: 1%; top: 10%; }
.pic.combo .combo-b { right: 1%; bottom: 8%; }
.pic.combo .art { width: 100%; }
.pic.combo .photo { width: 56%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 2px var(--surface-2), 0 2px 6px var(--shadow-art); }
.pic.combo .combo-a.photo { left: 6%; top: 8%; }
.pic.combo .combo-b.photo { right: 6%; bottom: 8%; }
.pic.combo .combo-plus { left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--surface); color: var(--primary); font-weight: 800; font-size: 14px; line-height: 1; box-shadow: 0 1px 3px var(--shadow-art); }
.pic.big.combo > span { width: 40%; }
.pic.big.combo .combo-a { left: 14%; }
.pic.big.combo .combo-b { right: 14%; }
.pic.big.combo .photo { width: 36%; }
.pic.big.combo .combo-plus { width: 28px; height: 28px; font-size: 18px; }
.eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ok); margin-bottom: 1px; }
