@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800;900&display=swap');

/* Micaela — "Suizo tipográfico".
   White paper, black type, one signal red. Structure comes from a strict left edge, rules
   (1–2px black lines) and whitespace; no rounded corners, no shadows, no textures.
   One stylesheet for the public carta and the staff screens. */

:root {
  --bg: #ffffff;
  --card-bg: #ffffff;
  --ink: #000000;
  --text: #000000;
  --text-muted: #555555;   /* 7.4:1 on white */
  --hairline: #cfcfcf;     /* separators between rows, never between sections */
  --border: #000000;
  --accent: #e30613;       /* the only colour: 4.8:1 on white, white on it 4.8:1 */
  --accent-hover: #b8040f;
  --accent-tint: #fdeced;
  --danger: #e30613;
  --font: 'Inter Tight', 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  --gutter: 1rem;
  --tap: 2.75rem;          /* 44px */
  --rule: 2px solid var(--ink);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01' on, 'cv11' on;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

/* Every control gets the same unmistakable focus ring: a red square outline. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

button {
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

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

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

/* The red block: the one ornament, a square of signal colour above the name. */
header::before {
  content: '';
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 1.25rem;
  background: var(--accent);
}

header h1 {
  margin: 0 0 0 -0.04em;
  font-size: clamp(4.25rem, 24vw, 9.5rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.065em;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 1rem 0 0;
  padding-top: 0.6rem;
  border-top: var(--rule);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Staff screens carry longer titles and a nav; the name stays big but not poster-size. */
header:has(.main-nav) h1 {
  font-size: clamp(2.25rem, 10vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.main-nav {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 4px solid transparent;
}

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

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

/* ------------------------------------------------------------------ Page grid */

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

/* A card is a section of the page, opened by a heavy rule rather than boxed in. */
.card {
  background: var(--card-bg);
  border: 0;
  border-top: var(--rule);
  border-radius: 0;
  padding: 1.25rem 0 0;
  min-width: 0;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  flex: 2;
}

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

input,
textarea {
  min-height: var(--tap);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

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

input:focus,
textarea:focus {
  outline: 3px solid var(--accent);
  outline-offset: 0;
}

input::placeholder,
textarea::placeholder {
  color: #767676;
}

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

.field-help {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* A day with no service reads as such from across the room. */
.day-closed {
  border-top-color: var(--danger);
}

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

.notice {
  margin: 0;
  padding: 1rem 0 1rem 1rem;
  border: 0;
  border-left: 6px solid var(--accent);
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
}

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

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

.sides-header h3 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

#add-side,
#add-time {
  min-height: var(--tap);
  background: #fff;
  border: 2px solid var(--ink);
  color: var(--ink);
  border-radius: 0;
  padding: 0 0.9rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
}

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

.side-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--hairline);
  align-items: center;
}

/* A flex item will not shrink below the width its content wants unless it is told to. */
.side-row input {
  flex: 2;
  min-width: 0;
}

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

@media (max-width: 719px) {
  .side-row .side-description {
    flex: 1 1 100%;
  }
}

.remove-side {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  background: none;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
}

.remove-side:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

button.primary {
  flex: 1;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
}

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

button.secondary {
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button.secondary:hover {
  background: var(--ink);
  color: #fff;
}

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

/* Anything toggled off by script stays off, whatever display the element normally has. */
.hidden {
  display: none !important;
}

.edit-item,
.delete-dish {
  min-height: var(--tap);
  padding: 0 0.5rem;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.edit-item:hover {
  color: var(--accent);
}

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

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

.menu-hint {
  margin: 1rem 0 0;
  padding: 0.6rem 0 0.6rem 0.9rem;
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: 0.875rem;
}

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

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

.dish-item {
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.75rem 0.9rem;
  min-width: 0;
}

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

.dish-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.dish-price {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

.side-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}

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

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

/* The card is the wrapper, not the row: the stock box sits beside the row in one border. */
.daily-dish-holder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  background: var(--card-bg);
  border-color: var(--hairline);
}

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

/* 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: a heavy frame instead of a shadow. */
.daily-dish-group.dragging {
  outline: 2px solid var(--ink);
  background: var(--card-bg);
}

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

.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.75rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

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

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

.daily-dish-holder:active {
  background: #f2f2f2;
}

/* Chosen for today: black frame and a red bar down the left edge. */
.daily-dish-holder:has(.daily-dish-chosen) {
  border-color: var(--ink);
  background: #fff;
  box-shadow: inset 6px 0 0 var(--accent);
  padding-left: 1.25rem;
}

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

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

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

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

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

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

.order-line:active {
  background: #f2f2f2;
}

.order-line-amount {
  min-width: 1.6rem;
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.order-line-remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 0;
  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 solid var(--ink);
  padding-top: 0.9rem;
}

.time-options-label {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.time-option {
  min-height: var(--tap);
  padding: 0 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.time-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

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

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

/* ------------------------------------------------------------------ Legacy boards
   (kitchen / counter are gone from the app, but their selectors stay styled.) */

.kitchen-status,
.kitchen-chip {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kitchen-status-live {
  color: #fff;
  background: 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.25rem;
}

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

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

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

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

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

.kitchen-line:active,
.counter-line:active {
  background: #f2f2f2;
}

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

.kitchen-count,
.counter-count {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kitchen-line-done {
  border-color: var(--ink);
  box-shadow: inset 6px 0 0 var(--accent);
}

.kitchen-line-done .kitchen-count {
  font-size: 1.4rem;
  color: var(--accent);
}

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

.kitchen-undo {
  top: -0.55rem;
}

.counter-add {
  bottom: -0.55rem;
  background: var(--accent);
}

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

@keyframes kitchen-arrived {
  from {
    background: var(--accent-tint);
    border-color: var(--accent);
  }
  to {
    background: var(--card-bg);
    border-color: var(--ink);
  }
}

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

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

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

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

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

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

/* ------------------------------------------------------------------ Staff day picker */

.day-picker {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.day-picker input {
  flex: 1;
  min-width: 0;
  border-left: 0;
  border-right: 0;
  border-width: 2px;
}

.day-picker button {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.day-picker .day-today {
  margin-left: 0.5rem;
  background: var(--ink);
  color: #fff;
}

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

/* ------------------------------------------------------------------ Family headings
   "01 Guisos": the number in red, tabular, then the name; a heavy rule above. */

.line-group-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 2.25rem 0 0;
  padding: 0.55rem 0 0.6rem;
  border-top: 3px solid var(--ink);
  border-bottom: 0;
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.035em;
}

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

.dishes-list {
  counter-reset: family;
}

.dishes-list > .line-group-heading {
  counter-increment: family;
}

#carta-lines > .line-group-heading::before {
  content: counter(family, decimal-leading-zero);
  flex: none;
  min-width: 1.6em;
  color: var(--accent);
  font-size: 0.75em;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 720px) {
  .line-group-heading {
    grid-column: 1 / -1;
  }
}

/* A dish with no price is a group; the list says so where the price would be. */
.dish-group-tag {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------ Sticky action bars
   (staff). Sticky rather than fixed: it keeps its place in the flow and never covers the
   last row. */

.form-actions,
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

.sticky-actions {
  padding-top: 0.1rem;
}

.sticky-actions .form-actions {
  position: static;
  padding-bottom: 0;
}

.form-actions::before,
.sticky-actions::before {
  content: '';
  display: block;
  border-top: var(--rule);
  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;
}

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

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

.daily-dish-stock {
  width: 4rem;
  height: 2.25rem;
  min-height: 0;
  flex: none;
  padding: 0.25rem 0.4rem;
  font-size: 0.9375rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.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 {
  cursor: not-allowed;
}

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

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

/* ------------------------------------------------------------------ Allergens & ingredients
   Always visible under the name — nobody with an allergy should have to ask. */

.order-line-details {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
  margin-top: 0.1rem;
  min-width: 0;
}

.allergen-tag {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.order-line-ingredients {
  flex: 1 1 100%;
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Gestión: the allergen multiselect. A chip has the shape of the tag it becomes. */
.allergen-field {
  margin-top: 1rem;
}

.allergen-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

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

.allergen-chip {
  min-height: 2.5rem;
  padding: 0 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

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

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

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

#dish-form > label {
  margin-top: 1rem;
}

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

#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: 2rem;
  min-height: var(--tap);
  cursor: grab;
  touch-action: none;
  color: var(--ink);
  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;
}

/* ================================================================== Carta */

/* The category bar: plain text tabs on a white strip, stuck to the top, ruled below.
   It runs edge to edge of the column; the active family is a red block. */
.carta-categories {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  background: var(--bg);
  border-top: var(--rule);
  border-bottom: var(--rule);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carta-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  margin: 0;
  padding: 0 0.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s linear, color 0.15s linear;
}

.carta-chip:first-child {
  margin-left: -0.85rem;
}

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

.carta-chip-on,
.carta-chip-on:hover {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.carta-chip:focus-visible {
  outline-offset: -3px;
  outline-color: var(--ink);
}

/* The carta's sections are not boxed: the dishes sit straight on the page grid. */
main:has(#carta-lines) .card {
  border-top: 0;
  padding-top: 0;
}

#carta-lines {
  gap: 0;
  padding-top: 0.5rem;
}

/* A dish row: name on the left, price flush right in tabular figures, and the stepper
   under the price; allergens and ingredients under the name. Rows are split by hairlines,
   families by heavy rules. */
.dish-item.carta-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  row-gap: 0.45rem;
  align-items: start;
  padding: 1rem 0 1.05rem;
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
}

.line-group-heading + .dish-item.carta-line {
  border-top: 0;
  padding-top: 0.5rem;
}

.carta-line .order-line-title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  font-size: 1.125rem;
  line-height: 1.25;
}

.carta-line .dish-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.carta-line .dish-extra {
  font-size: 0.875rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.carta-line .dish-price {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  padding-top: 0.05rem;
}

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

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

/* Rows with no allergens or ingredients: the stepper still sits under the price. */

/* Stepper: square, black-outlined; "add" is a solid black square. */
.order-stepper {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}

.order-stepper button {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.12s linear, color 0.12s linear, border-color 0.12s linear;
}

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

.order-stepper button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.order-stepper button:active {
  transform: translateY(1px);
}

.order-quantity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 1.0625rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

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

/* The fixed bottom bar: a white strip with a heavy rule and one black slab. */
.order-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.75rem max(var(--gutter), env(safe-area-inset-right))
    calc(0.75rem + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  border-top: var(--rule);
  animation: micaela-rise 0.28s var(--ease) both;
}

.order-bar-button,
.order-send {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 640px;
  min-height: 3.5rem;
  margin: 0 auto;
  padding: 0 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-align: left;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s linear, border-color 0.15s linear;
}

/* A square arrow at the right end marks the slab as "go". */
.order-bar-button::after,
.order-send::after {
  content: '→';
  margin-left: 1rem;
  font-weight: 500;
  font-size: 1.25rem;
}

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

/* Sending is the one decisive act: the slab turns signal red. */
.order-send {
  background: var(--accent);
  border-color: var(--accent);
}

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

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

.order-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  animation: micaela-fade 0.2s linear both;
}

/* The sheet: white, flush, opened by a heavy black rule. */
.order-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 640px;
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
  border-top: 8px solid var(--ink);
  border-radius: 0;
  background: var(--card-bg);
  animation: micaela-sheet 0.32s var(--ease) both;
}

.order-sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0.9rem var(--gutter) 0.75rem;
  background: var(--card-bg);
  border-bottom: var(--rule);
}

.order-sheet-head h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  word-spacing: 0.05em;
}

.order-close {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin-right: -0.5rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

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

.order-items {
  margin-top: 0.25rem;
}

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

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

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

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0;
  padding: 0.85rem 0 1.25rem;
  border-top: var(--rule);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.order-item:last-child {
  border-bottom: 0;
}

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

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

.order-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.order-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
  gap: 0;
  margin-bottom: 1.25rem;
  border-left: 2px solid var(--ink);
}

.order-time {
  min-height: 3.25rem;
  padding: 0 0.5rem;
  margin: 0;
  border: 2px solid var(--ink);
  border-left: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s linear, color 0.12s linear;
}

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

.order-time-on,
.order-time-on:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 0 transparent;
}

.order-time:focus-visible {
  outline-offset: -5px;
  outline-color: var(--ink);
}

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

.order-hint {
  max-width: 640px;
  margin: 0.75rem auto 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: left;
}

/* "Tu pedido de hoy": a framed block above the carta, red bar on top. */
.order-summary,
main:has(#carta-lines) .order-summary {
  margin: 0;
  padding: 1rem 1rem 1.1rem;
  border: 2px solid var(--ink);
  border-top: 8px solid var(--accent);
  background: #fff;
}

.order-summary h2 {
  margin: 0 0 0.6rem;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  word-spacing: 0.05em;
}

.order-summary-lines {
  border-top: 1px solid var(--ink);
}

.order-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}

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

.order-summary .order-total {
  margin-top: 0;
  padding: 0.6rem 0 0.75rem;
  border-top: 0;
  font-size: 1.125rem;
}

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

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

.order-summary-time {
  margin: 0 0 0.9rem;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.order-summary-edit,
.order-discard {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s linear, color 0.15s linear;
}

.order-summary-edit:hover,
.order-discard:hover {
  background: var(--ink);
  color: #fff;
}

.order-discard {
  max-width: 640px;
  margin: 0.5rem auto 0;
  border-color: var(--ink);
  border-width: 1px;
  color: var(--ink);
  font-weight: 500;
}

.order-cancel-note {
  margin: 1rem 0 0.5rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--danger);
  color: var(--ink);
  font-weight: 600;
}

.order-items-cancelled {
  margin-bottom: 1.25rem;
  border-bottom: var(--rule);
}

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

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

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

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

@keyframes micaela-fade {
  from {
    opacity: 0;
  }
  to {
    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);
  }
}

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

@media (min-width: 720px) {
  :root {
    --gutter: 2rem;
  }

  header,
  main {
    max-width: calc(1080px + 2 * var(--gutter));
  }

  header {
    padding-top: 3rem;
    padding-bottom: 2rem;
  }

  header h1 {
    font-size: clamp(6rem, 13vw, 11rem);
  }

  header:has(.main-nav) h1 {
    font-size: clamp(3rem, 6vw, 5rem);
  }

  .subtitle {
    font-size: 0.875rem;
  }

  .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 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: a strict three-column grid, generous gutters. */
  #carta-lines {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    column-gap: 2.5rem;
  }

  #carta-lines > .dish-item.carta-line {
    border-top: 1px solid var(--hairline);
    padding-top: 1rem;
  }

  .line-group-heading {
    margin-top: 3rem;
    font-size: 2rem;
  }

  #order-summary {
    max-width: 40rem;
  }
}
