/* "Bolsa kraft para llevar": the food leaves in a paper bag, so the page is one. Kraft-brown
   paper underneath, off-white labels stuck on top, rubber stamps in a single red ink for the
   names, round stickers for the prices and a till receipt for the order. */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Special+Elite&display=swap');

:root {
  /* The bag. Text straight on it uses the darkest browns only: kraft is a mid tone. */
  --kraft: #c9a77c;
  --kraft-deep: #a8845a;
  --kraft-ink: #2e2014;
  --kraft-texture:
    repeating-linear-gradient(83deg, rgba(92, 62, 30, 0.07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(174deg, rgba(255, 244, 220, 0.08) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(29deg, rgba(80, 50, 20, 0.05) 0 2px, transparent 2px 13px),
    repeating-linear-gradient(121deg, rgba(255, 240, 210, 0.05) 0 1px, transparent 1px 17px);

  /* The labels stuck on it. */
  --bg: #e9dcc3;
  --card-bg: #fbf6ea;
  --receipt: #fffdf6;
  --border: #d6c5a4;
  --rule: #b9a27c;
  --text: #2b2118;
  --text-muted: #5f4b36;

  /* One ink for every stamp, and the solid colour of the main action. */
  --ink: #8f2216;
  --accent: #8f2216;
  --accent-hover: #721a10;
  --accent-wash: #f6e4dc;
  --danger: #a01f1f;
  --sticker: #f2c14e;
  --sticker-edge: #d9a12a;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Courier Prime", "Courier New", Courier, ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-stamp: "Special Elite", "Courier Prime", "Courier New", Courier, monospace;

  /* Worn rubber: a sprinkle of pinholes where the ink did not take. */
  --worn:
    radial-gradient(circle at 30% 40%, transparent 0 0.6px, #000 1.1px) 0 0 / 7px 6px,
    radial-gradient(circle at 70% 60%, transparent 0 0.5px, #000 1px) 0 0 / 5px 9px;

  --tap: 44px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.4;
  color: var(--text);
  background-color: var(--kraft);
  background-image:
    var(--kraft-texture),
    radial-gradient(ellipse at 15% 0%, rgba(255, 240, 210, 0.3), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(90, 60, 30, 0.18), transparent 55%);
}

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

header {
  padding: calc(1.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem
    max(1rem, env(safe-area-inset-left));
  text-align: center;
}

/* The rubber stamp on the bag. */
header h1 {
  display: inline-block;
  max-width: 100%;
  margin: 0.25rem 0 0;
  padding: 0.3rem 0.9rem 0.15rem;
  border: 3px solid var(--ink);
  border-radius: 6px;
  outline: 1.5px solid var(--ink);
  outline-offset: -8px;
  font-family: var(--font-stamp);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  transform: rotate(-2deg);
  -webkit-mask: var(--worn);
  -webkit-mask-composite: source-in;
  mask: var(--worn);
  mask-composite: intersect;
}

/* The carta's stamp is the shop's name, so it is the biggest thing on the bag, with the
   line a takeaway bag carries printed above it. */
body:has(#carta-lines) header h1 {
  padding: 0.45rem 1.4rem 0.25rem;
  font-size: 2.6rem;
  letter-spacing: 0.1em;
  outline-offset: -9px;
}

body:has(#carta-lines) header::before {
  content: 'Cocina casera · para llevar';
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--kraft-ink);
}

.subtitle {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--kraft-ink);
}

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

/* Little paper tags. Text on kraft would be too low in contrast at this size. */
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.9rem;
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(46, 32, 20, 0.3);
}

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

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

/* An off-white label stuck to the bag with a strip of tape. */
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid rgba(120, 90, 50, 0.25);
  border-radius: 3px;
  padding: 1.5rem 1rem 1.25rem;
  box-shadow:
    0 1px 1px rgba(46, 32, 20, 0.18),
    0 6px 14px -6px rgba(46, 32, 20, 0.45);
}

.card::before {
  content: '';
  position: absolute;
  top: -0.7rem;
  left: 50%;
  width: 6rem;
  height: 1.5rem;
  margin-left: -3rem;
  background: rgba(250, 244, 228, 0.6);
  border-left: 1px dashed rgba(120, 90, 50, 0.2);
  border-right: 1px dashed rgba(120, 90, 50, 0.2);
  box-shadow: 0 1px 2px rgba(46, 32, 20, 0.15);
  transform: rotate(-2deg);
  pointer-events: none;
}

.card h2 {
  margin-top: 0;
  font-family: var(--font-stamp);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

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

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

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

input {
  min-height: var(--tap);
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--receipt);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

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

textarea {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--receipt);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
}

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

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

.field-help {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  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;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

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

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

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

#add-side,
#add-time {
  min-height: var(--tap);
  background: none;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
  align-items: center;
}

/* A flex item will not shrink below the width its content wants unless it is told to,
   which is what pushed this row — and the card around it — off the side of a phone. */
.side-row input {
  flex: 2;
  min-width: 0;
}

.side-row .field-small {
  flex: 1;
  min-width: 0;
}

/* On a phone the description takes the whole width and the unit, the price and the
   remove button share the line below it. 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: var(--tap);
  min-height: var(--tap);
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem;
}

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

button.primary {
  flex: 1;
  min-height: 48px;
  padding: 0.65rem;
  background: var(--accent);
  color: var(--card-bg);
  border: none;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

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

button.secondary {
  min-height: 48px;
  padding: 0.65rem 1rem;
  background: none;
  color: var(--text);
  border: 1.5px solid var(--rule);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

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

/* Hidden means hidden, whatever display a component's own rule gives it. */
.hidden {
  display: none !important;
}

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

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

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--accent);
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--text);
  font-size: 0.85rem;
}

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

.dish-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 0.9rem;
  background: var(--receipt);
}

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

/* The name keeps a readable width; when price and buttons do not fit beside it, they drop
   to their own line 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 {
  flex: none;
  margin-left: auto;
}

.dish-title {
  font-family: var(--font-mono);
  font-weight: 700;
}

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

.dish-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.delete-dish {
  min-height: var(--tap);
  padding: 0 0.5rem;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

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

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

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

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

.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: var(--tap);
  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 8px 24px rgba(44, 38, 32, 0.25);
  border-radius: 6px;
  background: var(--card-bg);
}

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

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

/* 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: var(--font-mono);
  font-size: 0.85rem;
  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(--rule);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.kitchen-status-down {
  color: var(--danger);
  border-color: var(--danger);
}

.kitchen-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kitchen-group-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

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

.kitchen-chip {
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  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-size: 1.25rem;
  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-wash);
}

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

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

.kitchen-undo.hidden {
  display: none !important;
}

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

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

  .card {
    padding: 1.75rem 1.5rem 1.5rem;
  }
}

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

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

.day-picker button {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--receipt);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

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

/* A family's name, rubber-stamped onto the label above its dishes: a framed word in the
   one red ink, a touch crooked, as a stamp by hand comes out. It spans the whole grid so
   the family below starts on a fresh row. */
.line-group-heading {
  width: fit-content;
  max-width: 100%;
  margin: 1.75rem 0 0.35rem 0.15rem;
  padding: 0.3rem 0.8rem 0.15rem;
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-stamp);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(-1.5deg);
  -webkit-mask: var(--worn);
  -webkit-mask-composite: source-in;
  mask: var(--worn);
  mask-composite: intersect;
}

.line-group-heading:nth-of-type(even) {
  transform: rotate(1deg);
}

.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-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@keyframes kitchen-arrived {
  from {
    background: #f3d4c8;
    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. */
.form-actions,
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  padding-bottom: max(0.25rem, 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 dashed var(--rule);
  margin-bottom: 0.75rem;
}

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

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

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

/* Small and fixed: stretched to the row's height it dwarfed everything next to a name
   that wrapped over four lines. */
.daily-dish-stock {
  width: 4rem;
  height: 2rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.4rem;
  font-size: 0.9rem;
  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: 700;
  color: var(--accent);
  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: 600;
}

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

/* Allergens and ingredients under the name, always there: 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.35rem;
  min-width: 0;
}

/* Each allergen is a little stamp in the same red ink, each one landing a bit crooked. */
.allergen-tag {
  display: inline-block;
  padding: 0.1rem 0.35rem 0.05rem;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: rotate(-2deg);
}

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

.allergen-tag:nth-child(3n) {
  transform: rotate(-0.5deg);
}

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

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

/* The multiselect in Gestión: a chip has the shape of the stamp it becomes on the carta. */
.allergen-field {
  margin-top: 1rem;
}

.allergen-label {
  display: block;
  font-size: 0.85rem;
  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.6rem;
  border: 1.5px solid var(--rule);
  border-radius: 3px;
  background: var(--receipt);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.allergen-chip-on {
  border-color: var(--ink);
  background: var(--accent-wash);
  color: var(--ink);
  font-weight: 700;
}

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

/* Carta: the category bar, stuck to the top so the families stay reachable however far
   down the dishes you are. It runs edge to edge over the bag, and each family is a paper
   tag with its string hole. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin: 0 calc(-1 * max(1rem, env(safe-area-inset-left))) 0.25rem;
  padding: 0.6rem max(1rem, env(safe-area-inset-left));
  background-color: var(--kraft);
  background-image: var(--kraft-texture);
  border-bottom: 1px solid rgba(46, 32, 20, 0.25);
  box-shadow: 0 6px 8px -6px rgba(46, 32, 20, 0.45);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carta-chip {
  position: relative;
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 0.35rem 0.9rem 0.3rem 1.55rem;
  border: 1px solid rgba(120, 90, 50, 0.35);
  border-radius: 3px 8px 8px 3px;
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(46, 32, 20, 0.3);
  transition: background-color 0.15s, color 0.15s;
}

/* The punched hole, showing the bag through it. */
.carta-chip::before {
  content: '';
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.225rem;
  border-radius: 50%;
  background: var(--kraft-deep);
  box-shadow: inset 0 1px 1px rgba(46, 32, 20, 0.5);
}

.carta-chip-on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card-bg);
}

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

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

/* The carta's list: one long label with the dishes typed on it, a dashed rule between
   them. The name leads, the price sticker sits at its right, allergens and ingredients
   underneath, and the stepper below the sticker where the thumb is. */
#carta-lines {
  gap: 0;
}

.carta-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'title price'
    'details stepper';
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.95rem 0.1rem;
  border: none;
  border-bottom: 1px dashed var(--rule);
  border-radius: 0;
  background: none;
}

.carta-line:last-child {
  border-bottom: none;
}

/* With nothing under the name and nothing ordered yet, the single + sits beside the
   sticker on one line instead of leaving an empty row under the name. */
.carta-line:not(:has(.order-line-details)):not(:has(.order-minus)) {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'title stepper price';
}

.carta-line .order-line-title {
  grid-area: title;
  line-height: 1.25;
}

.carta-line .dish-title {
  font-size: 1.08rem;
  color: var(--text);
}

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

.carta-line .order-line-details {
  grid-area: details;
  align-self: start;
  margin-top: 0;
}

.carta-line .order-stepper {
  grid-area: stepper;
  justify-self: end;
  align-self: end;
}

.carta-line:not(:has(.order-line-details)):not(:has(.order-minus)) .order-stepper {
  align-self: center;
}

/* The price is a round sticker slapped on, each at its own angle. */
.carta-line .dish-price {
  grid-area: price;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 3.7rem;
  height: 3.7rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 250, 225, 0.55), transparent 45%),
    var(--sticker);
  color: var(--text);
  font-size: 0.86rem;
  letter-spacing: -0.02em;
  box-shadow:
    inset 0 0 0 3px var(--sticker),
    inset 0 0 0 4px rgba(46, 32, 20, 0.35),
    0 1px 2px rgba(46, 32, 20, 0.35);
  transform: rotate(-8deg);
}

.carta-line:nth-child(3n) .dish-price {
  transform: rotate(6deg);
}

.carta-line:nth-child(3n + 1) .dish-price {
  transform: rotate(-3deg);
}

/* Steppers: big enough for a thumb. Adding is the solid ink, taking one off is outlined. */
.order-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.order-stepper button {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.15s;
}

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

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

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

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

.order-quantity {
  min-width: 1.6rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

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

/* The bar sits on a strip of kraft fading up into the page, so it never floats over text
   it could be mistaken for. */
.order-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) calc(0.85rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--kraft) 55%, rgba(201, 167, 124, 0));
  animation: bar-in 0.25s ease-out;
}

.order-bar-button,
.order-send {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 3.25rem;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--ink);
  color: var(--card-bg);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  outline: 1.5px dashed rgba(251, 246, 234, 0.55);
  outline-offset: -6px;
  box-shadow: 0 6px 14px -4px rgba(46, 32, 20, 0.55);
}

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

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

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(35, 22, 10, 0.55);
  animation: fade-in 0.2s ease-out;
}

/* The order is a till receipt torn off the roll: typewriter lines, a zigzag top edge and
   dashed rules, rising from the bottom of the screen. */
.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 30rem;
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.6rem max(1.15rem, env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom))
    max(1.15rem, env(safe-area-inset-left));
  border-radius: 0;
  background-color: var(--receipt);
  color: var(--text);
  font-family: var(--font-mono);
  -webkit-mask:
    conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) top / 14px 8px repeat-x,
    linear-gradient(#000 0 0) 0 8px / 100% calc(100% - 8px) no-repeat;
  mask:
    conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) top / 14px 8px repeat-x,
    linear-gradient(#000 0 0) 0 8px / 100% calc(100% - 8px) no-repeat;
  animation: 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;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--rule);
}

.order-sheet-head h2 {
  margin: 0;
  font-family: var(--font-stamp);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.order-close {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin-right: -0.4rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

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

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

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

.order-item-name small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* The receipt's total line, under a double rule. */
.order-total {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-sheet .order-total {
  margin-top: 0.4rem;
  border-top: 3px double var(--text);
}

.order-field-label {
  display: block;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

/* Pickup times as ticket stubs. */
.order-time {
  flex: 1;
  min-height: 3rem;
  padding: 0.6rem;
  border: 2px dashed var(--rule);
  border-radius: 4px;
  background: var(--receipt);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

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

.order-time-on {
  border-style: solid;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card-bg);
}

.order-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.7rem;
  border-left: 4px solid var(--danger);
  background: #fbe7e2;
  color: var(--danger);
  font-weight: 700;
}

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

.order-sheet .order-hint::after {
  content: '* * *  gracias  * * *';
  display: block;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--rule);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: pre;
}

/* Today's order: the ticket stapled to the bag, cut with a zigzag at the bottom. */
.order-summary {
  margin: 0.25rem 0 0;
  padding: 1.9rem 1.15rem 1.9rem;
  border: none;
  border-radius: 0;
  background-color: var(--receipt);
  font-family: var(--font-mono);
  transform: rotate(-0.6deg);
  -webkit-mask:
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom / 14px 8px repeat-x,
    linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 8px) no-repeat;
  mask:
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom / 14px 8px repeat-x,
    linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 8px) no-repeat;
}

/* The staple. */
.order-summary::before {
  top: 0.55rem;
  width: 2.6rem;
  height: 0.4rem;
  margin-left: -1.3rem;
  border: none;
  border-radius: 2px;
  background: linear-gradient(180deg, #e4e4e4, #9a9a9a 60%, #7a7a7a);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  transform: rotate(-3deg);
}

.order-summary h2 {
  margin: 0 0 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--rule);
  font-family: var(--font-stamp);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
}

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

.order-summary-line span:last-child {
  white-space: nowrap;
}

.order-summary .order-total {
  border-top: 3px double var(--text);
  margin-top: 0.4rem;
}

/* The pickup time is the part to remember: stamped. */
.order-summary-time {
  width: fit-content;
  margin: 0.2rem auto 1rem;
  padding: 0.25rem 0.7rem 0.15rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-stamp);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  transform: rotate(-2deg);
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

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

.order-discard {
  max-width: 32rem;
  min-height: var(--tap);
  margin: 0.6rem auto 0;
  border: 1.5px solid var(--rule);
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

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

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

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

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

@media (min-width: 720px) {
  #carta-lines {
    column-gap: 2.5rem;
  }

  .carta-line:last-child {
    border-bottom: 1px dashed var(--rule);
  }

  .order-summary {
    align-self: center;
    width: 100%;
    max-width: 28rem;
  }

  body:has(#carta-lines) header h1 {
    font-size: 3.2rem;
  }

  .order-sheet {
    bottom: 1.5rem;
    max-height: calc(100vh - 3rem);
    -webkit-mask:
      conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) top / 14px 8px repeat-x,
      linear-gradient(#000 0 0) 0 8px / 100% calc(100% - 16px) no-repeat,
      conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom / 14px 8px repeat-x;
    mask:
      conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) top / 14px 8px repeat-x,
      linear-gradient(#000 0 0) 0 8px / 100% calc(100% - 16px) no-repeat,
      conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom / 14px 8px repeat-x;
    padding-bottom: 1.75rem;
  }
}

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

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

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

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