/* Morgenbrød — shared stylesheet (guest + admin). No build step. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(../fonts/bricolage-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(../fonts/bricolage-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --flour: #fbfaf6;
  --paper: #ffffff;
  --crust: #2a1a0e;
  --rye: #7a5a3c;
  --rule: #e6dfd3;
  --rule-strong: #cdc2b1;
  --enamel: #1747a6;
  --enamel-deep: #0f3580;
  --enamel-tint: #e7eefb;
  --butter: #f5c842;
  --danger: #b3261e;
  --danger-tint: #fbe9e7;
  --ok: #2e7d4f;
  --ok-tint: #e6f3ea;
  --radius: 10px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--crust);
  background: var(--flour);
}
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
a { color: var(--enamel); }
small, .muted { color: var(--rye); }
.muted { font-size: 0.9375rem; }
:focus-visible { outline: 3px solid var(--enamel); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0.6rem 1.15rem;
  border: 2px solid var(--enamel); border-radius: var(--radius);
  background: var(--enamel); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--enamel-deep); border-color: var(--enamel-deep); }
.button:disabled, .button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.button--ghost { background: transparent; color: var(--enamel); }
.button--ghost:hover { background: var(--enamel-tint); }
.button--quiet { background: transparent; border-color: var(--rule-strong); color: var(--crust); }
.button--quiet:hover { background: var(--flour); border-color: var(--rye); }
.button--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button--danger:hover { background: var(--danger-tint); }
.button--small { min-height: 36px; padding: 0.3rem 0.8rem; font-size: 0.9375rem; }
.button--block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--enamel); text-decoration: underline; cursor: pointer; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 1rem; }
.field > span, .field > label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field .hint { display: block; font-weight: 400; color: var(--rye); font-size: 0.9rem; margin-top: 0.25rem; }
.input, select, textarea {
  width: 100%; min-height: 48px; padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff; color: var(--crust); font: inherit;
}
textarea { min-height: 6rem; resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--enamel); outline: 3px solid var(--enamel-tint); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.error { color: var(--danger); font-size: 0.9375rem; margin: 0.3rem 0 0; }
.checkbox { display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); font-weight: 500; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--enamel); }
.form-row { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }

/* ---------- Notices ---------- */
.notice { padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.notice--ok { background: var(--ok-tint); border-color: #bfe0cb; color: #1c5436; }
.notice--error { background: var(--danger-tint); border-color: #f1c2bd; color: #7d1a14; }
.notice--info { background: var(--enamel-tint); border-color: #c5d5f5; color: var(--enamel-deep); }
.notice p:last-child { margin: 0; }

/* ---------- Guest: the order slip ---------- */
.page { max-width: 30rem; margin: 0 auto; padding: 1rem 1rem 7rem; }
.page--wide { max-width: 40rem; padding-bottom: 2rem; }
.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.25rem 1rem; }
.masthead .tenant { font-weight: 600; color: var(--rye); text-decoration: none; }
.lang-switch { display: flex; gap: 0.25rem; }
.lang-switch a { min-width: 2.4rem; min-height: 2.2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.875rem; color: var(--rye); }
.lang-switch a[aria-current="true"] { background: var(--crust); color: #fff; }

.slip {
  background: var(--paper);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 1px 2px rgba(42, 26, 14, 0.06), 0 18px 40px -24px rgba(42, 26, 14, 0.35);
}
.slip + .slip { margin-top: 1rem; }
.slip--landing { text-align: left; }
.display { font-size: clamp(2.1rem, 9vw, 2.9rem); font-weight: 750; letter-spacing: -0.03em; line-height: 1; margin-bottom: 0.5rem; }
.lede { font-size: 1.05rem; color: var(--rye); max-width: 34ch; }

.slip__section { padding: 1.25rem 0 0.5rem; }
.slip__section + .slip__section { border-top: 1px solid var(--rule); margin-top: 0.75rem; }
.slip__section > h2 { margin-bottom: 0.75rem; }

/* language choice */
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.lang-list a {
  display: flex; align-items: center; gap: 0.9rem; min-height: 64px; padding: 0.75rem 1rem;
  border: 2px solid var(--rule); border-radius: var(--radius);
  color: var(--crust); text-decoration: none; font-size: 1.15rem; font-weight: 600;
}
.lang-list a:hover { border-color: var(--enamel); background: var(--enamel-tint); }
.lang-list .flag { font-size: 1.6rem; line-height: 1; }

/* date chips */
.date-chips { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0 0.5rem; margin: 0 -1.25rem; padding-inline: 1.25rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.chip { flex: 0 0 auto; scroll-snap-align: start; position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 4.4rem; min-height: 4.4rem; padding: 0.4rem 0.6rem;
  border: 2px solid var(--rule-strong); border-radius: 12px;
  font-weight: 600; line-height: 1.15; cursor: pointer; background: #fff;
}
.chip span b { font-size: 1.35rem; font-weight: 750; }
.chip span small { color: var(--rye); font-size: 0.8rem; font-weight: 500; }
.chip input:checked + span { background: var(--enamel); border-color: var(--enamel); color: #fff; }
.chip input:checked + span small { color: rgba(255, 255, 255, 0.8); }
.chip input:focus-visible + span { outline: 3px solid var(--enamel); outline-offset: 2px; }
.deadline-note { color: var(--rye); font-size: 0.9375rem; margin: 0.25rem 0 0; min-height: 1.4em; }

/* product rows — echo of the paper order slip */
.products { list-style: none; margin: 0; padding: 0; }
.product-row { display: flex; align-items: center; gap: 0.6rem; min-height: 60px; padding: 0.35rem 0; }
.product-row + .product-row { border-top: 1px solid var(--rule); }
.product-row .name { font-weight: 600; font-size: 1.05rem; flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.product-row .leader { flex: 1 1 0; min-width: 0.75rem; border-bottom: 2px dotted var(--rule-strong); align-self: flex-end; margin-bottom: 1.3rem; }
.stepper { display: inline-flex; align-items: center; gap: 0.15rem; flex: 0 0 auto; }
.stepper button {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 2px solid var(--rule-strong); background: #fff; color: var(--crust);
  font: inherit; font-size: 1.5rem; font-weight: 500; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.stepper button:hover { border-color: var(--enamel); color: var(--enamel); }
.stepper button:active { background: var(--enamel-tint); }
.stepper input {
  width: 2.6rem; height: var(--tap); text-align: center; border: 0; background: transparent;
  font: inherit; font-size: 1.3rem; font-weight: 750; color: var(--rule-strong);
  -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input.is-set { color: var(--enamel); }

/* sticky submit bar */
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--flour) 70%, rgba(251, 250, 246, 0));
}
.submit-bar .button { width: 100%; max-width: 28rem; min-height: 56px; font-size: 1.1rem; box-shadow: 0 10px 24px -12px rgba(23, 71, 166, 0.6); }
.submit-bar .count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.9rem; padding: 0 0.5rem; border-radius: 999px; background: var(--butter); color: var(--crust); font-weight: 750; font-size: 0.95rem; }

/* receipt */
.receipt { list-style: none; margin: 0; padding: 0; }
.receipt li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-top: 1px solid var(--rule); }
.receipt li:first-child { border-top: 0; }
.receipt .qty { font-weight: 750; color: var(--enamel); min-width: 3ch; text-align: right; }
.receipt-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0 0 1rem; }
.receipt-meta dt { color: var(--rye); }
.receipt-meta dd { margin: 0; font-weight: 600; }
.stamp { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--ok-tint); color: #1c5436; font-weight: 600; margin-bottom: 0.75rem; }

/* ---------- Admin shell ---------- */
.admin { min-height: 100vh; display: grid; grid-template-columns: 15rem 1fr; }
.admin__side { background: var(--crust); color: #f3ede4; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; }
.admin__brand { color: #fff; text-decoration: none; font-weight: 750; font-size: 1.15rem; letter-spacing: -0.02em; }
.admin__tenant { color: #c9b9a4; font-size: 0.9rem; margin-top: 0.1rem; }
.admin__nav { display: flex; flex-direction: column; gap: 0.15rem; }
.admin__nav a { color: #e9e1d5; text-decoration: none; padding: 0.55rem 0.7rem; border-radius: 8px; font-weight: 500; }
.admin__nav a:hover { background: rgba(255, 255, 255, 0.08); }
.admin__nav a[aria-current="page"] { background: var(--enamel); color: #fff; font-weight: 600; }
.admin__side form { margin-top: auto; }
.admin__side .link-button { color: #c9b9a4; text-decoration: none; }
.admin__side .link-button:hover { color: #fff; }
.admin__main { padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 3rem; min-width: 0; }
.admin__main > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.admin__main > header h1 { font-size: 1.6rem; }
.content { max-width: 62rem; }
.content--narrow { max-width: 36rem; }
@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .admin__side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.75rem 1rem; gap: 0.5rem 1rem; }
  .admin__nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .admin__side form { margin: 0 0 0 auto; }
  .admin__main { padding: 1.25rem 1rem 3rem; }
}

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 0.65rem 0.8rem; text-align: left; border-top: 1px solid var(--rule); vertical-align: middle; }
.table thead th { border-top: 0; background: var(--flour); color: var(--rye); font-weight: 600; font-size: 0.9rem; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--flour); color: var(--rye); border: 1px solid var(--rule); }
.tag--ok { background: var(--ok-tint); color: #1c5436; border-color: #bfe0cb; }
.tag--off { background: var(--danger-tint); color: #7d1a14; border-color: #f1c2bd; }
.tag--enamel { background: var(--enamel-tint); color: var(--enamel-deep); border-color: #c5d5f5; }

.panel { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.panel > h2 { margin-bottom: 0.75rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--rye); border: 1.5px dashed var(--rule-strong); border-radius: var(--radius); background: #fff; }

/* bake list */
.day { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.day__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.9rem 1rem; background: var(--flour); border-bottom: 1px solid var(--rule); }
.day__head h2 { font-size: 1.15rem; }
.day__totals { list-style: none; margin: 0; padding: 0.5rem 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.15rem 1.5rem; }
.day__totals li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--rule); }
.day__totals .qty { font-weight: 750; color: var(--enamel); font-variant-numeric: tabular-nums; }
.day__foot { padding: 0.6rem 1rem; border-top: 1px solid var(--rule); }

/* deadline rows */
.day-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.75rem 1rem; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 0.5rem; }
.day-row--closed { background: var(--flour); }
.day-row__info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; flex: 1 1 18rem; min-width: 0; }
.day-row__info strong { min-width: 11rem; }
.day-row__form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.day-row__form .input { width: auto; max-width: 100%; min-height: 36px; padding: 0.2rem 0.5rem; }

/* tables that stack into cards on small screens */
@media (max-width: 640px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: block; padding: 0.6rem 0.8rem; border-top: 1px solid var(--rule); }
  .table--stack tr:first-child { border-top: 0; }
  .table--stack td { display: block; border: 0; padding: 0.15rem 0; text-align: left; }
  .table--stack td.num { text-align: left; }
  .table--stack td.actions { text-align: left; padding-top: 0.5rem; }
  .table--stack td[data-label]::before { content: attr(data-label) ": "; color: var(--rye); font-size: 0.85rem; }
}

/* sortable product list */
.sortable { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.sortable li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.6rem 0.8rem; border-top: 1px solid var(--rule); }
.sortable__actions { display: inline-flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.sortable li:first-child { border-top: 0; }
.sortable .handle { cursor: grab; color: var(--rule-strong); font-size: 1.3rem; line-height: 1; padding: 0.25rem; touch-action: none; }
.sortable .handle:hover { color: var(--rye); }
.sortable .sortable-ghost { background: var(--enamel-tint); }
.sortable .name { flex: 1 1 14rem; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.sortable .alts { display: block; color: var(--rye); font-size: 0.9rem; font-weight: 400; }
.sortable .up-down { display: inline-flex; gap: 0.15rem; }
.js .sortable .up-down { display: none; }

/* QR */
.qr { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 18rem) 1fr; align-items: start; }
.qr svg { width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.75rem; }
.qr code { display: block; padding: 0.6rem 0.8rem; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); word-break: break-all; }
@media (max-width: 600px) { .qr { grid-template-columns: 1fr; } }
@media print {
  .admin__side, .admin__main > header .no-print, .no-print { display: none !important; }
  .admin { display: block; }
  body { background: #fff; }
}

/* auth */
.auth { max-width: 24rem; margin: 8vh auto 0; padding: 1rem; }
.auth .slip { padding: 2rem 1.5rem; }
.auth h1 { margin-bottom: 1.25rem; }

@media (prefers-reduced-motion: no-preference) {
  .stepper button, .chip span, .button { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
}
