/* "Cuaderno de la abuela": the carta as a page of grandma's recipe notebook. Off-white
   ruled paper with a red margin, punched holes along the top, family names written by hand
   and run over with a yellow highlighter, prices in blue ballpoint, allergens circled in
   red pen. Handwriting only where it stays easy to read; everything small is a plain sans. */
@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Patrick+Hand&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* Paper and desk */
  --desk: #e7dcc6;
  --paper: #fffcf2;
  --card-bg: #fffefa;
  --bg: #f6f0e2;
  --rule: rgba(74, 128, 196, 0.2);
  --margin-red: rgba(205, 64, 64, 0.5);
  --line: 1.75rem;
  --gutter: 1.5rem;

  /* Ink */
  --text: #2a2621;
  --text-muted: #675e51;
  --border: #d3c7b1;
  --pencil: #a99d88;
  --ink: #1f3d8c;
  --ink-hover: #162d6b;
  --ink-soft: #e6ecf8;
  --accent: var(--ink);
  --accent-hover: var(--ink-hover);
  --danger: #a3261d;
  --danger-soft: #fbe9e6;
  --highlight: rgba(255, 216, 46, 0.72);
  --note: #fff3a8;
  --note-edge: #f4e27e;

  /* Type */
  --hand-title: 'Kalam', 'Patrick Hand', 'Comic Sans MS', 'Segoe Print', cursive;
  --hand: 'Patrick Hand', 'Kalam', 'Comic Sans MS', 'Segoe Print', cursive;
  --sans: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* A wobbly, drawn-by-hand outline for buttons and labels. */
  --wobble: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-round: 52% 48% 50% 46% / 48% 52% 46% 50%;

  --shadow-paper: 0 1px 2px rgba(60, 45, 25, 0.08), 0 6px 18px rgba(60, 45, 25, 0.1);
}

* {
  box-sizing: border-box;
}

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

/* The page itself: blue rules every line, a double red margin on the left. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: calc(var(--gutter) + env(safe-area-inset-left));
  padding-right: env(safe-area-inset-right);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg,
      transparent calc(var(--gutter) - 0.5rem),
      var(--margin-red) calc(var(--gutter) - 0.5rem),
      var(--margin-red) calc(var(--gutter) - 0.5rem + 1.5px),
      transparent calc(var(--gutter) - 0.5rem + 1.5px),
      transparent calc(var(--gutter) - 0.3rem),
      var(--margin-red) calc(var(--gutter) - 0.3rem),
      var(--margin-red) calc(var(--gutter) - 0.3rem + 1px),
      transparent calc(var(--gutter) - 0.3rem + 1px)),
    repeating-linear-gradient(180deg,
      transparent 0,
      transparent calc(var(--line) - 1px),
      var(--rule) calc(var(--line) - 1px),
      var(--rule) var(--line));
  background-position: 0 0, 0 calc(1.75rem + 6px);
  -webkit-font-smoothing: antialiased;
}

/* Punched holes along the top edge of the page, the desk showing through them. */
body::before {
  content: '';
  display: block;
  height: 1.75rem;
  margin-left: calc(-1 * (var(--gutter) + env(safe-area-inset-left)));
  background:
    radial-gradient(circle at 50% 55%,
      var(--desk) 0 5.5px,
      rgba(90, 65, 30, 0.28) 6px,
      rgba(90, 65, 30, 0.08) 7px,
      transparent 7.5px) center top / 30px 100% repeat-x,
    var(--paper);
  border-bottom: 1px solid rgba(74, 128, 196, 0.28);
}

::selection {
  background: var(--highlight);
  color: var(--text);
}

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

header {
  padding: 0.6rem 1rem 0.9rem 0.75rem;
  text-align: center;
}

/* The title, written big and run over once with the highlighter. */
header h1 {
  display: inline-block;
  margin: 0;
  padding: 0 0.4rem;
  font-family: var(--hand-title);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--text);
  background: linear-gradient(176deg,
    transparent 52%,
    var(--highlight) 54%,
    var(--highlight) 86%,
    transparent 88%);
  border-radius: 0.3rem 0.8rem 0.4rem 0.9rem;
  transform: rotate(-1.2deg);
}

.subtitle {
  margin: 0.2rem 0 0;
  font-family: var(--hand);
  font-size: 1.2rem;
  line-height: var(--line);
  color: var(--text-muted);
}

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

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  font-family: var(--hand);
  font-size: 1.2rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 0.4rem;
}

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

.main-nav a.current {
  color: var(--text);
  background: linear-gradient(176deg, transparent 50%, var(--highlight) 52%, var(--highlight) 84%, transparent 86%);
}

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

/* Staff screens: each section is an index card laid on the notebook page. */
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  box-shadow: var(--shadow-paper);
}

.card h2 {
  margin-top: 0;
  font-family: var(--hand-title);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
}

/* The carta list is written straight onto the ruled page, not on a card. */
.card:has(> #carta-lines) {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

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

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

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

.field-row > label:has(.day-picker) {
  min-width: 0;
}

/* A staff title is longer than the carta's, so it is written a size smaller. */
header:has(.main-nav) h1 {
  font-size: 1.6rem;
}

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

input,
textarea {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--pencil);
  border-radius: 8px;
  background: #fffffd;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(31, 61, 140, 0.35);
  outline-offset: 0;
  border-color: var(--ink);
}

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

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

.field-help {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  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: 1.5px solid var(--note-edge);
  border-radius: 2px;
  background: var(--note);
  color: var(--text);
  font-family: var(--hand);
  font-size: 1.25rem;
  line-height: 1.4;
  white-space: pre-wrap;
  box-shadow: var(--shadow-paper);
  transform: rotate(-0.6deg);
}

.sides-section {
  margin-top: 1rem;
  border-top: 1.5px dashed var(--border);
  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(--hand);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--text);
}

#add-side,
#add-time {
  min-height: 44px;
  padding: 0.3rem 0.9rem;
  background: var(--card-bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--wobble);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.1rem;
  cursor: pointer;
}

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

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

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

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

/* The primary action: filled with blue ballpoint ink. */
button.primary {
  flex: 1;
  min-height: 48px;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink-hover);
}

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

button.primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

button.secondary {
  min-height: 48px;
  padding: 0.6rem 1.1rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1.5px solid var(--pencil);
  border-radius: var(--wobble);
  font-family: var(--hand);
  font-size: 1.2rem;
  cursor: pointer;
}

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

/* Beats any display a component sets for itself (the chip bar's flex, for one). */
.hidden {
  display: none !important;
}

.edit-item {
  min-height: 44px;
  padding: 0 0.4rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

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

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1.5px dashed var(--note-edge);
  border-radius: 4px;
  background: #fff9d6;
  color: var(--text);
  font-size: 0.9rem;
}

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

.dish-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  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 takes what is left; the price and the two actions drop under it on a narrow
   phone rather than squeezing it down to one word a line. */
.dish-item-header > :first-child {
  flex: 1 1 9rem;
  min-width: 0;
}

.dish-title {
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--text);
}

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

/* Prices in blue ballpoint. */
.dish-price {
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
}

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

.delete-dish:hover,
.edit-item:hover {
  background: var(--bg);
}

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

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

.daily-dishes {
  margin-top: 1rem;
}

/* The card is the wrapper, not the row: a button cannot hold a number field, so the box
   sits beside the row inside one border and reads as part of the same item. */
.daily-dish-holder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
}

.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 26px rgba(60, 45, 25, 0.28);
  border-radius: 8px;
  background: var(--card-bg);
}

/* The gap the dragged dish will drop into. */
.daily-drag-placeholder {
  border: 2px dashed var(--ink);
  border-radius: 8px;
  background: var(--ink-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: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* 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.9rem;
  cursor: pointer;
}

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

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

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

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

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

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

/* A chosen dish is ticked and run over with the highlighter. */
.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: #d8b93a;
  background: #fff6c8;
}

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

.daily-dish-mark {
  visibility: hidden;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.3rem;
  font-weight: 700;
}

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

button.primary:disabled {
  background: var(--border);
  border-color: 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 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 notebook page a
   dish is just written down, a pencil dash under it to keep it apart from the next. */
.carta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.dish-item.carta-line {
  padding: 0.75rem 0.1rem 0.8rem 0.25rem;
  border: none;
  border-bottom: 1.5px dashed rgba(169, 157, 136, 0.6);
  border-radius: 0;
  background: transparent;
}

#carta-lines {
  gap: 0;
}

.carta-line .dish-title {
  font-size: 1.4rem;
  line-height: 1.2;
}

.carta-line .dish-price {
  font-size: 1.4rem;
}

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

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

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

.order-line-remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
  border-top: 1.5px dashed var(--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 0.9rem;
  border: 1.5px solid var(--pencil);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}

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

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

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

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

.order-total span:last-child {
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--ink);
}

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

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

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

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

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

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

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

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

.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-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  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: #d8b93a;
  background: #fff6c8;
}

.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) {
  :root {
    --gutter: 3.5rem;
  }

  main {
    max-width: 1080px;
    padding-left: 1rem;
  }

  header h1 {
    font-size: 3rem;
  }

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

  /* On the carta the two columns read as one page, written edge to edge. */
  #carta-lines {
    column-gap: 2rem;
  }

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

  /* The carta on a wide screen: one notebook page lying on the desk. */
  body:has(#carta-lines) {
    max-width: 54rem;
    margin: 1.5rem auto;
    min-height: calc(100vh - 3rem);
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(60, 45, 25, 0.12), 0 18px 40px rgba(60, 45, 25, 0.18);
  }

  body:has(#carta-lines) main {
    padding-right: 2rem;
  }

  body:has(#carta-lines) .carta-categories {
    margin: 0 -2rem 0.25rem -1rem;
    padding-left: 1rem;
    padding-right: 2rem;
  }

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

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

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

.day-picker button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--pencil);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--hand);
  font-size: 1.05rem;
  cursor: pointer;
}

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

/* A family's name, written by hand and run over with the yellow highlighter. It spans the
   whole grid so the family below it starts on a fresh row instead of continuing mid-line. */
.line-group-heading {
  justify-self: start;
  align-self: start;
  width: fit-content;
  max-width: 100%;
  margin: 1.6rem 0 0.2rem -0.15rem;
  padding: 0 0.45rem;
  font-family: var(--hand-title);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  background: linear-gradient(177deg,
    transparent 46%,
    var(--highlight) 48%,
    var(--highlight) 88%,
    transparent 90%);
  border-radius: 0.25rem 0.9rem 0.35rem 0.7rem;
  transform: rotate(-0.8deg);
  transform-origin: left center;
}

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

/* On the staff screens the family is a quieter label: the list is a tool there. */
#daily-dishes .line-group-heading,
#dishes-list .line-group-heading {
  font-size: 1.35rem;
}

@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-family: var(--sans);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes kitchen-arrived {
  from {
    background: #fff0a0;
    border-color: var(--ink);
  }
  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;
  z-index: 2;
  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: 1.5px dashed var(--border);
  margin-bottom: 0.75rem;
}

/* The bar is a flex row, so its divider must take a row of its own. */
.form-actions::before {
  flex: 1 1 100%;
  margin-bottom: 0.25rem;
}

.form-actions {
  flex-wrap: wrap;
}

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

#summary-card .form-actions {
  position: static;
}

#summary-card .form-actions::before {
  content: none;
}

.daily-dish-stock {
  width: 4.2rem;
  height: 2.75rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.45rem;
  font-size: 1rem;
  text-align: right;
}

.order-line-left {
  position: absolute;
  left: 0.9rem;
  bottom: 0.1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.order-line-sold-out {
  background: var(--bg);
  cursor: not-allowed;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Circled in red pen. */
.allergen-tag {
  padding: 0.1rem 0.5rem;
  border: 1.5px solid var(--danger);
  border-radius: var(--wobble);
  color: var(--danger);
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.allergen-tag:nth-child(even) {
  transform: rotate(-1.5deg);
}

.allergen-tag:nth-child(odd) {
  transform: rotate(1deg);
}

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

.order-line {
  flex-wrap: wrap;
}

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

.allergen-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

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

.allergen-chip {
  min-height: 40px;
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

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

.allergen-chip-on {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 800;
}

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

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

.chime-button {
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--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(--ink);
  color: var(--ink);
}

/* Carta: the category bar, stuck to the top of the page while the list scrolls. The page
   still scrolls as a whole, so pull-to-refresh keeps working. Plain paper behind it so the
   dishes passing underneath do not read through; a pencil line marks where it ends. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0.25rem 0.55rem;
  margin: 0 -1rem 0.25rem -0.75rem;
  padding-left: 0.75rem;
  padding-right: 1rem;
  background: var(--paper);
  border-bottom: 1.5px solid rgba(74, 128, 196, 0.35);
  box-shadow: 0 6px 10px -8px rgba(60, 45, 25, 0.3);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

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

.carta-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.25rem 1rem;
  border: 1.5px solid var(--pencil);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--hand);
  font-size: 1.15rem;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
}

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

/* The family being read, run over with the highlighter. */
.carta-chip-on {
  border-color: var(--text);
  border-width: 2px;
  background: linear-gradient(176deg, #ffe466 0%, #ffd92e 100%);
  color: var(--text);
}

#tag-input {
  width: 100%;
}

.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: 36px;
  min-height: 44px;
  cursor: grab;
  touch-action: none;
  color: var(--pencil);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  user-select: none;
}

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

.daily-order-row.dragging {
  opacity: 0.6;
  border-color: var(--ink);
  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.35rem;
  flex: none;
}

/* Little circles drawn in ink. */
.order-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: var(--wobble-round);
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.order-stepper .order-add,
.order-stepper .order-plus {
  background: var(--ink);
  color: #fff;
}

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

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

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

.order-quantity {
  min-width: 1.4rem;
  text-align: center;
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
}

/* Leave room under the last line so the bar never covers it. */
body:has(.order-bar:not(.hidden)) main {
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
}

.order-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 1.25rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 252, 242, 0) 0, rgba(255, 252, 242, 0.92) 40%);
  pointer-events: none;
  animation: order-pop 0.22s ease-out;
}

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

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 54px;
  margin: 0 auto;
  padding: 0.7rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--ink);
  color: #fff;
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1.15;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink-hover), 0 8px 18px rgba(31, 61, 140, 0.28);
}

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

.order-bar-button:active,
.order-send:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink-hover), 0 4px 10px rgba(31, 61, 140, 0.25);
}

.order-bar-button:focus-visible,
.order-send:focus-visible {
  outline-offset: 3px;
}

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(52, 40, 22, 0.45);
  animation: order-fade 0.2s ease-out;
}

/* A sticky note torn off the pad: pale yellow, a darker band where the glue is, and a
   perforated top edge. */
.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: 1.4rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
  background-color: var(--note);
  background-image:
    linear-gradient(180deg, var(--note-edge) 0, var(--note-edge) 0.9rem, transparent 0.9rem),
    repeating-linear-gradient(180deg,
      transparent 0,
      transparent calc(var(--line) - 1px),
      rgba(74, 128, 196, 0.14) calc(var(--line) - 1px),
      rgba(74, 128, 196, 0.14) var(--line));
  background-attachment: local, local;
  background-position: 0 0, 0 1.2rem;
  -webkit-mask: radial-gradient(circle at 7px 0, transparent 4.5px, #000 5px) top left / 14px 100% repeat-x;
  mask: radial-gradient(circle at 7px 0, transparent 4.5px, #000 5px) top left / 14px 100% repeat-x;
  animation: order-sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 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(--hand-title);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.2;
}

.order-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: var(--wobble-round);
  background: none;
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
}

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

.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1.5px dashed rgba(120, 100, 40, 0.35);
}

.order-item-name {
  flex: 1;
  min-width: 0;
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.2;
}

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

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

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

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

.order-time {
  flex: 1 1 5rem;
  min-height: 50px;
  padding: 0.5rem;
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

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

.order-time-on,
.order-time-on:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

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

.order-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--danger);
  background: rgba(255, 255, 255, 0.6);
  color: var(--danger);
  font-weight: 700;
}

.order-hint {
  margin: 0.75rem 0 0;
  color: #5e5544;
  font-size: 0.85rem;
  text-align: center;
}

/* The order sent today from this browser, above the carta: an index card taped to the
   page. */
.order-summary {
  margin: 0.25rem 0 0;
  padding: 1.4rem 1.1rem 1.1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--margin-red);
  border-radius: 3px;
  background-color: var(--card-bg);
  background-image: repeating-linear-gradient(180deg,
    transparent 0,
    transparent calc(var(--line) - 1px),
    rgba(74, 128, 196, 0.13) calc(var(--line) - 1px),
    rgba(74, 128, 196, 0.13) var(--line));
  background-position: 0 0.6rem;
  box-shadow: var(--shadow-paper);
  transform: rotate(-0.5deg);
  animation: order-fade 0.25s ease-out;
}

/* The piece of tape holding it on. */
.order-summary::before {
  content: '';
  position: absolute;
  top: -0.8rem;
  left: 50%;
  width: 5.5rem;
  height: 1.5rem;
  margin-left: -2.75rem;
  background: rgba(236, 226, 196, 0.85);
  border-left: 1px dashed rgba(150, 130, 90, 0.35);
  border-right: 1px dashed rgba(150, 130, 90, 0.35);
  box-shadow: 0 1px 2px rgba(60, 45, 25, 0.12);
  transform: rotate(2deg);
}

.order-summary h2 {
  margin: 0 0 0.4rem;
  font-family: var(--hand-title);
  font-weight: 700;
  font-size: 1.55rem;
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0;
  font-family: var(--hand);
  font-size: 1.2rem;
  line-height: 1.3;
}

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

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

.order-summary-time {
  display: inline-block;
  margin: 0 0 0.9rem;
  padding: 0 0.3rem;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--text);
  background: linear-gradient(176deg, transparent 50%, var(--highlight) 52%, var(--highlight) 86%, transparent 88%);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 0.55rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.15;
  cursor: pointer;
}

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

.order-discard {
  max-width: 32rem;
  margin: 0.6rem auto 0;
  border: 1.5px solid rgba(90, 75, 40, 0.45);
  background: transparent;
  color: var(--text);
  font-size: 1.15rem;
}

.order-discard:hover {
  background: rgba(255, 255, 255, 0.5);
}

.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;
  text-decoration-color: var(--danger);
  text-decoration-thickness: 2px;
  color: var(--text-muted);
}

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

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

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

@keyframes order-pop {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

@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(--ink);
  }
}
