/* Micaela — one stylesheet for the public carta and the staff screens.

   The look: a clean, light studio feel. Deep teal is the ink of every action, lime is the
   highlight that sits on it, orange is a rare accent (a dot, an allergen). Pills for every
   chip and button, soft rounded cards with hairline borders instead of heavy shadows, and
   an 8px spacing scale. Grotesk type with tight headings and small tracked eyebrows. */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --teal: #00454a;
  --teal-hover: #00353a;
  --teal-soft: #e8f4e6;
  --lime: #ecfba9;
  --lime-hover: #e1f58a;
  --orange: #f94c00;
  --orange-ink: #a83300;
  --orange-soft: #fff1e8;

  /* Surfaces and ink */
  --bg: #f7f8f4;
  --card-bg: #ffffff;
  --surface: #f3f4f6;
  --border: #e6e6e6;
  --border-strong: #8d929a;
  --text: #111524;
  --text-muted: #565b69;
  --black: #010101;

  /* Kept for the rules that speak in these names. */
  --accent: var(--teal);
  --accent-hover: var(--teal-hover);
  --danger: #b42318;
  --danger-soft: #fdeceb;

  --radius-card: 24px;
  --radius-item: 20px;
  --radius-field: 12px;
  --pill: 99px;
  --shadow-soft: 0 1px 2px rgba(17, 21, 36, 0.04), 0 8px 24px rgba(17, 21, 36, 0.06);
  --shadow-lift: 0 12px 32px rgba(0, 69, 74, 0.22);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tap: 44px;

  --font: 'Inter Tight', 'Neue Montreal', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--lime);
  color: var(--teal);
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* One focus ring for the whole app: visible on keyboard, never on a plain tap. */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ---------- Header ---------- */

header {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(2rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem
    max(1rem, env(safe-area-inset-left));
  text-align: left;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--black);
}

/* The carta's own header: a tracked eyebrow above a big, tight name. */
body:has(#carta-lines) header::before {
  content: 'Comida casera';
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.75rem 0.25rem 0.625rem;
  border-radius: var(--pill);
  background: var(--lime);
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body:has(#carta-lines) header h1 {
  font-size: 3rem;
  letter-spacing: -0.045em;
  line-height: 1;
}

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

.main-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  font-size: 0.9375rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: var(--pill);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.main-nav a:hover {
  color: var(--teal);
  background: var(--surface);
}

.main-nav a.current {
  background: var(--teal);
  color: var(--lime);
}

/* ---------- Layout ---------- */

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

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

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

@media (max-width: 719px) {
  .card {
    padding: 1.25rem 1rem;
  }
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  flex: 2;
}

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

input,
textarea {
  min-height: var(--tap);
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-field);
  background: var(--card-bg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

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

input::placeholder,
textarea::placeholder {
  color: #7a7f8a;
}

input:hover,
textarea:hover {
  border-color: var(--text-muted);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 69, 74, 0.18);
}

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

.field-help {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  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.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-item);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-wrap;
}

.sides-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

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

.sides-header h3 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  color: var(--text-muted);
}

#add-side,
#add-time {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--teal);
  border-radius: var(--pill);
  background: none;
  color: var(--teal);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}

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

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

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

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

button.primary {
  flex: 1;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  background: var(--teal);
  color: var(--lime);
  border: none;
  border-radius: var(--pill);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

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

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

button.secondary {
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

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

/* Hidden means hidden, whatever display a later rule gives the element. */
.hidden {
  display: none !important;
}

.edit-item,
.delete-dish {
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: none;
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--teal);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}

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

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

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

.empty-state {
  margin: 0;
  padding: 1rem 0;
  color: var(--text-muted);
}

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--lime);
  color: var(--teal);
  font-size: 0.875rem;
  font-weight: 500;
}

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

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

.dish-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.875rem 1rem;
  background: var(--card-bg);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

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

/* The name gets the room it needs; the price and its two actions wrap under it on a
   narrow phone instead of squeezing it to one word per line. */
.dish-item-header > :first-child {
  flex: 1 1 11rem;
  min-width: 0;
}

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

.dish-title {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

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

.dish-price {
  font-weight: 600;
  color: var(--teal);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

.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;
  min-height: 3.25rem;
  background: var(--card-bg);
}

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

.daily-line:focus-visible {
  outline-offset: 4px;
  border-radius: 8px;
}

/* 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: var(--shadow-lift);
  border-radius: 16px;
  background: var(--card-bg);
}

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

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

.daily-group-label {
  margin: 0 0 0.125rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.72px;
}

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

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

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

.daily-combos-count {
  color: var(--teal);
  font-weight: 600;
}

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

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

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

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

.daily-dish-mark {
  visibility: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--pill);
  background: var(--teal);
  color: var(--lime);
  font-size: 0.8125rem;
  font-weight: 700;
}

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

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

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

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

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

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

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

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

.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.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

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

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

.time-option {
  min-height: var(--tap);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
}

.time-option.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--lime);
  font-weight: 600;
}

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

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

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

/* ---------- Kitchen / counter (legacy screens, same language) ---------- */

.kitchen-status,
.kitchen-chip {
  margin-left: 0.5rem;
  font-size: 0.8125rem;
  padding: 0.125rem 0.625rem;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.kitchen-chip {
  margin-left: 0;
}

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

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

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

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

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

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

.counter-line {
  padding-right: 2.6rem;
}

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

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

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

.kitchen-line-done {
  border-color: var(--teal);
  background: var(--teal-soft);
}

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

.kitchen-undo,
.counter-add {
  position: absolute;
  right: -0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

.kitchen-undo {
  top: -0.55rem;
  background: var(--text-muted);
  font-size: 0.9rem;
}

.counter-add {
  bottom: -0.55rem;
  background: var(--teal);
  color: var(--lime);
  font-size: 1rem;
}

@keyframes kitchen-arrived {
  from {
    background: var(--lime);
    border-color: var(--teal);
  }
  to {
    background: var(--card-bg);
    border-color: var(--border);
  }
}

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

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

.counter-count {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

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

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

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

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

/* ---------- Desktop ---------- */

@media (min-width: 720px) {
  header,
  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));
  }
}

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

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

.day-picker button {
  flex: none;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease);
}

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

.day-picker .day-today {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--teal);
  font-weight: 600;
}

.day-picker .day-today:hover {
  background: var(--lime-hover);
  border-color: var(--lime-hover);
}

/* A family's name, above the dishes that belong to it: a small tracked eyebrow with an
   orange dot, well apart from the dish rows. It spans the whole grid on desktop. */
.line-group-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 2rem 0 0.25rem;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.72px;
  line-height: 1.3;
}

.line-group-heading::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.line-group-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.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: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.72px;
}

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

/* .form-actions is a flex row: the line above it has to span the row, not sit in it. */
.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, so a long wrapped name never stretches it. */
.daily-dish-stock {
  width: 4.5rem;
  height: 2.5rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.9375rem;
  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(--surface);
  cursor: not-allowed;
}

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

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

/* Allergens and ingredients under the name. Always there rather than behind a control:
   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.375rem;
  margin-top: 0.125rem;
}

.allergen-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.625rem;
  border-radius: var(--pill);
  background: var(--orange-soft);
  color: var(--orange-ink);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.order-line-ingredients {
  flex: 1 1 100%;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* 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.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

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

.allergen-chip {
  min-height: 2.25rem;
  padding: 0 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.allergen-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

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

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

#dish-form > label:not(.details-field) {
  margin-top: 1rem;
}

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

.side-row .allergen-chip {
  background: var(--card-bg);
}

.side-row .allergen-chip-on {
  background: var(--orange-soft);
}

.chime-button {
  margin-left: 0.5rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  vertical-align: middle;
}

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

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

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

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

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

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

.drag-handle:hover {
  background: var(--surface);
  color: var(--teal);
}

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

/* ================= Carta (public) ================= */

/* The dishes sit straight on the page as their own soft cards; the wrapping card steps
   aside so there is no box inside a box. */
body:has(#carta-lines) main {
  gap: 1rem;
}

body:has(#carta-lines) main > .card:has(#carta-lines) {
  padding: 0;
  border: 0;
  background: transparent;
}

/* The category filter bar: pills that scroll sideways and stick to the top, full-bleed on
   a phone, frosted so the list reads as passing underneath. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin: 0 -1rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: rgba(247, 248, 244, 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  scroll-padding-inline: 1rem;
  -webkit-overflow-scrolling: touch;
}

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

.carta-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.carta-chip:hover {
  border-color: var(--teal);
}

.carta-chip-on,
.carta-chip-on:hover {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--lime);
  font-weight: 600;
}

/* A dish row: name left and price right as a stat; allergens, ingredients and the stepper
   on the line below, so the thumb finds the + at the same spot on every card. */
.dish-item.carta-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 0.5rem 1rem;
  padding: 1.125rem 1.125rem 1rem 1.25rem;
  border-radius: var(--radius-item);
  scroll-margin-top: 5rem;
}

.dish-item.carta-line:has(.order-quantity) {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

.carta-line .order-line-title {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.0625rem;
  line-height: 1.3;
}

.carta-line .dish-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

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

.carta-line .dish-price {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--teal);
}

.carta-line .order-line-details {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin: 0;
}

.carta-line .order-stepper {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: end;
}

/* Nothing to list under the name (a drink, say): one line, name, price and stepper. */
.dish-item.carta-line:not(:has(.order-line-details)) {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto;
  align-items: center;
  padding-block: 0.75rem;
}

.carta-line:not(:has(.order-line-details)) .order-stepper {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
}

/* Desktop: rows in a grid of equal cards. */
@media (min-width: 720px) {
  body:has(#carta-lines) header h1 {
    font-size: 4rem;
  }

  .carta-categories {
    margin: 0;
    padding: 0.75rem 0;
    border-radius: 0;
  }

  #carta-lines {
    gap: 0.75rem;
  }

  .order-summary {
    width: 100%;
    max-width: 36rem;
  }
}

/* ---------- Ordering: stepper, bar, sheet ---------- */

.order-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border-radius: var(--pill);
}

.order-stepper:has(.order-quantity) {
  background: var(--surface);
}

.order-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--teal);
  font-family: inherit;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}

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

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

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

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

.order-quantity {
  min-width: 1.5rem;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Leave room under the last line so the fixed 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 max(1rem, env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(247, 248, 244, 0), var(--bg) 55%);
  pointer-events: none;
  animation: order-rise 0.35s var(--ease);
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 3.5rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--pill);
  background: var(--teal);
  color: var(--lime);
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.order-bar-button {
  box-shadow: var(--shadow-lift);
}

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

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

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(1, 1, 1, 0.4);
  animation: order-fade 0.25s 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.75rem max(1.25rem, env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  border-radius: 32px 32px 0 0;
  background: var(--card-bg);
  box-shadow: 0 -8px 40px rgba(1, 1, 1, 0.12);
  animation: order-sheet-up 0.38s var(--ease);
}

/* The grab bar: says "this is a sheet" without being a control. */
.order-sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 0.75rem;
  border-radius: var(--pill);
  background: var(--border);
}

@media (min-width: 720px) {
  .order-sheet {
    bottom: 1.5rem;
    border-radius: 32px;
    max-height: calc(100vh - 3rem);
    padding-bottom: 1.5rem;
  }

  .order-sheet::before {
    display: none;
  }
}

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

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

@keyframes order-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.order-sheet-head h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.order-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

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

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

.order-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  line-height: 1.3;
}

.order-item-name small {
  display: block;
  margin-top: 0.125rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* The total as a stat: a small tracked caption over a big number. */
.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding: 1rem 0;
  font-weight: 600;
}

.order-total span:first-child {
  font-size: 0.8125rem;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.order-total span:last-child {
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.order-field {
  margin-bottom: 0.25rem;
}

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.order-time {
  flex: 1;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.order-time:hover {
  border-color: var(--teal);
}

.order-time-on,
.order-time-on:hover {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--lime);
  font-weight: 600;
}

.order-error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 500;
}

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

/* ---------- Today's order, above the carta: the one dark card on the page ---------- */

.order-summary {
  margin-top: 0;
  border: none;
  background: var(--teal);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.order-summary h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  color: var(--lime);
}

.order-summary .side-item {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: inherit;
  padding-left: 0;
  border: none;
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.375rem 0;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}

.order-summary .order-total {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin-top: 0.5rem;
}

.order-summary .order-total span:first-child {
  color: rgba(255, 255, 255, 0.78);
}

.order-summary .order-total span:last-child {
  color: #ffffff;
}

.order-summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1.0625rem;
}

.order-summary-time {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--pill);
  background: rgba(236, 251, 169, 0.14);
  color: var(--lime);
  font-weight: 600;
}

.order-summary-time::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--teal);
  border-radius: var(--pill);
  background: var(--card-bg);
  color: var(--teal);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}

.order-summary-edit {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--teal);
}

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

.order-summary :focus-visible {
  outline-color: var(--lime);
}

.order-sheet .order-send,
.order-sheet .order-discard {
  max-width: none;
}

.order-discard {
  max-width: 32rem;
  margin: 0.5rem auto 0;
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}

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

.order-cancel-note {
  margin: 0.5rem 0 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 500;
}

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

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

/* ---------- Motion ---------- */

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

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