@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Nunito+Sans:ital,wght@0,400;0,600;0,700;0,800;1,400&display=swap');

/* "Pizarra de bar": the specials board of a Spanish casa de comidas. A green-black slate
   dusted with chalk, a wooden frame across the header, titles and prices written by hand,
   and everything else in a plain sans that stays readable at arm's length. */
:root {
  color-scheme: dark;

  --bg: #18221d;
  --bg-deep: #111915;
  --card-bg: #202c26;
  --field-bg: #121a16;
  --border: rgba(238, 236, 226, 0.22);
  --border-strong: rgba(238, 236, 226, 0.45);
  --text: #eeece2;
  --text-muted: #b3bdb3;
  --accent: #f3d36b;
  --accent-hover: #f8e08f;
  --accent-ink: #1b1f1a;
  --accent-soft: rgba(243, 211, 107, 0.12);
  --pink: #f5a9bb;
  --blue: #9fcdea;
  --danger: #ff9b8f;
  --danger-soft: rgba(255, 155, 143, 0.12);
  --wood-light: #a8723f;
  --wood: #7d4f27;
  --wood-dark: #553317;

  --font-chalk: 'Caveat', 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive;
  --font-body: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* A chalk line is never quite even: dashes of different lengths, repeated. */
  --chalk-dash: repeating-linear-gradient(
    90deg,
    rgba(238, 236, 226, 0.34) 0 13px,
    transparent 13px 19px,
    rgba(238, 236, 226, 0.26) 19px 27px,
    transparent 27px 32px,
    rgba(238, 236, 226, 0.3) 32px 41px,
    transparent 41px 47px
  );
  --wood-grain:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.13) 0 2px, transparent 2px 11px, rgba(255, 255, 255, 0.05) 11px 12px, transparent 12px 23px),
    linear-gradient(180deg, var(--wood-light), var(--wood) 45%, var(--wood-dark));
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Chalk dust and the smudges left by a cloth: fixed behind everything, so a long carta
   does not stretch them, and never in the way of a tap. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 30% at 12% 8%, rgba(238, 236, 226, 0.07), transparent 70%),
    radial-gradient(ellipse 45% 28% at 88% 26%, rgba(238, 236, 226, 0.05), transparent 70%),
    radial-gradient(ellipse 70% 25% at 35% 62%, rgba(238, 236, 226, 0.04), transparent 70%),
    radial-gradient(ellipse 40% 30% at 78% 88%, rgba(238, 236, 226, 0.05), transparent 70%),
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.35) 100%),
    radial-gradient(rgba(238, 236, 226, 0.05) 0.8px, transparent 1.3px) 0 0 / 23px 23px,
    radial-gradient(rgba(238, 236, 226, 0.04) 0.8px, transparent 1.3px) 7px 11px / 37px 37px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

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

/* The board's frame: a strip of wood above and below the name. */
header {
  position: relative;
  padding: calc(1.6rem + env(safe-area-inset-top)) 1rem 1.3rem;
  margin-bottom: 1.1rem;
  text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent);
}

header::before,
header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: var(--wood-grain);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

header::before {
  top: 0;
  height: calc(10px + env(safe-area-inset-top));
}

header::after {
  bottom: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

header h1 {
  margin: 0;
  font-family: var(--font-chalk);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--text);
  text-shadow: 0 0 1px rgba(238, 236, 226, 0.6), 0 0 10px rgba(238, 236, 226, 0.12);
}

.subtitle {
  margin: 0.2rem 0 0;
  font-family: var(--font-chalk);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
}

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

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px dashed transparent;
}

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

.main-nav a.current {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.card h2 {
  margin-top: 0;
  font-family: var(--font-chalk);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

/* On the carta the board itself is the card: the dishes are written straight on the slate. */
.card:has(> #carta-lines) {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

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

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

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

input,
textarea {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field-bg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(179, 189, 179, 0.7);
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.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 dashed var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-family: var(--font-chalk);
  font-size: 1.6rem;
  line-height: 1.25;
  white-space: pre-wrap;
}

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

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

.sides-header h3 {
  margin: 0;
  font-family: var(--font-chalk);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

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

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

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

.remove-side:hover {
  border-color: var(--danger);
}

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

button.primary {
  flex: 1;
  min-height: 48px;
  padding: 0.7rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

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

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

button.secondary:hover {
  background: rgba(238, 236, 226, 0.06);
}

/* Beats every rule that gives an element its own display, like the category bar's flex. */
.hidden {
  display: none !important;
}

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

.empty-state {
  color: var(--text-muted);
  font-family: var(--font-chalk);
  font-size: 1.45rem;
}

.empty-state a {
  color: var(--accent);
}

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

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

.dish-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: rgba(238, 236, 226, 0.025);
}

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

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

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

.dish-price {
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}

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

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  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(0, 0, 0, 0.55);
  border-radius: 10px;
  background: var(--card-bg);
}

/* The gap the dragged dish will drop into. */
.daily-drag-placeholder {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  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-family: var(--font-chalk);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue);
}

/* Combinados collapse under a toggle so a dish is one short, easy-to-drag row. */
.daily-combos-toggle {
  align-self: flex-start;
  min-height: 36px;
  background: none;
  border: none;
  padding: 0.15rem 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  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 dashed 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(--bg);
}

.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: var(--accent);
  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: rgba(238, 236, 226, 0.2);
  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 reuses the order line's layout — name on the left, price on the right,
   allergens and ingredients wrapping onto their own line below. On the board it is not a
   box but a line of chalk, closed by an uneven dashed rule. */
.carta-line {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.9rem 0.15rem 1rem;
  border: none;
  border-radius: 0;
  background: none;
}

.carta-line::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--chalk-dash);
  border-radius: 2px;
}

#carta-lines {
  gap: 0;
}

.carta-line .order-line-title {
  line-height: 1.3;
}

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

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

.order-line-amount {
  min-width: 1.6rem;
  text-align: right;
  font-weight: 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(--accent-ink);
  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.88rem;
  color: var(--text-muted);
}

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

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

.time-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  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 {
  font-family: var(--font-chalk);
  font-size: 1.6rem;
  line-height: 1;
  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: rgba(0, 0, 0, 0.2);
  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.6rem;
}

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

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

.kitchen-count {
  font-family: var(--font-chalk);
  font-size: 1.6rem;
  font-weight: 700;
  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);
  background: var(--accent-soft);
}

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

.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: var(--accent-ink);
  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;
  }

  header h1 {
    font-size: 3.6rem;
  }

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

  /* On the board two columns of chalk sit further apart, like a hand-written list. */
  #carta-lines {
    column-gap: 2.5rem;
  }

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

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

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

.day-picker button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

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

/* A family's name, written large in chalk above its dishes, with a pink stroke 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.2rem;
  padding-bottom: 0.35rem;
  font-family: var(--font-chalk);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
  text-shadow: 0 0 1px rgba(238, 236, 226, 0.5);
  letter-spacing: 0.01em;
}

.line-group-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(9rem, 60%);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--pink), rgba(245, 169, 187, 0.65) 70%, transparent);
  transform: rotate(-0.8deg);
  transform-origin: left;
}

.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 {
  font-family: var(--font-body);
  line-height: 1.3;
  color: var(--blue);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* 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(243, 211, 107, 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;
}

/* 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.35rem + 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;
  height: 2px;
  background: var(--chalk-dash);
  margin-bottom: 0.75rem;
}

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

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

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

/* Nothing left: the row stays readable but stops being a control. */
.order-line-sold-out {
  background: rgba(0, 0, 0, 0.2);
  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(--bg);
}

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

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

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

.counter-line-empty {
  background: rgba(0, 0, 0, 0.2);
}

.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(--accent-ink);
  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: baseline;
  gap: 0.3rem;
  margin-top: 0.2rem;
  min-width: 0;
}

.allergen-tag {
  padding: 0.05rem 0.5rem;
  border: 1.5px dashed var(--pink);
  border-radius: 999px;
  color: var(--pink);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

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

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

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

.allergen-chip {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.allergen-chip-on {
  border-color: var(--pink);
  border-style: solid;
  background: rgba(245, 169, 187, 0.14);
  color: var(--pink);
  font-weight: 700;
}

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

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

/* Says whether this screen will make a sound when an order comes in, and fixes it when
   the browser is holding the sound back until somebody touches the page. */
.chime-button {
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  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. Solid slate behind them, so the
   dishes passing underneath never read through. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.55rem 1rem 0.65rem;
  margin: 0 -1rem 0.25rem;
  background: var(--bg);
  border-bottom: none;
  box-shadow: 0 8px 12px -6px rgba(0, 0, 0, 0.55);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carta-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.1rem 1rem 0.2rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-family: var(--font-chalk);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

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

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

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

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

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

/* The grab handle: touch-action none so dragging it never scrolls the page. */
.drag-handle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 44px;
  cursor: grab;
  touch-action: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  user-select: none;
}

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

/* Carta: ordering over WhatsApp (order.js). A stepper on each line, a bar fixed to the
   bottom once something is in the order, and a sheet that slides up with the summary. */
.order-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
}

/* Chalk circles: drawn, not filled, so a column of them stays quiet beside the dishes. */
.order-stepper button {
  width: 44px;
  height: 44px;
  padding: 0 0 2px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

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

.order-stepper button:hover {
  background: rgba(238, 236, 226, 0.08);
}

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

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

.order-quantity {
  min-width: 1.6rem;
  text-align: center;
  font-family: var(--font-chalk);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

/* 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.25rem calc(1rem + env(safe-area-inset-right)) calc(0.85rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
  background: linear-gradient(180deg, transparent, rgba(17, 25, 21, 0.92) 45%, var(--bg-deep));
  animation: bar-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 52px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

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

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(5, 9, 7, 0.65);
  animation: fade-in 0.22s ease-out;
}

.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 36rem;
  max-height: 88vh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.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-top: 9px solid var(--wood);
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(ellipse 60% 30% at 20% 15%, rgba(238, 236, 226, 0.05), transparent 70%),
    radial-gradient(ellipse 50% 30% at 80% 70%, rgba(238, 236, 226, 0.04), transparent 70%),
    var(--card-bg);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  animation: sheet-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

@keyframes bar-in {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

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

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

.order-sheet-head h2 {
  margin: 0;
  font-family: var(--font-chalk);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.05;
}

.order-close {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

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

.order-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
}

.order-item::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--chalk-dash);
}

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

.order-item-name small {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-chalk);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

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

.order-field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-chalk);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

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

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

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

/* Ringed in yellow chalk rather than filled, so it never reads as the send button below. */
.order-time-on,
.order-time-on:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.order-time-on::before {
  content: '✓ ';
}

.order-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1.5px dashed var(--danger);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}

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

/* The order sent today from this browser, above the carta: boxed in yellow chalk, the way
   a reserved table is ringed on the board. */
.order-summary {
  position: relative;
  margin-bottom: 0.5rem;
  border: 2px dashed var(--accent);
  background: rgba(32, 44, 38, 0.92);
}

.order-summary h2 {
  margin: 0 0 0.4rem;
  font-size: 1.9rem;
  color: var(--accent);
}

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

.order-summary-line span:last-child {
  white-space: nowrap;
  color: var(--text-muted);
}

.order-summary .order-total {
  position: relative;
  margin-top: 0.3rem;
}

.order-summary .order-total::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--chalk-dash);
}

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

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

.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);
  font-weight: 600;
}

.order-discard:hover {
  background: rgba(238, 236, 226, 0.06);
}

.order-cancel-note {
  margin: 0.75rem 0 0.25rem;
  color: var(--danger);
  font-weight: 600;
}

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

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