/* Zestia Cocina · auxiliary workspaces.
 * Scoped to non-KDS operational pages so the 20-inch mural remains unchanged.
 */

.ops-aux-page,
.ticket-screen-head,
.ticket-print-wrap,
.ticket-screen-actions {
  width: min(100%, 1440px);
  min-width: 0;
  margin-inline: auto;
}

.ops-aux-page {
  display: grid;
  gap: 16px;
}

.ops-aux-page > *,
.ops-aux-page :where(section, article, div, form, table, tbody, tr, td) {
  min-width: 0;
}

.ops-aux-page__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--zops-line);
  border-radius: var(--zops-radius-lg);
  background:
    radial-gradient(circle at 94% 12%, rgba(52, 84, 232, 0.12), transparent 34%),
    var(--zops-surface);
  box-shadow: var(--zops-shadow-surface);
}

.ops-aux-page__head h1,
.ticket-screen-head h1 {
  margin: 3px 0 4px;
  color: var(--zops-ink);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.ops-aux-page__head p,
.ticket-screen-head p {
  max-width: 760px;
  margin: 0;
  color: var(--zops-muted);
  font-size: 15px;
}

.ops-aux-page__eyebrow {
  display: block;
  color: var(--zops-brand-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ops-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  margin: 0;
}

.ops-aux-page .summary-card {
  min-height: 82px;
  align-content: center;
  padding: 14px 16px;
  border-color: var(--zops-line);
  border-left: 5px solid var(--zops-brand);
  border-radius: var(--zops-radius-md);
  background: var(--zops-surface);
  box-shadow: var(--zops-shadow-surface);
}

.ops-aux-page .summary-card--success {
  border-left-color: var(--zops-success);
}

.ops-aux-page .summary-card--warning {
  border-left-color: var(--zops-warning);
  background: #fffaf0;
}

.ops-aux-page .summary-card--danger {
  border-left-color: var(--zops-danger);
  background: #fff7f7;
}

.ops-aux-page .summary-card strong {
  color: var(--zops-ink);
  font-family: var(--zops-font-data);
  font-size: clamp(24px, 3vw, 34px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ops-catalog-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  grid-template-areas:
    "label count"
    "controls controls";
  align-items: end;
  gap: 7px 14px;
  padding: 14px 16px;
  border: 1px solid var(--zops-line);
  border-radius: var(--zops-radius-lg);
  background: var(--zops-surface);
  box-shadow: var(--zops-shadow-surface);
}

.ops-catalog-filter > label {
  grid-area: label;
  color: var(--zops-ink);
  font-size: 14px;
  font-weight: 900;
}

.ops-catalog-filter__controls {
  display: grid;
  grid-area: controls;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ops-catalog-filter__controls input {
  width: 100%;
  max-width: none;
  min-height: 46px;
  padding-inline: 14px;
  border-color: var(--zops-line-strong);
  background: var(--zops-surface-soft);
  color: var(--zops-ink);
}

.ops-catalog-filter__controls button {
  min-height: 46px;
  min-width: 92px;
}

.ops-catalog-filter__count {
  grid-area: count;
  margin: 0;
  color: var(--zops-muted);
  font-family: var(--zops-font-data);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.ops-catalog-filter__empty[hidden],
[data-catalog-filter-item][hidden],
[data-catalog-filter-group][hidden],
[data-catalog-filter-clear][hidden] {
  display: none !important;
}

.ops-aux-page .category-card,
.ops-aux-page .ops-aux-section {
  margin: 0;
  padding: 16px;
  border-color: var(--zops-line);
  border-radius: var(--zops-radius-lg);
  background: var(--zops-surface);
  box-shadow: var(--zops-shadow-surface);
}

.ops-aux-page .category-head,
.ops-aux-section__head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.ops-aux-page :where(.category-head, .ops-aux-section__head) h2 {
  margin: 0;
  color: var(--zops-ink);
  font-size: clamp(19px, 2vw, 25px);
  letter-spacing: -0.025em;
}

.ops-aux-page .category-head p {
  margin: 3px 0 0;
}

.ops-aux-page .ingredient-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.ops-aux-page .ingredient-card {
  display: grid;
  align-content: start;
  gap: 13px;
  min-height: 100%;
  padding: 15px;
  border: 1px solid var(--zops-line);
  border-left: 5px solid var(--zops-success);
  border-radius: var(--zops-radius-md);
  background: var(--zops-surface);
  box-shadow: none;
}

.ops-aux-page .ingredient-card.is-low {
  border-color: #f4c775;
  border-left-color: var(--zops-warning);
  background: #fffaf0;
}

.ops-aux-page .ingredient-card.is-out {
  border-color: #f5b5b5;
  border-left-color: var(--zops-danger);
  background: #fff8f8;
}

.ops-aux-page .ingredient-card h3 {
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.2;
}

.ops-aux-page .ingredient-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.ops-aux-page .ingredient-meta > div {
  padding: 9px 10px;
  border-radius: var(--zops-radius-sm);
  background: var(--zops-surface-soft);
  overflow-wrap: anywhere;
}

.ops-aux-page .ingredient-meta span {
  color: var(--zops-text);
  line-height: 1.35;
}

.ops-aux-page .ingredient-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  margin-top: auto;
}

.ops-aux-page .ingredient-actions form:last-child {
  grid-column: 1 / -1;
}

.ops-aux-page :where(.ingredient-actions, .product-actions) form,
.ops-aux-page :where(.ingredient-actions, .product-actions) :where(button, .btn) {
  width: 100%;
  min-width: 0;
}

.ops-aux-page .danger-ghost {
  border-color: #f0b1b1 !important;
  color: #a71818 !important;
}

.ops-aux-page .product-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.ops-aux-page .product-card {
  min-height: 128px;
  align-content: space-between;
  padding: 15px;
  border-left: 5px solid var(--zops-success);
  border-radius: var(--zops-radius-md);
  box-shadow: var(--zops-shadow-surface);
}

.ops-aux-page .product-card.is-unavailable {
  border-left-color: var(--zops-danger);
  background: #fff8f8;
}

.ops-aux-page .product-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--zops-ink);
  font-size: 18px;
  line-height: 1.2;
}

.ops-aux-page .product-actions {
  width: 100%;
}

.ops-aux-page .product-card:not(.is-unavailable) .product-actions button.danger {
  border-color: #ef9a9a;
  background: #fff7f7;
  color: #a71818;
  box-shadow: none;
}

.ops-aux-page .product-card:not(.is-unavailable) .product-actions button.danger:hover {
  border-color: var(--zops-danger);
  background: #fee2e2;
  color: #8d1212;
}

.ops-aux-page .product-card.is-unavailable .product-actions button {
  border-color: var(--zops-success);
  background: var(--zops-success);
  color: #fff;
}

.ops-inline-editor {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, auto);
  align-items: end;
  gap: 14px;
  padding: 16px !important;
  border-radius: var(--zops-radius-lg) !important;
}

.ops-inline-editor h2,
.ops-inline-editor p {
  margin: 0;
}

.ops-inline-editor__form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.ops-inline-editor__form label {
  grid-column: 1 / -1;
  color: var(--zops-text);
  font-size: 12px;
  font-weight: 850;
}

.ops-responsive-table {
  max-width: 100%;
  padding: 0;
  border-color: var(--zops-line);
  border-radius: var(--zops-radius-md);
  box-shadow: none;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.ops-responsive-table .table {
  min-width: 620px;
}

.ops-responsive-table :where(th, td) {
  overflow-wrap: anywhere;
}

.ops-responsive-table tbody tr {
  background: var(--zops-surface);
}

.ops-responsive-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.ops-responsive-table .row-open {
  background: #f0fcf8;
}

.ops-responsive-table .row-warning {
  background: #fff8e8;
}

.ops-responsive-table .row-danger {
  background: #fff1f2;
}

.ops-responsive-table td > .actions {
  flex-wrap: nowrap;
}

.ops-responsive-table td > .actions :where(form, button) {
  min-width: 0;
}

.ops-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 14px;
}

.ops-empty-state {
  display: grid;
  min-height: 132px;
  place-content: center;
  gap: 5px;
  padding: 24px;
  border: 1px dashed var(--zops-line-strong);
  border-radius: var(--zops-radius-lg);
  background: var(--zops-surface-soft);
  color: var(--zops-muted);
  text-align: center;
}

.ops-empty-state strong {
  color: var(--zops-ink);
  font-size: 17px;
}

.ops-empty-state--compact {
  min-height: 76px;
  margin: 4px 0 0;
  padding: 16px;
}

.ops-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.ticket-screen-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--zops-line);
  border-radius: var(--zops-radius-lg);
  background: var(--zops-surface);
  box-shadow: var(--zops-shadow-surface);
}

.ticket-screen-head h1 {
  font-size: clamp(25px, 4vw, 38px);
}

.ticket-print,
.ticket-print :where(header, section, article, div, p, strong, span, ul, li) {
  min-width: 0;
}

.ticket-print :where(h1, h2, strong, p, li, span) {
  overflow-wrap: anywhere;
}

.ticket-line__head {
  flex-wrap: wrap;
}

.ticket-line__head > strong {
  flex: 1 1 220px;
}

.ticket-screen-actions {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding: 9px;
  border: 1px solid var(--zops-line);
  border-radius: var(--zops-radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--zops-shadow-raised);
  backdrop-filter: blur(12px);
}

.ticket-screen-actions :where(button, .btn) {
  width: 100%;
}

@media (max-width: 980px) {
  .ops-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-inline-editor {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ops-aux-page {
    gap: 10px;
  }

  .ops-aux-page__head {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  .ops-aux-page__head .actions,
  .ops-aux-page__head .actions :where(form, a, button) {
    width: 100%;
  }

  .ops-aux-page .summary-card {
    min-height: 82px;
    padding: 11px 12px;
  }

  .ops-catalog-filter {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "controls"
      "count";
    padding: 12px;
  }

  .ops-catalog-filter__count {
    text-align: left;
  }

  .ops-aux-page .category-card,
  .ops-aux-page .ops-aux-section {
    padding: 12px;
  }

  .ops-aux-page .category-head,
  .ops-aux-section__head {
    align-items: flex-start;
  }

  .ops-aux-page .ingredient-meta {
    grid-template-columns: 1fr;
  }

  .ops-aux-page .ingredient-actions {
    grid-template-columns: 1fr;
  }

  .ops-aux-page .ingredient-actions form:last-child {
    grid-column: auto;
  }

  .ops-inline-editor__form {
    grid-template-columns: 1fr;
  }

  .ops-inline-editor__form label {
    grid-column: auto;
  }

  .ops-responsive-table {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .ops-responsive-table .table {
    display: block;
    min-width: 0;
  }

  .ops-responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .ops-responsive-table tbody {
    display: grid;
    gap: 10px;
  }

  .ops-responsive-table tr {
    display: grid;
    gap: 0;
    padding: 5px 12px;
    border: 1px solid var(--zops-line);
    border-left: 5px solid var(--zops-line-strong);
    border-radius: var(--zops-radius-md);
    box-shadow: var(--zops-shadow-surface);
  }

  .ops-responsive-table tr.row-open {
    border-left-color: var(--zops-success);
  }

  .ops-responsive-table tr.row-warning {
    border-left-color: var(--zops-warning);
  }

  .ops-responsive-table tr.row-danger {
    border-left-color: var(--zops-danger);
  }

  .ops-responsive-table td {
    display: grid;
    grid-template-columns: minmax(88px, 0.45fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 7px 0 !important;
    border-bottom: 1px solid var(--zops-line) !important;
  }

  .ops-responsive-table td:last-child {
    border-bottom: 0 !important;
  }

  .ops-responsive-table td::before {
    color: var(--zops-muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.075em;
    text-transform: uppercase;
  }

  .ops-responsive-table td > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-responsive-table td > .actions :where(form, button) {
    width: 100%;
  }

  .ticket-screen-head {
    padding: 13px;
  }

  .ticket-print {
    width: 100%;
    padding: 10px;
  }

  .ticket-print__brand,
  .ticket-print__brand-main {
    flex-wrap: wrap;
  }

  .ticket-print__order-hero strong {
    font-size: clamp(68px, 22vw, 96px);
  }

  .ticket-print__dispatch strong {
    font-size: clamp(26px, 9vw, 38px);
  }

  .ticket-line__marker {
    white-space: normal;
  }
}

@media (max-width: 390px) {
  .ops-summary-grid,
  .ticket-screen-actions {
    grid-template-columns: 1fr;
  }

  .ops-catalog-filter__controls {
    grid-template-columns: 1fr;
  }

  .ops-aux-page .summary-card {
    min-height: 72px;
  }
}

@media print {
  .ops-aux-page__head,
  .ops-summary-grid,
  .ticket-screen-head,
  .ticket-screen-actions {
    display: none !important;
  }

  .ticket-print__dispatch {
    grid-template-columns: 0.9fr 1.1fr;
  }
}
