/* Nocturno: a warm, dark theme. Layered charcoal surfaces, off-white text and one saffron
   accent for what matters most — prices, the active category and the main action. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;

  /* Surfaces, from the page up to the sheet that floats over it. */
  --bg: #161412;
  --card-bg: #1f1c19;
  --surface-2: #2a2622;
  --surface-3: #35302b;
  --field-bg: #1a1815;

  /* Hairlines: light at low alpha, so they read the same on every surface. */
  --border: rgba(255, 238, 214, 0.1);
  --border-strong: rgba(255, 238, 214, 0.18);

  --text: #f3ede4;
  --text-muted: #a99e90;
  --text-soft: #cfc4b5;

  --accent: #e8a33d;
  --accent-hover: #f3b75a;
  --accent-soft: rgba(232, 163, 61, 0.12);
  --accent-line: rgba(232, 163, 61, 0.45);
  --on-accent: #1c1407;

  --danger: #f08a7a;
  --danger-soft: rgba(240, 138, 122, 0.12);

  --radius: 14px;
  --radius-sm: 10px;
  --gutter: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --font: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(232, 163, 61, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(232, 163, 61, 0.35);
  color: var(--text);
}

/* One focus ring for every control, only when the keyboard put it there. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header {
  padding: calc(1.75rem + env(safe-area-inset-top)) var(--gutter) 1rem;
  text-align: center;
}

header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* The public carta wears a small eyebrow over the name: what kind of place this is. */
header:has(#carta-date) h1::before {
  content: 'Comida casera' / '';
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
}

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

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--card-bg);
}

.main-nav a.current {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* On the carta the dishes are the cards; the section holding them steps out of the way
   instead of framing a box inside a box. */
.card:has(> .dishes-list > .carta-line),
.card:has(> .dishes-list > .notice),
.card:has(> #carta-lines) {
  padding: 0;
  border: none;
  background: none;
}

.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: 600;
  color: var(--text-muted);
  flex: 2;
}

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

input,
select,
textarea {
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: #7d7367;
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 238, 214, 0.28);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.22);
}

/* The date field's calendar icon is drawn dark by default; lift it onto the dark field. */
input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(0.3);
  cursor: pointer;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

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

.field-help {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

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

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

.notice {
  margin: 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

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

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

.sides-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

#add-side,
#add-time {
  min-height: 2.75rem;
  padding: 0 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background-color 0.15s;
}

#add-side:hover,
#add-time:hover {
  background: rgba(232, 163, 61, 0.2);
}

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  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 {
  min-width: 2.75rem;
  min-height: 2.75rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem;
}

.remove-side:hover {
  background: var(--danger-soft);
}

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

button.primary {
  flex: 1;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

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

button.primary:active {
  transform: scale(0.985);
}

button.secondary {
  min-height: 3rem;
  padding: 0.65rem 1.2rem;
  background: none;
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

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

.hidden {
  display: none;
}

.edit-item {
  min-height: 2.75rem;
  padding: 0 0.6rem;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

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

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

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.7rem 0.85rem;
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.85rem;
}

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

.dish-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  background: var(--surface-2);
}

.card .dish-item {
  background: rgba(255, 238, 214, 0.025);
}

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

/* The name gets a real line of its own on a phone; the price and the two actions drop
   below it, right-aligned, instead of squeezing the name into a column one word wide. */
.dish-item-header > :first-child {
  flex: 1 1 12rem;
  min-width: 0;
}

.dish-item-header > :last-child {
  margin-left: auto;
}

.dish-title {
  font-weight: 700;
  color: var(--text);
}

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

.dish-price {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.delete-dish {
  min-height: 2.75rem;
  padding: 0 0.6rem;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.delete-dish:hover {
  background: var(--danger-soft);
}

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  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);
  transition: border-color 0.15s, background-color 0.15s;
}

.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: 2.75rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  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 12px 32px rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

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

.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.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

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

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

.daily-combos-count {
  color: var(--accent);
  font-weight: 700;
}

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

/* 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(--surface-2);
}

.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

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

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

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

button.primary:disabled {
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: default;
  transform: none;
}

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

/* On the carta each dish is a raised card that reads top to bottom like a delivery app:
   the name first, then what is in it and its allergens, and the price beside the stepper
   along the bottom edge, where the thumb already is. */
.dish-item.carta-line {
  gap: 0.55rem 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border-color: var(--border);
  transition: border-color 0.2s;
}

.dish-item.carta-line:has(.order-quantity) {
  border-color: var(--accent-line);
}

.carta-line .order-line-title {
  order: 0;
  flex: 1 1 100%;
  min-width: 0;
  line-height: 1.3;
}

.carta-line .dish-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.carta-line .order-line-details {
  order: 1;
  margin-top: 0;
}

.carta-line .dish-price {
  order: 2;
  margin-right: auto;
  font-size: 1.1rem;
  font-weight: 800;
}

.carta-line .order-stepper {
  order: 3;
}

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

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

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

.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: var(--on-accent);
  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: 1px dashed var(--border-strong);
  padding-top: 0.9rem;
}

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

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

.time-option {
  min-height: 2.75rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

.time-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

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

.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: 1px dashed var(--border-strong);
  font-size: 1.05rem;
}

.order-total span:last-child {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

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

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

.time-option.closed {
  color: var(--text-muted);
  background: var(--card-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(--border-strong);
}

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

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

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

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

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

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

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

.kitchen-count {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  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 {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.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(--surface-3);
  color: var(--text);
  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;
}

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

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

  /* Carta cards in a grid: the price row settles on the bottom edge of every card, so
     a row of cards lines up however long each description runs. */
  #carta-lines {
    column-gap: 1rem;
    row-gap: 1rem;
  }

  .dish-item.carta-line {
    align-content: flex-start;
  }

  .dish-item.carta-line:hover {
    border-color: var(--border-strong);
  }

  .dish-item.carta-line:has(.order-quantity):hover {
    border-color: var(--accent);
  }
}

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

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

.day-picker button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

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

/* A family's name, sitting above the dishes that belong to it. It spans the whole grid so
   the family below it starts on a fresh row instead of continuing mid-line. Painted in the
   brand colour with a hairline running out to the right so a family reads as a clear
   header, well apart from the dish cards under it — the first one keeps a smaller top gap
   so it does not float. */
.line-group-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.6rem 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.line-group-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent-line), transparent);
}

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

@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(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* 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: rgba(232, 163, 61, 0.3);
    border-color: var(--accent);
  }
  to {
    background: var(--card-bg);
    border-color: var(--border);
  }
}

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

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

/* 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.5rem + 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: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* The bar's buttons lay out in a row; the line above them is the row's own top edge. */
.form-actions {
  flex-wrap: wrap;
}

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

.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: 4rem;
  height: 2.25rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.4rem;
  font-size: 0.9rem;
  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);
}

/* 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(--surface-2);
}

.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(--accent);
  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 {
  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(--accent);
  color: var(--on-accent);
  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:
   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%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* Quiet but legible: an outlined pill a shade above the muted text, so it is found when
   looked for without competing with the dish name or the price. */
.allergen-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 238, 214, 0.03);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.order-line-ingredients {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* On the carta the ingredients read as the dish's description, right under its name, with
   the allergen pills on a line of their own below. */
.carta-line .order-line-ingredients {
  order: -1;
  flex: 1 1 100%;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}

/* 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: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

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

.allergen-chip {
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.allergen-chip:hover {
  color: var(--text);
  border-color: rgba(255, 238, 214, 0.3);
}

.allergen-chip-on,
.allergen-chip-on:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

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

.details-field + label {
  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: 1px solid var(--border-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);
}

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

/* Carta: the category filter bar. Chips scroll horizontally and stick to the top so the
   categories stay reachable while the list scrolls. It runs edge to edge on a phone and
   frosts what scrolls underneath. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.65rem var(--gutter);
  margin: 0 calc(-1 * var(--gutter)) 0.25rem;
  background: rgba(22, 20, 18, 0.86);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-padding-inline: var(--gutter);
}

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

/* No families, no bar. */
.carta-categories.hidden {
  display: none;
}

.carta-chip {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.carta-chip:hover {
  color: var(--text);
  border-color: rgba(255, 238, 214, 0.3);
}

.carta-chip-on,
.carta-chip-on:hover {
  border-color: var(--accent);
  transition: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

/* 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;
  cursor: grab;
  touch-action: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.6rem 0.4rem;
  border-radius: 8px;
  user-select: none;
}

.drag-handle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

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

/* The carta scrolls as a normal page — so pull-to-refresh keeps working — with the category
   bar stuck to the top, reachable however far down the dishes you are. A line under it marks
   where the fixed part ends and the list begins. */
.carta-categories {
  border-bottom: 1px solid var(--border);
}

/* 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.25rem;
  border-radius: 999px;
}

/* 40px to the eye, 44px to the finger: the ring around each button widens what a thumb
   can hit without making the row look heavy. */
.order-stepper button {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.order-stepper button::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
}

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

.order-stepper button:hover {
  background: var(--surface-3);
}

.order-stepper .order-add,
.order-stepper .order-plus {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

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

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

/* 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: 1.5rem var(--gutter) calc(0.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 45%, rgba(22, 20, 18, 0));
  pointer-events: none;
  animation: rise 0.28s var(--ease);
}

.order-bar > * {
  pointer-events: auto;
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 3.25rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(232, 163, 61, 0.22), 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: background-color 0.15s, transform 0.1s;
}

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

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

.order-bar-button:focus-visible,
.order-send:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(8, 7, 6, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.25s ease-out;
}

.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 36rem;
  max-height: 85vh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.6rem var(--gutter) calc(1.1rem + env(safe-area-inset-bottom));
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 1.4rem 1.4rem 0 0;
  background: var(--surface-2);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  animation: sheet-up 0.32s var(--ease);
}

/* The grab handle: a hint that the sheet sits over the carta, not a page of its own. */
.order-sheet::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 0.3rem;
  margin: 0 auto 0.8rem;
  border-radius: 999px;
  background: rgba(255, 238, 214, 0.22);
}

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

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.order-sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.order-close {
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.5rem;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.order-close:hover {
  color: var(--text);
  background: var(--surface-3);
}

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

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

.order-item-name small {
  display: block;
  margin-top: 0.1rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.order-item .order-stepper button {
  background: var(--surface-3);
}

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

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.9rem 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.order-total span:last-child {
  font-size: 1.25rem;
  font-weight: 800;
}

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

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

.order-time {
  flex: 1;
  min-height: 3rem;
  padding: 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.order-time:hover {
  border-color: rgba(255, 238, 214, 0.32);
}

.order-time-on,
.order-time-on:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.order-error {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(240, 138, 122, 0.35);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
  font-size: 0.92rem;
}

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

/* The order sent today from this browser, above the carta. */
.order-summary {
  margin-bottom: 1rem;
  border: 1px solid var(--accent-line);
  background:
    linear-gradient(160deg, rgba(232, 163, 61, 0.1), rgba(232, 163, 61, 0) 55%),
    var(--card-bg);
}

.order-summary h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

/* A check in a saffron disc: this one has already gone out. */
.order-summary h2::before {
  content: '✓' / '';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 800;
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.order-summary .order-total {
  border-top: 1px solid var(--border);
  margin-top: 0.4rem;
}

.order-summary-time {
  margin: 0 0 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

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

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

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

.order-cancel-note {
  margin: 0.5rem 0 0.25rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}

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

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

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

/* Motion is decoration here: anyone who asks for less gets none of it. */
@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;
  }
}
