/* Restaurant app (js/features/restaurant/*): the floor, the till, the payment, the kitchen screen, the 80 mm
   paper. Colours, spacing and type come from tokens.css so light and dark mode both work. */
.rest-toolbar { flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.rest-toolbar .spacer { flex: 1; }
.rest-shift { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.rest-full { grid-column: 1 / -1; }
.rest-kv { display: flex; justify-content: space-between; gap: var(--space-3); }

/* chips: floors, categories, stations, payment methods */
.rest-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block: var(--space-2); }
.rest-chip { min-height: var(--touch-target); padding-inline: var(--space-4); border-radius: var(--radius-pill);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-weight: var(--weight-medium); }
.rest-chip[aria-selected="true"], .rest-chip[aria-checked="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-on-primary); }

/* the floor */
.rest-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--space-3); margin-block: var(--space-3); }
.rest-table { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  min-height: 112px; padding: var(--space-3); border-radius: var(--radius-lg); border: 2px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-raised); cursor: pointer; }
.rest-table:hover:not(:disabled) { background: var(--color-surface-hover); }
.rest-table:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rest-table:disabled { cursor: default; opacity: 0.7; }
.rest-table.shape-round { border-radius: var(--radius-pill); aspect-ratio: 1; min-height: 0; }
.rest-table.shape-long { grid-column: span 2; }
.rest-table.st-busy { border-color: var(--color-primary); background: var(--color-primary-subtle); }
.rest-table.st-ready { border-color: var(--color-success); background: var(--color-success-subtle); }
.rest-table-name { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.rest-table-amount { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.rest-table-seats, .rest-table-meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.rest-others { margin-top: var(--space-4); }
.rest-others-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2); }
.rest-other { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-2); align-items: center; min-height: var(--touch-target);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text); text-align: start; }

/* the till: the menu on one side, the order on the other */
.rest-pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: var(--space-3); align-items: start; }
.rest-menu-top { display: flex; gap: var(--space-2); }
.rest-search { flex: 1; min-height: var(--touch-target); }
.rest-menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: var(--space-2); }
.rest-item { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-1); padding: var(--space-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text);
  text-align: start; cursor: pointer; min-height: 132px; }
.rest-item:hover:not(:disabled) { background: var(--color-surface-hover); border-color: var(--color-primary); }
.rest-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rest-item img, .rest-item-ph { inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-md); }
.rest-item-ph { display: flex; align-items: center; justify-content: center; background: var(--color-primary-subtle);
  color: var(--color-primary-text); font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.rest-item-name { font-weight: var(--weight-semibold); line-height: 1.25; overflow-wrap: anywhere; }
.rest-item-price { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

.rest-ticket { position: sticky; top: var(--space-3); display: flex; flex-direction: column; max-height: calc(100vh - 160px); }
.rest-ticket-head { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.rest-lines { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.rest-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2); align-items: center;
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.rest-line-main { display: flex; flex-direction: column; min-width: 0; }
.rest-line-name { font-weight: var(--weight-medium); }
.rest-sent { color: var(--color-success-strong); }
.rest-qty { display: inline-flex; align-items: center; gap: var(--space-1); }
.rest-qty .icon-btn { min-width: var(--touch-target); min-height: var(--touch-target); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.rest-qty .num { min-width: 2ch; text-align: center; }
.rest-line-total { min-width: 7ch; text-align: end; font-variant-numeric: tabular-nums; }
.rest-empty { padding: var(--space-4) var(--space-3); }
.rest-totals { padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.rest-grand { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.rest-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--color-border); }
.rest-actions button { min-height: var(--touch-target); }
.rest-actions .rest-pay { grid-column: 1 / -1; font-size: var(--text-lg); min-height: var(--control-height-lg); }
.rest-mods { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.rest-mod { min-height: var(--touch-target); display: inline-flex; align-items: center; }
.rest-split { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }

/* payment */
.rest-pay-box { display: flex; flex-direction: column; gap: var(--space-3); }
.rest-pay-due { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-lg); }
.rest-pay-due strong { font-size: var(--text-2xl); font-variant-numeric: tabular-nums; }
.rest-pay-add { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.rest-quick { display: flex; gap: var(--space-2); }
.rest-quick button, .rest-pay-add > button { min-height: var(--field-height); }
.rest-pay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.rest-pay-list li { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-2); align-items: center;
  padding: var(--space-1) var(--space-2); background: var(--color-surface-inset); border-radius: var(--radius-md); }

/* kitchen screen */
.rest-kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); align-items: start; }
.rest-kds-ticket { display: flex; flex-direction: column; border-top: 6px solid var(--color-info); }
.rest-kds-ticket.late { border-top-color: var(--color-warning); }
.rest-kds-ticket.st-ready { border-top-color: var(--color-success); background: var(--color-success-subtle); }
.rest-kds-ticket header { display: flex; flex-direction: column; padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.rest-kds-ticket ul { list-style: none; margin: 0; padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-lg); }
.rest-kds-ticket li.void { color: var(--color-danger-strong); text-decoration: line-through; }
.rest-kds-qty { display: inline-block; min-width: 2.2ch; font-weight: var(--weight-bold); }
.rest-kds-note { color: var(--color-warning-strong); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.rest-kds-ticket footer { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-3); border-top: 1px solid var(--color-border); }
.rest-kds-ticket footer .primary, .rest-kds-ticket footer button:first-child { flex: 1; min-height: var(--touch-target); }

/* set-up, shifts, report */
.rest-thumb { inline-size: 40px; block-size: 40px; object-fit: cover; border-radius: var(--radius-sm); }
.rest-pic-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.rest-pic { inline-size: 96px; block-size: 72px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--color-border);
  border-radius: var(--radius-md); overflow: hidden; }
.rest-pic img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.rest-z { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); align-items: start; }
.rest-dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); margin: 0; }
.rest-dl dt { color: var(--color-text-muted); }
.rest-dl dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.rest-row-actions { display: inline-flex; gap: var(--space-2); }
.rest-hours { display: flex; align-items: flex-end; gap: var(--space-1); block-size: 140px; }
.rest-hour { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; block-size: 100%; gap: var(--space-1); }
.rest-hour-bar { inline-size: 100%; min-block-size: 2px; background: var(--color-primary); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

@media (max-width: 900px) {
  .rest-pos { grid-template-columns: 1fr; }
  .rest-ticket { position: static; max-height: none; }
}
@media (max-width: 480px) {
  .rest-tables { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .rest-menu-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .rest-table.shape-long { grid-column: auto; }
}

/* 80 mm paper: only the slip prints, on its own page size */
#rest-print { display: none; }
.slip { font-family: var(--font-sans); font-size: 12px; line-height: 1.35; color: var(--doc-ink); background: var(--doc-paper); inline-size: 72mm; }
.slip + .slip { break-before: page; }
.slip-head { text-align: center; margin-block-end: 2mm; }
.slip-head strong { font-size: 15px; }
.slip-title { text-align: center; font-weight: var(--weight-bold); font-size: 14px; margin-block: 1mm 2mm; }
.slip-row { display: flex; justify-content: space-between; gap: 2mm; }
.slip-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.slip-sub { font-size: 11px; padding-inline-start: 3mm; }
.slip-total { font-size: 15px; font-weight: var(--weight-bold); margin-block: 1mm; }
.slip-qr { text-align: center; margin-block: 3mm; }
.slip-qr img { inline-size: 32mm; block-size: 32mm; }
.slip-foot { text-align: center; margin-block-start: 3mm; font-size: 11px; }
.slip hr { border: 0; border-top: 1px dashed var(--doc-ink); margin-block: 2mm; }
.slip-kitchen { font-size: 14px; }
.slip-big { font-size: 16px; font-weight: var(--weight-bold); }
.slip-void { text-decoration: line-through; }
@page slip { size: 80mm auto; margin: 3mm; }
@media print {
  body.rest-printing > *:not(#rest-print) { display: none !important; }
  body.rest-printing #rest-print { display: block; page: slip; }
}
