/* "Mercado pop": a market-stall poster. Butter paper, thick ink outlines, hard offset
   shadows that press in under the thumb, and three flat colours — tomato for the action,
   mustard for what is chosen or highlighted, ink for everything that has to be read. */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&display=swap');

:root {
  --bg: #fff4d6;
  --card-bg: #fffdf7;
  --border: #161412;
  --line: #e7d9b4;
  --text: #161412;
  --text-muted: #5e554a;
  --accent: #d4381e;
  --accent-hover: #b52c15;
  --accent-text: #c8331a;
  --mustard: #ffc531;
  --mustard-soft: #ffe7a3;
  --danger: #b52c15;
  --ink: #161412;
  --stroke: 2.5px;
  --radius: 12px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --font: 'Bricolage Grotesque', 'Archivo', 'Helvetica Neue', 'Arial Nova', Arial,
    system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.4;
  background-color: var(--bg);
  /* A faint dot screen, like cheap poster print. */
  background-image: radial-gradient(rgba(22, 20, 18, 0.07) 1px, transparent 1.2px);
  background-size: 14px 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Hidden means hidden, whatever display a component asks for later in the file. */
.hidden {
  display: none !important;
}

/* One focus ring everywhere: thick ink, offset clear of the shadow. */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

button {
  font-family: inherit;
  touch-action: manipulation;
}

/* ───────────── Header ───────────── */

header {
  padding: calc(1.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1.25rem
    max(1rem, env(safe-area-inset-left));
  text-align: center;
}

header h1 {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.9rem 0.4rem;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: clamp(1.75rem, 7vw, 2.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-1.5deg);
}

.subtitle {
  display: inline-block;
  margin: 0.9rem 0 0;
  padding: 0.15rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  transform: rotate(1deg);
}

.subtitle:empty {
  display: none;
}

header .subtitle {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

header .subtitle:empty {
  display: none;
}

.main-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.main-nav a:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.main-nav a.current {
  background: var(--ink);
  color: var(--mustard);
}

/* ───────────── Layout ───────────── */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  min-width: 0;
  background: var(--card-bg);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* On the carta the dish rows are the cards; the section around them steps back so they
   do not sit as boxes inside a box. */
.card:has(> #carta-lines) {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

/* ───────────── Forms (staff screens) ───────────── */

.field-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  flex: 2;
}

.field-small {
  flex: 1;
  min-width: 90px;
}

input,
textarea {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  transition: box-shadow 0.12s var(--ease);
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8a7f6f;
}

input:focus,
textarea:focus {
  outline: none;
  box-shadow: 3px 3px 0 var(--mustard), 3px 3px 0 2px var(--ink);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

.closed-message-field {
  margin-top: 1rem;
}

.field-help {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* A day with no service reads as such from across the room. */
.day-closed {
  border-color: var(--danger);
  box-shadow: 4px 4px 0 var(--danger);
}

.day-closed textarea {
  border-color: var(--danger);
}

.notice {
  margin: 0;
  padding: 1rem;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  background: var(--mustard);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

.sides-section {
  margin-top: 1.25rem;
  border-top: 2px dashed var(--ink);
  padding-top: 0.9rem;
}

.sides-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sides-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#add-side,
#add-time {
  min-height: 44px;
  padding: 0 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

#add-side:active,
#add-time:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--bg);
  align-items: center;
}

/* A flex item will not shrink below the width its content wants unless it is told to,
   which is what pushed this row — and the card around it — off the side of a phone. */
.side-row input {
  flex: 2;
  min-width: 0;
}

.side-row .field-small {
  flex: 1;
  min-width: 0;
}

/* On a phone the description takes the whole width and the unit, the price and the
   remove button share the line below it. Three fields abreast on 390px leaves each one
   too narrow to read what you typed. */
@media (max-width: 719px) {
  .side-row .side-description {
    flex: 1 1 100%;
  }
}

.remove-side {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--danger);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.remove-side:hover {
  background: var(--danger);
  color: #fff;
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.6rem;
}

button.primary,
button.secondary {
  min-height: 48px;
  padding: 0.65rem 1.1rem;
  border: var(--stroke) solid var(--ink);
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.12s;
}

button.primary {
  flex: 1;
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--card-bg);
  color: var(--ink);
}

button.secondary:hover {
  background: var(--mustard-soft);
}

button.primary:active,
button.secondary:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

button.primary:disabled {
  background: var(--line);
  color: var(--text-muted);
  border-color: var(--text-muted);
  box-shadow: none;
  cursor: default;
  transform: none;
}

.edit-item,
.delete-dish {
  min-height: 36px;
  padding: 0 0.65rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.edit-item {
  color: var(--ink);
  background: var(--mustard-soft);
}

.delete-dish {
  color: var(--danger);
}

.edit-item:hover {
  background: var(--mustard);
}

.delete-dish:hover {
  background: var(--danger);
  color: #fff;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
}

.empty-state a {
  color: var(--accent-text);
  font-weight: 700;
}

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.7rem 0.85rem;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: var(--mustard-soft);
  color: var(--text);
  font-size: 0.9rem;
}

/* ───────────── Dish lists ───────────── */

.dishes-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.dish-item {
  min-width: 0;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.dish-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dish-item-header > span:first-child {
  flex: 1 1 10rem;
  min-width: 0;
}

.dish-title {
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.dish-extra {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
}

/* The price is a little stall ticket: ink outline, mustard card, tilted a hair. */
.dish-price {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--mustard);
  color: var(--ink);
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: rotate(-2deg);
}

.dish-price:empty {
  display: none;
}

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 0.45rem;
  padding: 0.35rem 0 0 0.75rem;
  border-top: 1.5px dashed var(--line);
}

.time-row .time-value {
  flex: 1;
}

.daily-dishes {
  margin-top: 1.1rem;
}

/* The card is the wrapper, not the row: a button cannot hold a number field, so the box
   sits beside the row inside one border and reads as part of the same item. */
.daily-dish-holder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
  transition: background-color 0.12s, box-shadow 0.12s var(--ease), transform 0.12s var(--ease);
}

.daily-dish,
.daily-line {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
}

.daily-line .dish-title {
  font-size: 1.02rem;
}

/* One dish and its combinados, with a handle to drag the whole dish at once. */
.daily-dish-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Lifted out of the flow and following the finger. */
.daily-dish-group.dragging {
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: var(--radius);
  background: var(--card-bg);
}

/* The gap the dragged dish will drop into. */
.daily-drag-placeholder {
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--mustard-soft);
}

.daily-dish-lines {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.daily-group-label {
  margin: 0 0 0.1rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Combinados collapse under a toggle so a dish is one short, easy-to-drag row. */
.daily-combos-toggle {
  align-self: flex-start;
  min-height: 36px;
  background: none;
  border: none;
  padding: 0.15rem 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.daily-combos-toggle-active {
  color: var(--accent-text);
  font-weight: 800;
}

.daily-combos-caret {
  display: inline-block;
  width: 1em;
}

.daily-combos-count {
  padding: 0 0.35rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-weight: 800;
}

.daily-combos {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--ink);
}

.daily-dish-holder:active {
  background: var(--bg);
}

.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: var(--ink);
  background: var(--mustard-soft);
  box-shadow: 4px 4px 0 var(--accent);
}

.daily-dish-title {
  flex: 1;
}

.daily-dish-mark {
  visibility: hidden;
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.daily-dish-chosen .daily-dish-mark {
  visibility: visible;
}

.order-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.order-line-title {
  flex: 1;
  min-width: 0;
}

/* The carta row reuses the order line's layout — name on the left, price on the right,
   allergens and ingredients wrapping onto their own line below — but it is read-only, so
   none of the pointer, selection or quantity behaviour comes with it. */
.carta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
  padding: 0.95rem 0.95rem 1rem;
  box-shadow: var(--shadow);
}

/* Laid out as a little market card: the name across the top, allergens and ingredients
   under it, and a footer with the price ticket on the left and the stepper on the right.
   Adding a dish then never squeezes its name, on a phone or in a desktop column.
   A grid rather than wrapped flex lines, so when a desktop row stretches a card the
   footer sinks to the bottom instead of the lines drifting apart. */
.dish-item.carta-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto 1fr;
  gap: 0 0.75rem;
}

.carta-line .order-line-title {
  grid-column: 1 / -1;
  grid-row: 1;
}

.carta-line .order-line-details {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0.55rem;
}

.carta-line .dish-price {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  justify-self: start;
  margin-top: 0.9rem;
  margin-bottom: 0.55rem;
  font-size: 1.1rem;
}

.carta-line .order-stepper {
  grid-column: 3;
  grid-row: 3;
  align-self: end;
  margin-top: 0.9rem;
}

.carta-line .dish-title {
  font-size: 1.25rem;
}

.carta-line .dish-extra {
  white-space: nowrap;
}

.order-line-chosen {
  border-color: var(--accent);
}

.order-line:active {
  background: var(--bg);
}

.order-line-amount {
  min-width: 1.6rem;
  text-align: right;
  font-weight: 800;
  color: var(--accent-text);
}

.order-line-remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
  border-top: 2px dashed var(--ink);
  padding-top: 0.9rem;
}

.time-options-label {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.time-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.time-option {
  min-height: 44px;
  padding: 0.45rem 0.95rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.time-option.selected {
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.time-option.closed {
  color: var(--text-muted);
  background: var(--bg);
  text-decoration: line-through;
  box-shadow: none;
  cursor: not-allowed;
}

.drop-point-slug {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.drop-point-slug:hover {
  color: var(--accent-text);
}

/* ───────────── Kitchen / counter (legacy screens, same look) ───────────── */

.kitchen-status {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
}

.kitchen-status-live {
  background: var(--mustard);
}

.kitchen-status-down {
  color: #fff;
  background: var(--danger);
}

.kitchen-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kitchen-group-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.kitchen-group-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kitchen-chip {
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

/* A batch nobody has to cook any more steps back visually without disappearing. */
.kitchen-group-ready {
  box-shadow: 4px 4px 0 var(--accent);
}

.kitchen-group-ready .kitchen-group-count {
  color: var(--accent-text);
}

.kitchen-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.kitchen-line:active {
  background: var(--bg);
}

.kitchen-line-title {
  flex: 1;
}

.kitchen-count {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-text);
  white-space: nowrap;
}

/* Done is an achievement, not a dead control: the line keeps its full contrast and
   picks up the same chosen look the daily menu uses. */
.kitchen-line-done {
  background: var(--mustard-soft);
}

.kitchen-line-done .kitchen-count {
  font-size: 1.45rem;
}

.kitchen-undo {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--text-muted);
  color: white;
  font-size: 0.9rem;
  /* The arrow glyph sits high in its own box, so the badge centres it as a flex item
     instead of trusting the line box. */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

/* A plate that just arrived. The flash fades on its own, so a cook who looks up a few
   seconds later sees a normal board rather than a permanent badge to dismiss. */
@keyframes kitchen-arrived {
  from {
    background: var(--mustard);
  }
  to {
    background: var(--card-bg);
  }
}

.kitchen-line-new {
  animation: kitchen-arrived 2.5s ease-out;
}

/* The counter line: one tap sells one, so the whole row is the control and the two small
   buttons sit out of the way of a thumb aiming at it. */
.counter-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  padding-right: 2.6rem;
}

.counter-line:active {
  background: var(--bg);
}

.counter-line-title {
  flex: 1;
  min-width: 0;
}

.counter-breakdown {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.counter-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-text);
  white-space: nowrap;
}

.counter-line-empty {
  background: var(--bg);
}

.counter-line-empty .counter-count {
  color: var(--text-muted);
}

/* Sold more than there was: an order placed through the app is going to come up short,
   and nobody would find out until the round went out. */
.counter-line-short {
  box-shadow: 4px 4px 0 var(--danger);
}

.counter-short {
  color: var(--danger);
  font-weight: 700;
}

.counter-add {
  position: absolute;
  bottom: -0.55rem;
  right: -0.55rem;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

/* Desktop only: the phone layout below 720px stays exactly as it is. */
@media (min-width: 720px) {
  main {
    max-width: 1080px;
  }

  .dishes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    column-gap: 1rem;
    row-gap: 1rem;
  }

  /* Rows of one-line items look ragged when a long name wraps, so every card in
     these two lists takes the height of the tallest one. */
  #daily-dishes,
  #order-lines,
  .kitchen-group .dishes-list {
    grid-auto-rows: 1fr;
  }

  /* The board is read from across the kitchen, so its cards spread over the whole
     width instead of leaving empty tracks like the lists the staff read up close. */
  .kitchen-group .dishes-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .line-group-heading {
    grid-column: 1 / -1;
  }
}

.day-picker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.day-picker input {
  flex: 1;
  min-width: 0;
}

.day-picker button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.day-picker button:hover {
  background: var(--mustard);
}

.day-picker button:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* A family's name, sitting above the dishes that belong to it: a tomato label slapped on
   the stall, bold and uppercase, well apart from the dish cards under it — the first one
   keeps a smaller top gap so it does not float. */
.line-group-heading {
  justify-self: start;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  margin: 1.4rem 0 0.1rem;
  padding: 0.3rem 0.75rem 0.35rem;
  border: var(--stroke) solid var(--ink);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-sm);
  transform: rotate(-1deg);
}

.line-group-heading:first-child {
  margin-top: 0.25rem;
}

/* A dish with no price is a group; the list says so where the price would be. */
.dish-price.dish-group-tag,
.dish-group-tag {
  background: var(--card-bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transform: none;
}

/* The list above these can run to ninety lines, so the action stays on screen instead of
   waiting at the bottom of it. Sticky rather than fixed: the bar keeps its place in the
   flow, so it never covers the last row, and it stops sticking at the end of its own
   card — which is what a page with several forms needs. */
.form-actions,
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
}

.sticky-actions {
  /* The wrapper sticks as one piece; the footer and the buttons inside it would otherwise
     stick separately and sit on top of each other. */
  padding-top: 0.1rem;
}

.sticky-actions .form-actions {
  position: static;
  padding-bottom: 0;
}

/* A line scrolling underneath must not read through the bar. */
.form-actions::before,
.sticky-actions::before {
  content: '';
  display: block;
  border-top: var(--stroke) solid var(--ink);
  margin-bottom: 0.9rem;
}

.form-actions {
  flex-wrap: wrap;
}

.form-actions::before {
  flex: 1 1 100%;
  margin-bottom: 0.15rem;
}

.sticky-actions .form-actions::before {
  content: none;
}

/* The summary card's buttons are the end of a short card; a bar there would only add a
   line above two buttons nobody has to hunt for. */
#summary-card .form-actions {
  position: static;
}

#summary-card .form-actions::before {
  content: none;
}

/* Small and fixed: stretched to the row's height it dwarfed everything next to a name
   that wrapped over four lines. */
.daily-dish-stock {
  width: 4.2rem;
  height: 2.6rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.4rem;
  font-size: 0.95rem;
  text-align: right;
}

/* How many are left, under the name. Absolutely positioned so adding one never changes
   the height of the row, the same reason the amount has a fixed width. */
.order-line-left {
  position: absolute;
  left: 0.9rem;
  bottom: 0.1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.order-line:has(.order-line-left:not(:empty)) {
  padding-bottom: 1.4rem;
}

/* Nothing left: the row stays readable but stops being a control. */
.order-line-sold-out {
  background: var(--bg);
  cursor: not-allowed;
}

.order-line-sold-out .dish-title,
.order-line-sold-out .dish-price {
  color: var(--text-muted);
}

.order-line-sold-out .order-line-left {
  color: var(--danger);
}

/* Allergens and ingredients under the name. Always there rather than behind a control:
   tapping the row adds to the order, and nobody with an allergy should have to open
   dishes one at a time to find out. */
.order-line-details {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

/* Allergens are little stickers: white, ink-outlined, tomato lettering. */
.allergen-tag {
  padding: 0.08rem 0.45rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.order-line-ingredients {
  flex: 1 1 100%;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

/* The order line has to wrap now that a second row hangs under the name. */
.order-line {
  flex-wrap: wrap;
}

/* The multiselect in Gestión: a chip has the shape of the tag it becomes on the carta,
   so what is marked is what will be seen. */
.allergen-field {
  margin-top: 1rem;
}

.allergen-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.allergen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.allergen-chip {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.allergen-chip-on {
  background: #fff;
  color: var(--accent-text);
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--accent);
}

.details-field {
  margin-top: 0.75rem;
}

/* A side carries its own, so its row grows a second and third line on a phone. */
.side-row .side-ingredients,
.side-row .allergen-chips {
  flex: 1 1 100%;
  min-width: 0;
}

/* Says whether this screen will make a sound when an order comes in, and fixes it when
   the browser is holding the sound back until somebody touches the page. */
.chime-button {
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
}

.chime-button-muted {
  color: var(--text-muted);
}

/* Not an error, but it does need a tap, so it asks for one rather than sitting quiet. */
.chime-button-blocked {
  background: var(--mustard);
}

/* ───────────── Carta: category bar ───────────── */

/* Chips scroll horizontally and stick to the top so the categories stay reachable while
   the list scrolls. The bar bleeds to the page edges and ends in a thick ink rule. The
   page scrolls as a whole — so pull-to-refresh keeps working. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: 0 calc(-1 * max(1rem, env(safe-area-inset-left))) -0.5rem;
  padding: 0.6rem max(1rem, env(safe-area-inset-left)) 0.75rem;
  background: var(--bg);
  border-bottom: var(--stroke) solid var(--ink);
  -webkit-overflow-scrolling: touch;
}

.carta-categories::-webkit-scrollbar {
  display: none;
}

.carta-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease),
    background-color 0.15s;
}

.carta-chip:hover {
  background: var(--mustard-soft);
}

.carta-chip:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.carta-chip:focus-visible {
  outline-offset: -5px;
}

.carta-chip-on,
.carta-chip-on:hover {
  background: var(--ink);
  color: var(--mustard);
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--accent);
}

/* Gestión: the single free-text category field on the dish form. */
#tag-input {
  width: 100%;
}

/* Menú del día: the per-day ordering list. */
.daily-order {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.daily-order-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* The grab handle: touch-action none so dragging it never scrolls the page. */
.drag-handle {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 44px;
  cursor: grab;
  touch-action: none;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  user-select: none;
}

.daily-order-row.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

/* ───────────── Carta: ordering over WhatsApp (order.js) ───────────── */

/* A stepper on each line, a bar fixed to the bottom once something is in the order, and a
   sheet that slides up with the summary. */
.order-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}


.order-stepper button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--stroke) solid var(--ink);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--ink);
  /* The display face draws + and − small; a system sans gives a bold, centred glyph. */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background-color 0.12s;
}

.order-stepper .order-add,
.order-stepper .order-plus {
  background: var(--accent);
  color: #fff;
}

.order-stepper .order-add:hover,
.order-stepper .order-plus:hover {
  background: var(--accent-hover);
}

.order-stepper .order-minus:hover {
  background: var(--mustard-soft);
}

.order-stepper button:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.order-quantity {
  min-width: 1.6rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* A dish already in the order gets a mustard edge, so the list shows what is picked. */
.carta-line:has(.order-quantity) {
  background: #fffbea;
  box-shadow: 4px 4px 0 var(--mustard), 4px 4px 0 var(--stroke) var(--ink);
}

/* Leave room under the last line so the bar never covers it. */
body:has(.order-bar:not(.hidden)) main {
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
}

.order-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.85rem max(1rem, env(safe-area-inset-right))
    calc(0.9rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--bg) 55%, rgba(255, 244, 214, 0));
  pointer-events: none;
  animation: pop-up 0.28s var(--ease);
}

.order-bar-button {
  pointer-events: auto;
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 56px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.12s;
}

.order-bar-button:hover,
.order-send:hover {
  background: var(--accent-hover);
}

.order-bar-button:active,
.order-send:active {
  transform: translate(5px, 5px);
  box-shadow: none;
}

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(22, 20, 18, 0.5);
  animation: fade-in 0.2s ease-out;
}

.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 36rem;
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem max(1.1rem, env(safe-area-inset-right))
    calc(1.2rem + env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left));
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  box-shadow: 0 -6px 0 var(--mustard);
  animation: sheet-up 0.32s var(--ease);
}

@media (min-width: 37rem) {
  .order-sheet {
    bottom: 1.25rem;
    border-bottom: 3px solid var(--ink);
    border-radius: 20px;
    box-shadow: 6px 6px 0 var(--ink);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop-up {
  from {
    transform: translateY(120%);
  }
  to {
    transform: none;
  }
}

.order-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.order-sheet-head h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.order-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--stroke) solid var(--ink);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.order-close:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.order-items {
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 0 0.85rem;
}

.order-items:empty {
  display: none;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 2px dashed var(--line);
}

.order-item:last-child {
  border-bottom: none;
}

.order-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.order-item-name small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 0.9rem 0.15rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.order-total span:last-child {
  padding: 0.05rem 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--mustard);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transform: rotate(-2deg);
}

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.order-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.order-time {
  flex: 1 1 4.5rem;
  min-height: 48px;
  padding: 0.55rem;
  border: var(--stroke) solid var(--ink);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background-color 0.12s;
}

.order-time:hover {
  background: var(--mustard-soft);
}

.order-time:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.order-time-on,
.order-time-on:hover {
  background: var(--mustard);
  color: var(--ink);
  font-weight: 800;
  transform: translate(3px, 3px);
  box-shadow: none;
}

.order-error {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--danger);
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-weight: 700;
}

.order-hint {
  margin: 0.9rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

/* The order sent today from this browser, above the carta: a mustard ticket. */
.order-summary {
  margin-top: 0;
  margin-bottom: 0;
  border: 3px solid var(--ink);
  background: var(--mustard);
  box-shadow: 5px 5px 0 var(--ink);
}

.order-summary h2 {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.15rem 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--mustard);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transform: rotate(-1.5deg);
}

.order-summary-lines {
  padding: 0.2rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--card-bg);
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  font-weight: 600;
  border-bottom: 2px dashed var(--line);
}

.order-summary-line:last-child {
  border-bottom: none;
}

.order-summary-line span:last-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-summary .side-item {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
  padding-left: 0;
}

.order-summary .order-total {
  border-top: none;
  margin-top: 0;
}

.order-summary .order-total span:last-child {
  background: var(--card-bg);
}

.order-summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 2px dashed var(--ink);
  font-size: 1.05rem;
}

.order-summary-time {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 1rem;
  border: var(--stroke) solid var(--ink);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.12s;
}

.order-summary-edit:hover {
  background: #fff;
}

.order-summary-edit:active,
.order-discard:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.order-discard {
  max-width: 32rem;
  margin: 0.9rem auto 0;
  min-height: 48px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
  border-style: dashed;
}

.order-discard:hover {
  background: var(--card-bg);
}

.order-cancel-note {
  margin: 0.4rem 0 0.9rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.order-items-cancelled .order-item-name {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--text-muted);
}

.order-items-cancelled {
  margin-bottom: 1.1rem;
}

/* ───────────── Motion ───────────── */

@media (hover: none) {
  .carta-chip:hover,
  .order-time:hover,
  .order-stepper .order-minus:hover,
  .order-summary-edit:hover {
    background: var(--card-bg);
  }

  .order-stepper .order-add:hover,
  .order-stepper .order-plus:hover,
  .order-bar-button:hover,
  .order-send:hover {
    background: var(--accent);
  }

  .carta-chip-on:hover {
    background: var(--ink);
  }

  .order-time-on:hover {
    background: var(--mustard);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .kitchen-line-new {
    animation: none;
  }
}
