/* Micaela — "Retro años 70". A Spanish cafeteria from 1975: cream walls, chocolate
   lettering, burnt orange and mustard stripes, a hint of avocado. One stylesheet serves the
   public carta and the two staff screens, so every rule below works for all three. */

@import url('https://fonts.googleapis.com/css2?family=Shrikhand&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* Surfaces */
  --bg: #f5e6c8;
  --card-bg: #fffaee;
  --cream: #fff4dc;
  --border: #e2c99a;
  --border-strong: #c9a46a;

  /* Ink */
  --text: #3f2412;
  --text-muted: #765235;

  /* The 70s */
  --brown: #4e2a14;
  --brown-hover: #6a3a1c;
  --orange: #cf5a1c;
  --mustard: #eeb33b;
  --mustard-soft: #f8dc95;
  --avocado: #8b9a3a;
  --avocado-dark: #4f5d17;

  /* Burnt orange dark enough for text on cream (≈5.5:1). */
  --accent: #ad4212;
  --accent-hover: #8e3610;
  --accent-soft: #fbe3cc;
  --danger: #a32a1f;

  --radius: 20px;
  --radius-small: 14px;
  --shadow: 0 2px 0 rgba(78, 42, 20, 0.12), 0 6px 18px rgba(78, 42, 20, 0.08);

  --font-display: 'Shrikhand', 'Cooper Black', 'Georgia', 'Times New Roman', serif;
  --font-body: 'Nunito', 'Avenir Next', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Four parallel bands: chocolate, orange, mustard, avocado. */
  --stripes: linear-gradient(
    to bottom,
    var(--brown) 0 25%,
    var(--orange) 25% 50%,
    var(--mustard) 50% 75%,
    var(--avocado) 75% 100%
  );
  --stripes-up: linear-gradient(
    to top,
    var(--brown) 0 25%,
    var(--orange) 25% 50%,
    var(--mustard) 50% 75%,
    var(--avocado) 75% 100%
  );
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Header: chocolate sign with the stripe band under it ---------- */

header {
  position: relative;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem 1.25rem;
  padding-left: calc(1rem + env(safe-area-inset-left));
  padding-right: calc(1rem + env(safe-area-inset-right));
  margin-bottom: 2.25rem;
  text-align: center;
  background: var(--brown);
  color: var(--cream);
}

header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 24px;
  background: var(--stripes);
}

header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--mustard);
  text-shadow: 3px 3px 0 var(--orange);
}

.subtitle {
  color: var(--mustard-soft);
  margin: 0.35rem 0 0;
  font-weight: 600;
  font-size: 0.95rem;
}

/* The staff screens carry a longer title and a nav; keep the sign compact there. */
header:has(.main-nav) h1 {
  font-size: 1.75rem;
}

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

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

.main-nav a:hover {
  background: rgba(255, 244, 220, 0.12);
}

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

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

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

.card h2 {
  margin-top: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--brown);
}

/* ---------- Forms (staff screens) ---------- */

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

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

/* The day picker's row must shrink to the card instead of pushing "Hoy" past its edge. */
label:has(.day-picker) {
  min-width: 0;
}

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

input,
textarea {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-small);
  background: #fffdf7;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--avocado-dark);
  outline-offset: 1px;
  border-color: var(--avocado-dark);
}

::placeholder {
  color: #a08466;
}

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

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

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

.sides-section {
  margin-top: 1rem;
  border-top: 2px dashed var(--border);
  padding-top: 0.75rem;
}

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

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

#add-side,
#add-time {
  min-height: 44px;
  background: none;
  border: 2px solid var(--brown);
  color: var(--brown);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
}

#add-side:hover,
#add-time:hover {
  background: var(--mustard-soft);
}

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
  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: 999px;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
}

.remove-side:hover {
  background: #f7d7cf;
}

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

button.primary {
  flex: 1;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  background: var(--brown);
  color: var(--cream);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--orange);
}

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

button.primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--orange);
}

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

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

/* Wins over any component's own display (the category bar is display:flex). */
.hidden {
  display: none !important;
}

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

.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.9rem;
  border: 2px dashed var(--orange);
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.88rem;
}

/* ---------- Dish lists ---------- */

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

.dish-item {
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 0.8rem 1rem;
  background: var(--card-bg);
}

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

/* The name keeps a readable width; on a phone the price and actions drop below it. */
.dish-item-header > :first-child {
  flex: 1 1 10rem;
  min-width: 0;
}

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

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

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

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

.delete-dish {
  min-height: 44px;
  padding: 0 0.5rem;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
}

.delete-dish:hover {
  background: #f7d7cf;
}

.side-item {
  display: flex;
  justify-content: space-between;
  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);
}

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

/* 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(78, 42, 20, 0.3);
  border-radius: 18px;
  background: var(--card-bg);
}

/* The gap the dragged dish will drop into. */
.daily-drag-placeholder {
  border: 2px dashed var(--orange);
  border-radius: 18px;
  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.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-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

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

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

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

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

.daily-combos.hidden {
  display: none !important;
}

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

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

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

.daily-dish-mark {
  visibility: hidden;
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--avocado-dark);
  color: var(--cream);
  font-weight: 800;
  font-size: 0.9rem;
}

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

button.primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  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;
  min-width: 0;
}

/* The carta row: name on the left, price and stepper on the right, allergens and
   ingredients wrapping onto their own line below. */
.carta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

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

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

.order-line-amount {
  min-width: 1.6rem;
  text-align: right;
  font-weight: 800;
  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: 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(--border);
  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: 44px;
  padding: 0.45rem 1rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

.time-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  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: 2px dashed var(--border);
  font-size: 1.05rem;
}

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

.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(--cream);
  text-decoration: line-through;
  cursor: not-allowed;
}

/* ---------- Kitchen / counter (kept for the screens that still use them) ---------- */

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

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

.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: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.kitchen-group-ready {
  border-color: var(--avocado);
}

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

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

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

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

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

.kitchen-line-done {
  border-color: var(--orange);
  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(--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 !important;
}

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

  header {
    padding-top: calc(2rem + env(safe-area-inset-top));
    padding-bottom: 1.6rem;
  }

  header h1 {
    font-size: 3rem;
  }

  header:has(.main-nav) h1 {
    font-size: 2.3rem;
  }

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

.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.5rem 0.75rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--brown);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.day-picker button:hover {
  border-color: var(--brown);
  background: var(--mustard-soft);
}

/* A family's name above its dishes, in the groovy display face with a short stripe under
   it. It spans the whole grid so the family below starts on a fresh row. */
.line-group-heading {
  position: relative;
  margin: 1.6rem 0 0.4rem;
  padding-bottom: 0.7rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--brown);
  letter-spacing: 0.01em;
}

.line-group-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 4.5rem;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(
    to bottom,
    var(--orange) 0 33.3%,
    var(--mustard) 33.3% 66.6%,
    var(--avocado) 66.6% 100%
  );
}

.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: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes kitchen-arrived {
  from {
    background: var(--mustard-soft);
    border-color: var(--orange);
  }
  to {
    background: var(--card-bg);
    border-color: var(--border);
  }
}

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

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

/* The bar is a row of buttons; its separator line sits above them, not beside them. */
.form-actions {
  flex-wrap: wrap;
}

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

.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.5rem;
  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(--cream);
  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(--cream);
}

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

.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(--accent);
  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 visible: 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.1rem;
  min-width: 0;
}

.allergen-tag {
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: var(--mustard);
  color: var(--brown);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.order-line-ingredients {
  flex: 1 1 100%;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.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.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

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

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

.allergen-chip-on {
  border-color: var(--mustard);
  background: var(--mustard);
  color: var(--brown);
  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: 2px solid var(--border);
  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(--accent);
  color: var(--accent);
}

/* ---------- Carta: sticky category chips ---------- */

/* Sticks to the top so the categories stay reachable; bleeds to the edges of main so the
   chips scroll under the screen edge rather than stopping short of it. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: -0.75rem -1rem 0;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border-bottom: 2px solid var(--border-strong);
  -webkit-overflow-scrolling: touch;
}

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

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

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

.carta-chip-on,
.carta-chip-on:hover {
  border-color: var(--brown);
  background: var(--brown);
  color: var(--mustard);
}

#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-grid;
  place-items: center;
  min-width: 32px;
  min-height: 44px;
  cursor: grab;
  touch-action: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  user-select: none;
}

.drag-handle:hover {
  color: var(--brown);
}

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

/* The carta list sits straight on the cream page: each dish is its own card, so the
   section around them drops its own box. */
.card:has(> #carta-lines) {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

#carta-lines {
  gap: 0.7rem;
}

#carta-lines .dish-item {
  padding: 0.9rem 0.9rem 0.9rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 0 2px 0 rgba(78, 42, 20, 0.1);
}

#carta-lines .dish-title {
  font-size: 1.05rem;
  line-height: 1.25;
}

#carta-lines .dish-price {
  font-size: 1.05rem;
}

/* A dish already in the order picks up an orange edge. */
#carta-lines .carta-line:has(.order-quantity) {
  border-color: var(--orange);
  background: #fff3e2;
}

/* ---------- Carta: ordering (order.js) ---------- */

.order-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.order-stepper button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--brown);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--brown);
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

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

.order-stepper .order-add,
.order-stepper .order-plus {
  background: var(--brown);
  color: var(--mustard);
}

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

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

.order-quantity {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--brown);
}

/* Leave room under the last line so the bar never covers it. */
body:has(.order-bar:not(.hidden)) main {
  padding-bottom: calc(7.5rem + 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;
  }
}

.order-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: calc(14px + 0.7rem) calc(1rem + env(safe-area-inset-right)) calc(0.8rem + env(safe-area-inset-bottom))
    calc(1rem + env(safe-area-inset-left));
  background: var(--stripes-up) top / 100% 14px no-repeat, var(--bg);
  box-shadow: 0 -6px 18px rgba(78, 42, 20, 0.12);
  animation: order-rise 0.25s ease-out;
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 52px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: var(--brown);
  color: var(--cream);
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--orange);
  font-variant-numeric: tabular-nums;
}

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

.order-bar-button:active,
.order-send:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--orange);
}

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(46, 24, 10, 0.5);
  animation: order-fade 0.2s ease-out;
}

.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 36rem;
  max-height: 85vh;
  max-height: 85dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(16px + 1rem) calc(1.1rem + env(safe-area-inset-right)) calc(1.1rem + env(safe-area-inset-bottom))
    calc(1.1rem + env(safe-area-inset-left));
  border-radius: 24px 24px 0 0;
  background: var(--stripes) top / 100% 16px no-repeat, var(--card-bg);
  box-shadow: 0 -10px 30px rgba(46, 24, 10, 0.25);
  animation: order-rise 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}

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

.order-sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--brown);
}

.order-close {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--brown);
  font-family: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

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

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

.order-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--brown);
}

.order-item-name small {
  display: block;
  margin-top: 0.1rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 0;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--brown);
}

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 800;
  color: var(--brown);
}

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

.order-time {
  flex: 1 1 0;
  min-width: 4.5rem;
  min-height: 48px;
  padding: 0.6rem;
  border: 2px solid var(--brown);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--brown);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

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

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

.order-error {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-small);
  background: #f9dcd5;
  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 cream ticket with the stripe
   band across its top. */
.order-summary {
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
  padding-top: calc(14px + 1.1rem);
  border: 2px solid var(--brown);
  background: var(--stripes) top / 100% 14px no-repeat, var(--card-bg);
}

.order-summary h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--brown);
}

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

.order-summary-line span:last-child {
  white-space: nowrap;
  color: var(--accent);
  font-weight: 800;
}

.order-summary .order-total {
  border-top: 2px dashed var(--border);
  margin-top: 0.3rem;
}

.order-summary-time {
  display: inline-block;
  margin: 0 0 0.9rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--avocado-dark);
  color: var(--cream);
  font-weight: 800;
}

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

.order-summary-edit:hover,
.order-discard:hover {
  background: var(--mustard-soft);
}

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

.order-cancel-note {
  margin: 0.75rem 0 0.25rem;
  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;
  }

  .kitchen-line-new {
    animation: none;
    border-color: var(--accent);
  }
}
