/* Complete tickets with natural height, not one viewport-sized ticket per lane.
 * Presentation only: never clip products/modifiers/allergies or change actions.
 * Large-distance reading remains an explicit, device-local option.
 */
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 4px;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 6px;
  border-width: 1px;
  border-left-width: 6px;
  border-radius: 9px;
  text-transform: uppercase;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket .ticket-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  margin: 0;
  padding-right: 62px;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket .ticket-head h3.kds-order-number {
  flex: 0 0 auto;
  width: auto;
  min-width: 58px;
  max-width: none;
  min-height: 36px;
  margin: 0;
  padding: 2px 5px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -.04em;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__title { min-width: 0; flex: 1 1 auto; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__title strong {
  font-size: 15px;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: normal;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket:not(.kds-ticket--wall-detail-open) .kds-ticket__title span { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__wall-detail-toggle {
  position: absolute;
  display: block;
  top: 3px;
  right: 4px;
  width: 58px;
  min-width: 0;
  min-height: 44px;
  padding: 3px;
  font-size: 11px;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket:not(.kds-ticket--wall-detail-open) .ticket-meta,
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket:not(.kds-ticket--wall-detail-open) .kds-ticket__scope { display: none; }
/* The wall already has the complete product list and station status. Keep the
 * repeated station breakdown and secondary controls available in Detail on
 * every device, instead of duplicating the whole order below it on tablets. */
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket:not(.kds-ticket--wall-detail-open) :is(
  .station-grid, .kds-coordination-detail, .sync-state, .ticket-item__stations,
  .ticket-inline-form, .kds-ticket__secondary-actions, .kds-auto-note
) { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__wall-status {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  min-height: 0;
  overflow: visible;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-deadline {
  display: flex;
  flex: 1 1 120px;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 6px;
  min-width: 0;
  min-height: 0;
  padding: 2px 5px;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-deadline__label { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-deadline__time { font-size: 18px; line-height: 1.1; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-deadline__countdown { font-size: 12px; line-height: 1.2; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-coordination-strip {
  display: flex;
  flex: 1 1 130px;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
  min-width: 0;
  max-width: none;
  min-height: 0;
  padding: 2px 5px;
  font-size: 12px;
  line-height: 1.2;
  overflow: visible;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-coordination-strip :is(strong, span) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-coordination-strip[data-kds-coordination-detail="routine"] span { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-food-safety {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin: 0;
  padding: 3px 5px;
  border-width: 2px;
  line-height: 1.15;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-food-safety strong { font-size: 12px; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-food-safety .kds-allergen-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 900;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-food-safety img { width: 18px; height: 18px; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-food-safety b { flex: 1 0 100%; font-size: 13px; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] [data-kds-items-scope] {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-items:not([hidden]) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-items:not([hidden]) > li:nth-child(n) {
  display: block;
  height: auto;
  min-height: 0;
  padding: 3px 4px;
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__top { display: flex; align-items: flex-start; gap: 4px; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__top > span {
  display: block;
  min-width: 0;
  padding-right: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  -webkit-line-clamp: unset;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__top .kds-item-name {
  display: inline;
  font: inherit;
  text-transform: uppercase;
}
.zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .ticket-items > li:has(.ticket-item__change-flag) .ticket-item__top > span {
  padding-right: 0;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-item-quantity {
  display: inline-block;
  padding: 0 3px;
  margin-right: 3px;
  border-radius: 3px;
  background: #172033;
  color: #fff;
  font-weight: 950;
  white-space: nowrap;
}
/* The orange modifiers themselves carry the distinction; no repeated label row. */
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__change-flag { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__change-flag ~ ul,
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-items > li > ul {
  display: block;
  margin: 2px 0 0;
  padding-left: 16px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: #7c2d12;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-items > li > ul > li { font: inherit; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .ticket-item__food-safety[data-food-safety-scope="ORDER"] { display: none; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__notes {
  margin: 0;
  padding: 3px 5px;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__actions { margin: 0; gap: 4px; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__actions :is(button, .btn),
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket__view-switch button,
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-handoff-note {
  min-height: 44px;
  padding: 5px 7px;
  font-size: 15px;
  line-height: 1.15;
}
@media (min-width: 981px) {
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kitchen-board[data-kds-wall="true"] {
    grid-template-columns: var(--kds-reading-columns, repeat(3, minmax(0, 1fr)));
    grid-template-rows: minmax(0, 1fr);
    gap: 7px;
  }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kds-column {
    grid-row: 1;
    gap: 6px;
    padding: 5px;
    overflow-y: auto;
    scrollbar-width: thin;
    overscroll-behavior: contain;
  }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kitchen-column__head {
    position: sticky;
    top: -5px;
    z-index: 3;
    flex-basis: auto;
    min-height: 34px;
    padding: 4px 8px;
  }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kitchen-column__head h2 { font-size: 20px; line-height: 1.1; }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kds-wall-pager { display: none !important; }
}
@media (max-width: 1399px) {
  /* On smaller monitors, give the selected stage two wide, complete tickets.
   * All three stages and their counts remain one tap away in the existing tabs.
   * Do not stretch the old wall-sized grid rows or discard ticket content. */
  html:has(body.zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"]),
  body.zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .content.zestia-ops-main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kitchen-board[data-kds-wall="true"] {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: max-content;
    align-content: start;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-lane-tabs {
    position: static;
    grid-column: 1 / -1;
    /* Legacy wall CSS hides these with !important; balanced needs navigation. */
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid #d9e2ed;
    border-radius: 9px;
    background: #f8fafc;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-lane-tabs button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
    min-height: 44px;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-lane-tabs button[aria-selected="true"] {
    background: #172033;
    color: #fff;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-lane-tabs strong { font-size: 18px; }
  .zestia-ops-shell--kds.kds-focus[data-kds-reading="balanced"] .kds-column {
    grid-row: auto;
    height: auto;
    max-height: none;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-board[data-active-lane="accepted"] .kds-column:not([data-kds-lane="accepted"]),
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-board[data-active-lane="prep"] .kds-column:not([data-kds-lane="prep"]),
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-board[data-active-lane="ready"] .kds-column:not([data-kds-lane="ready"]) { display: none; }
}
@media (max-width: 980px) {
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header {
    display: grid;
    grid-template-areas: "brand settings fullscreen" "navigation navigation navigation";
    grid-template-columns: minmax(0, 1fr) 88px 44px;
    gap: 5px;
    padding: 6px 10px;
    min-height: 0;
    overflow: visible;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header > .zestia-ops-brand { grid-area: brand; min-width: 0; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header > .zestia-ops-header__actions { display: contents; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header .zestia-ops-status { display: none; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header .kds-settings-toggle { grid-area: settings; width: 88px; min-height: 44px; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header .kds-fullscreen-toggle { grid-area: fullscreen; width: 44px; min-width: 44px; min-height: 44px; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header .main-nav.zestia-ops-nav {
    grid-area: navigation;
    display: flex;
    position: static;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .site-header.zestia-ops-header .main-nav.zestia-ops-nav :is(a, button) { min-height: 44px; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket { margin: 0; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-column > .kds-ticket + .kds-ticket { margin-top: 6px; }
}
@media (min-width: 600px) and (max-width: 1399px) {
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-column:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kitchen-column__head { grid-column: 1 / -1; }
  .zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-column > .kds-ticket + .kds-ticket { margin-top: 0; }
}
/* Details retain the prior full, large reading layout and all actions. */
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open {
  position: fixed;
  inset: 12px;
  margin: auto;
  width: min(880px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  padding: 12px;
  background: #fffdf8;
  overflow-y: auto;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open::backdrop { background: rgba(15, 23, 42, .5); }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open .kds-ticket__wall-detail-toggle {
  position: static;
  align-self: end;
  width: auto;
  padding: 5px 12px;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open .ticket-head { padding-right: 0; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open :is(.ticket-meta, .kds-ticket__scope) {
  display: flex;
  flex-wrap: wrap;
}
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open .kds-ticket__title span { display: block; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open .ticket-inline-form { display: block; }
.zestia-ops-shell--kds[data-kds-reading="balanced"] .kds-ticket.kds-ticket--wall-detail-open .ticket-inline-form button { min-height: 44px; }
