/* "Mantel de cuadros": a red-and-white gingham tablecloth with crisp white cards laid on
   it. The check lives on the page and, stronger, on the header band; every word sits on
   plain white so the pattern never fights what has to be read. */
@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:ital,wght@0,600;0,700;1,700&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --red: #b3261e;
  --red-dark: #8c1c15;
  --red-soft: #d9534a;
  --tint: #fdf0eb;
  --basil: #2f6b34;
  --basil-tint: #e8f2e6;
  --ink: #2a1c16;
  --ink-soft: #5c4a40;
  --line: #eadbd2;
  --line-strong: #c9b2a6;

  /* The names the rest of the sheet was written against. */
  --bg: #fbf6f2;
  --card-bg: #ffffff;
  --border: var(--line);
  --text: var(--ink);
  --text-muted: #6b5a50;
  --accent: var(--red);
  --accent-hover: var(--red-dark);
  --danger: #a3241c;

  --font-display: 'Zilla Slab', 'Roboto Slab', Rockwell, 'Courier New', Georgia, serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --radius: 12px;
  --shadow-card: 0 1px 2px rgba(90, 30, 20, 0.08), 0 10px 26px -10px rgba(90, 30, 20, 0.28);
  --shadow-lift: 0 6px 18px -4px rgba(140, 28, 21, 0.45);
  --focus: #1f5f2a;

  /* Two overlapping semi-transparent stripe layers: where they cross, the square doubles. */
  --gingham-soft:
    linear-gradient(90deg, rgba(192, 57, 43, 0.075) 50%, transparent 50%),
    linear-gradient(rgba(192, 57, 43, 0.075) 50%, transparent 50%);
  --gingham-strong:
    linear-gradient(90deg, rgba(192, 57, 43, 0.5) 50%, transparent 50%),
    linear-gradient(rgba(192, 57, 43, 0.5) 50%, transparent 50%);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.45;
  background-color: var(--bg);
  background-image: var(--gingham-soft);
  background-size: 32px 32px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* The header band: the tablecloth seen up close, ending in a scalloped hem, with the name
   on a white plaque laid on top. */
header {
  position: relative;
  padding: calc(1.6rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1.6rem
    max(1rem, env(safe-area-inset-left));
  margin-bottom: 1.6rem;
  text-align: center;
  background-color: #fff;
  background-image: var(--gingham-strong);
  background-size: 26px 26px;
  border-bottom: 4px solid var(--red);
}

header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
  background: radial-gradient(circle at 50% 0, var(--red) 6px, transparent 6.5px) 0 0 / 16px 10px repeat-x;
  pointer-events: none;
}

header h1 {
  display: table;
  margin: 0 auto;
  padding: 0.3rem 1.4rem 0.4rem;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(140, 28, 21, 0.25), 0 8px 18px -6px rgba(60, 15, 10, 0.4);
  font-size: 2.1rem;
  font-style: italic;
  color: var(--red);
  letter-spacing: 0.01em;
}

.subtitle {
  display: table;
  margin: 0.6rem auto 0;
  padding: 0.2rem 0.8rem;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: 0 3px 10px -4px rgba(60, 15, 10, 0.45);
  color: var(--basil);
  font-size: 0.9rem;
  font-weight: 700;
}

.subtitle:empty {
  display: none;
}

.main-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: fit-content;
  max-width: 100%;
  margin: 0.8rem auto 0;
  padding: 0.25rem;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: 0 3px 10px -4px rgba(60, 15, 10, 0.45);
  font-size: 0.92rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.95rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: none;
}

.main-nav a.current {
  background: var(--red);
  color: #fff;
}

@media (hover: hover) {
  .main-nav a:not(.current):hover {
    background: var(--tint);
    color: var(--red);
  }
}

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 {
  background: var(--card-bg);
  border: 1px solid rgba(120, 50, 35, 0.1);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.card h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
  flex: 2;
}

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

input {
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.2);
}

textarea {
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.2);
}

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

.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: 0 0 0 2px var(--danger), var(--shadow-card);
}

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

.notice {
  margin: 0;
  padding: 1rem 1.1rem;
  border: none;
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: var(--tint);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.sides-section {
  margin-top: 1.1rem;
  border-top: 1.5px dashed var(--line-strong);
  padding-top: 0.85rem;
}

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

.sides-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

#add-side,
#add-time {
  min-height: 40px;
  background: var(--card-bg);
  border: 1.5px solid var(--red);
  color: var(--red);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
  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. */
@media (max-width: 719px) {
  .side-row .side-description {
    flex: 1 1 100%;
  }
}

.remove-side {
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--danger);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0.3rem;
}

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

button.primary {
  flex: 1;
  min-height: 48px;
  padding: 0.7rem 1rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
}

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

button.secondary {
  min-height: 48px;
  padding: 0.65rem 1.1rem;
  background: var(--card-bg);
  color: var(--ink-soft);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

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

/* Beats any display a component sets for itself (the category bar is a flex box). */
.hidden {
  display: none !important;
}

.edit-item {
  min-height: 36px;
  padding: 0.2rem 0.6rem;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--red);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}

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

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.65rem 0.8rem;
  border: 1.5px dashed var(--red);
  border-radius: 8px;
  background: var(--tint);
  color: var(--text);
  font-size: 0.88rem;
}

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

.dish-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--card-bg);
}

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

.dish-title {
  font-weight: 800;
  color: var(--ink);
}

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

.dish-price {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}

.delete-dish {
  min-height: 36px;
  padding: 0.2rem 0.6rem;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  padding-left: 0.75rem;
}

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

.daily-dishes {
  margin-top: 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);
  min-height: 52px;
}

.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: 36px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  text-align: left;
}

/* 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: 0 10px 28px rgba(60, 20, 12, 0.3);
  border-radius: 10px;
  background: var(--card-bg);
}

/* The gap the dragged dish will drop into. */
.daily-drag-placeholder {
  border: 2px dashed var(--red);
  border-radius: 10px;
  background: var(--tint);
}

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

.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: 32px;
  background: none;
  border: none;
  padding: 0.15rem 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

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

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

.daily-combos-count {
  color: var(--red);
  font-weight: 800;
}

.daily-combos {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
}

/* This rule comes after .hidden, so it has to re-assert the hide with more weight. */
.daily-combos.hidden {
  display: none;
}

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

.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: var(--red);
  background: var(--tint);
  box-shadow: inset 4px 0 0 var(--red);
}

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

.daily-dish-mark {
  visibility: hidden;
  color: var(--basil);
  font-weight: 800;
}

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

button.primary:disabled {
  background: var(--line-strong);
  box-shadow: none;
  cursor: default;
}

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

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

/* The carta row: name on top, price under it, the stepper to the right of both, and
   allergens and ingredients across the full width below. Read-only apart from the
   stepper, so it is a plain row on the white card rather than a box of its own. */
.carta-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'title step'
    'price step'
    'details details';
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0;
  padding: 0.95rem 0.1rem;
  border: none;
  border-bottom: 1.5px dashed var(--line);
  border-radius: 0;
}

.carta-line > .order-line-title {
  grid-area: title;
  min-width: 0;
  font-size: 1.06rem;
  line-height: 1.3;
}

.carta-line > .dish-price {
  grid-area: price;
  margin-top: 0.1rem;
  font-size: 1.05rem;
}

.carta-line > .order-stepper {
  grid-area: step;
  justify-self: end;
}

.carta-line > .order-line-details {
  grid-area: details;
}

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

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

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

.order-line-remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  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: 1.5px dashed var(--line-strong);
  padding-top: 0.9rem;
}

.time-options-label {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

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

.time-option {
  min-height: 44px;
  padding: 0.45rem 1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.98rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.order-total {
  margin: 0;
  font-weight: 800;
}

.order-summary {
  margin-top: 1rem;
}

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

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

.order-total span:last-child {
  color: var(--red);
}

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

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

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

.kitchen-status {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
}

.kitchen-status-live {
  color: var(--basil);
  border-color: var(--basil);
}

.kitchen-status-down {
  color: var(--danger);
  border-color: 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.3rem;
}

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

.kitchen-chip {
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

/* A batch nobody has to cook any more steps back visually without disappearing. */
.kitchen-group-ready {
  border-color: var(--basil);
}

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

.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-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}

/* Done is an achievement, not a dead control. */
.kitchen-line-done {
  border-color: var(--red);
  background: var(--tint);
}

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

.kitchen-undo {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--text-muted);
  color: white;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

.kitchen-undo.hidden {
  display: none;
}

/* 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: 0.75rem;
  }

  /* 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;
  }

  .kitchen-group .dishes-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  /* On a wide table the carta lines sit in columns, so each one gets a little more air. */
  #carta-lines {
    column-gap: 2rem;
  }

  .card {
    padding: 1.6rem 1.8rem;
  }

  header h1 {
    font-size: 2.6rem;
  }
}

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

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

.day-picker button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.day-picker button:hover {
  border-color: var(--red);
  color: var(--red);
}

/* A family's name, above the dishes that belong to it, with a ribbon of the tablecloth
   running out beside it. It spans the whole grid so the next family starts a fresh row. */
.line-group-heading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.6rem 0 0.1rem;
  padding: 0;
  border: none;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.005em;
}

.line-group-heading::after {
  content: '';
  flex: 1;
  height: 10px;
  min-width: 2rem;
  border-radius: 2px;
  background-color: #fff;
  background-image: var(--gingham-strong);
  background-size: 10px 10px;
  opacity: 0.75;
}

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

@media (min-width: 720px) {
  .line-group-heading {
    grid-column: 1 / -1;
  }
}

/* A dish with no price is a group; the list says so where the price would be. */
.dish-group-tag {
  color: var(--basil);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* A plate that just arrived. */
@keyframes kitchen-arrived {
  from {
    background: #f7d9cc;
    border-color: var(--red);
  }
  to {
    background: var(--card-bg);
    border-color: var(--line);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .kitchen-line-new {
    animation: none;
    border-color: var(--red);
  }
}

/* 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 card. */
.form-actions,
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom));
}

.sticky-actions {
  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: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.form-actions::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.form-actions {
  padding-top: 0.85rem;
}

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

#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.5rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.45rem;
  font-size: 0.95rem;
  text-align: right;
}

.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;
}

.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);
}

.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.78rem;
  color: var(--text-muted);
}

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

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

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

.counter-line-short {
  border-color: var(--danger);
}

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

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

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

/* A small outlined label, like a hand-written card tucked under the plate. */
.allergen-tag {
  padding: 0.08rem 0.42rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

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

.allergen-tag + .order-line-ingredients {
  margin-top: 0.1rem;
}

/* 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. */
.allergen-field {
  margin-top: 1rem;
}

.allergen-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

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

.allergen-chip {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.allergen-chip-on {
  border-color: var(--red);
  background: var(--tint);
  color: var(--red-dark);
  font-weight: 800;
}

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

.side-row .side-ingredients,
.side-row .allergen-chips {
  flex: 1 1 100%;
  min-width: 0;
}

.chime-button {
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  vertical-align: middle;
}

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

.chime-button-blocked {
  border-color: var(--red);
  color: var(--red);
}

/* Carta: the category filter bar. A white strip laid across the cloth, stuck to the top,
   with chips that scroll sideways. It bleeds into main's gutter so the list scrolls under
   a clean edge. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  margin: -0.6rem -1rem 0;
  padding: calc(0.55rem + env(safe-area-inset-top)) 1rem 0.55rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 16px -12px rgba(60, 20, 12, 0.5);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carta-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 1.05rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) {
  .carta-chip:not(.carta-chip-on):hover {
    border-color: var(--red);
    color: var(--red);
  }
}

.carta-chip-on {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

@media (min-width: 720px) {
  .carta-categories {
    margin-inline: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

/* 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.4rem;
}

.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-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 44px;
  cursor: grab;
  touch-action: none;
  color: var(--line-strong);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.2rem;
  user-select: none;
}

.daily-order-row.dragging {
  opacity: 0.6;
  border-color: var(--red);
  cursor: grabbing;
}

/* The line under the bar is its shadow; a hairline keeps the edge on screens that drop it. */
.carta-categories {
  border-bottom: 1px solid var(--line);
}

/* 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.35rem;
}

.order-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid var(--red);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--red);
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.order-stepper .order-add,
.order-stepper .order-plus {
  background: var(--red);
  color: #fff;
  box-shadow: 0 3px 8px -3px rgba(140, 28, 21, 0.6);
}

@media (hover: hover) {
  .order-stepper .order-add:hover,
  .order-stepper .order-plus:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
  }

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

.order-stepper button:active {
  transform: scale(0.9);
}

.order-quantity {
  min-width: 1.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: 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));
}

@keyframes order-rise {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

/* The bottom bar: a frosted white strip edged with the cloth. */
.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.85rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 -8px 20px -12px rgba(60, 20, 12, 0.45);
  animation: order-rise 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.order-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background-color: #fff;
  background-image: var(--gingham-strong);
  background-size: 12px 12px;
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 52px;
  margin: 0 auto;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  transition: background-color 0.15s ease, transform 0.12s ease;
}

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

.order-bar-button:active,
.order-send:active {
  transform: scale(0.98);
}

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(42, 18, 12, 0.5);
  animation: order-fade 0.22s 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: 0 max(1.2rem, env(safe-area-inset-right)) calc(1.2rem + env(safe-area-inset-bottom))
    max(1.2rem, env(safe-area-inset-left));
  border-radius: 20px 20px 0 0;
  background: var(--card-bg);
  box-shadow: 0 -12px 40px -10px rgba(40, 12, 8, 0.5);
  animation: order-rise 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* The cloth's edge across the top of the sheet. */
.order-sheet::before {
  content: '';
  display: block;
  height: 10px;
  margin: 0 calc(-1 * max(1.2rem, env(safe-area-inset-right))) 0.9rem
    calc(-1 * max(1.2rem, env(safe-area-inset-left)));
  background-color: #fff;
  background-image: var(--gingham-strong);
  background-size: 14px 14px;
}

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

.order-sheet-head h2 {
  margin: 0;
  font-size: 1.5rem;
}

.order-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--tint);
  color: var(--ink-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.order-close:hover {
  background: #f8dfd6;
  color: var(--red);
}

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

.order-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.order-item-name small {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--red);
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 800;
}

.order-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.order-time {
  flex: 1 1 5rem;
  min-height: 48px;
  padding: 0.6rem;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
  .order-time:not(.order-time-on):hover {
    border-color: var(--red);
    color: var(--red);
  }
}

.order-time-on {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.order-error {
  margin: 0 0 0.85rem;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: #fdecea;
  color: var(--danger);
  font-weight: 700;
}

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

/* The order sent today from this browser, above the carta: a ticket with the cloth's
   edge across its top. */
.order-summary {
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
  padding-top: 1.6rem;
  border: 1px solid rgba(120, 50, 35, 0.1);
}

.order-summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background-color: #fff;
  background-image: var(--gingham-strong);
  background-size: 12px 12px;
}

.order-summary h2 {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  color: var(--red);
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
}

.order-summary-line span:last-child {
  white-space: nowrap;
  font-weight: 700;
}

.order-summary .order-total {
  border-top: 1.5px dashed var(--line-strong);
  margin-top: 0.4rem;
}

.order-summary-time {
  width: fit-content;
  margin: 0 0 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--basil-tint);
  font-weight: 800;
  color: var(--basil);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--red);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.order-summary-edit:hover {
  background: var(--tint);
}

.order-discard {
  max-width: 32rem;
  margin: 0.6rem auto 0;
  border-color: var(--line-strong);
  color: var(--ink-soft);
  font-weight: 700;
}

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

.order-cancel-note {
  margin: 0.75rem 0 0.25rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #fdecea;
  color: var(--danger);
  font-weight: 700;
}

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

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

@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;
  }
}

/* The carta's rows are divided by their own dashed rule, so the list needs no gap; in the
   desktop grid a short row stays at the top of its cell instead of spreading out. */
#carta-lines {
  gap: 0;
}

.carta-line {
  align-content: start;
}

@media (min-width: 720px) {
  #carta-lines {
    column-gap: 2rem;
  }
}

/* Staff screens carry a longer title and the navigation, so the plaque is smaller. */
header:has(.main-nav) h1 {
  font-size: 1.6rem;
}

#dish-form > label {
  margin-top: 0.85rem;
}

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