/* Judgy — waiters' screens (/staff/) and the staff components the owner console
   embeds (Comande, Dispositivi, the cancellation dialog).

   The console loads this sheet on every page, so nothing here is unscoped: every
   rule hangs off .staff-page, .staff-shell, .staff-dialog or .staff-app. Colours,
   radii and type come from the console tokens in app/styles.css, which the staff
   page loads first. Controls are touched at 44px or more even where they are
   drawn smaller: the missing height is an invisible ::after. */

/* ---------- Staff page frame ---------- */

body.staff-page {
  background: var(--ground);
}

.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.staff-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
}

.staff-brand img {
  flex: none;
}

.staff-who {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.staff-who strong {
  font-size: var(--t-small);
  font-weight: 650;
}

.staff-who span {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--t-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-logout {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--graphite);
  font: inherit;
  font-size: var(--t-micro);
  font-weight: 600;
  cursor: pointer;
}

.staff-logout svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.staff-logout[hidden] {
  display: none;
}

.staff-page #staff-view {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.staff-boot {
  margin: 24px 16px;
  color: var(--muted);
  font-size: var(--t-small);
}

/* ---------- Plain staff screens: sign-in, messages, Dispositivi ---------- */

.staff-shell {
  max-width: 720px;
}

.staff-page .staff-shell {
  padding-block: 28px 40px;
}

.staff-shell h1 {
  margin: 4px 0 8px;
  font-size: var(--t-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.staff-shell h2 {
  margin: 20px 0 8px;
  font-size: var(--t-h3);
}

.staff-shell p {
  margin: 0 0 10px;
  color: var(--graphite);
  font-size: var(--t-small);
  line-height: 1.5;
}

.staff-shell label,
.staff-dialog label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-size: var(--t-small);
  font-weight: 600;
}

.staff-shell input,
.staff-shell textarea,
.staff-dialog textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}

.staff-shell textarea,
.staff-dialog textarea {
  min-height: 72px;
  resize: vertical;
}

.staff-shell input:focus-visible,
.staff-shell textarea:focus-visible,
.staff-dialog textarea:focus-visible {
  border-color: var(--orange);
  outline: 2px solid rgba(var(--orange-rgb), 0.35);
  outline-offset: 0;
}

/* Buttons that carry no console .button class of their own. */
.staff-shell button:not(.button),
.staff-dialog button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--graphite);
  font: inherit;
  font-size: var(--t-small);
  font-weight: 600;
  cursor: pointer;
}

.staff-shell button:not(.button):hover,
.staff-dialog button:hover {
  border-color: rgba(var(--orange-rgb), 0.5);
}

.staff-shell button:disabled,
.staff-dialog button:disabled {
  opacity: 0.5;
  cursor: default;
}

.staff-shell .staff-message {
  color: var(--warn);
  white-space: pre-wrap;
}

.staff-login {
  max-width: 420px;
}

.staff-login #staff-code {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.35em;
  text-align: center;
}

.staff-send {
  width: 100%;
}

.staff-warning {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--orange-line);
  border-radius: var(--radius);
  background: var(--orange-wash);
}

.staff-warning p {
  margin: 4px 0 8px;
}

.staff-access-link {
  color: var(--orange-strong);
  overflow-wrap: anywhere;
}

.staff-form {
  padding: 16px 18px;
}

.staff-devices {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.staff-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.staff-device p {
  margin: 2px 0 0;
  color: var(--muted);
}

.staff-shell .staff-code {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.staff-device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* WhatsApp in Dispositivi (2026-09-26): links that look like the buttons beside them. */
.staff-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-shell .staff-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ok-line);
  border-radius: var(--radius);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: var(--t-small);
  font-weight: 650;
  text-decoration: none;
}

.staff-shell .staff-share:hover {
  border-color: var(--ok);
}

.staff-shell .staff-share .staff-ico {
  width: 16px;
  height: 16px;
}

/* ---------- Dialogs (reset code, empty order, kitchen cancellation) ---------- */

.staff-dialog {
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 20px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.staff-dialog::backdrop {
  background: rgba(20, 16, 12, 0.45);
}

.staff-dialog h2 {
  margin: 0 0 8px;
  font-size: var(--t-h3);
}

.staff-dialog p {
  margin: 0 0 12px;
  color: var(--graphite);
  font-size: var(--t-small);
  line-height: 1.5;
}

.staff-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.staff-dialog button[value="confirm"] {
  border-color: var(--orange-solid);
  background: var(--orange-solid);
  color: #fff;
}

/* ---------- The composer: .staff-app ---------- */

.staff-app {
  --staff-top: 0px;
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink);
  font-size: var(--t-small);
  line-height: 1.45;
}

/* Embedded in the console: below its sticky mobile header, full height. */
#view .staff-app {
  --staff-top: var(--header-h);
  min-height: calc(100svh - var(--header-h));
}

/* Zero specificity, so every component rule below outranks this reset. */
:where(.staff-app) button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

:where(.staff-app) button:disabled {
  cursor: default;
}

.staff-app :focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Typed text is plain, whatever the label around it weighs. */
.staff-app input,
.staff-app textarea {
  font-family: inherit;
  font-size: var(--t-body);
  font-weight: 400;
}

/* iOS zooms the whole page into any field under 16px; nowhere else does. */
@supports (-webkit-touch-callout: none) {
  .staff-app input,
  .staff-app textarea {
    font-size: 16px;
  }
}

.staff-ico {
  flex: none;
  width: 18px;
  height: 18px;
}

/* Drawn small, touched at 44px. */
.staff-logout::after,
.staff-context button::after,
.staff-slip-head button::after,
.staff-replace button::after,
.staff-chips button::after,
.staff-segment button::after,
.staff-stepper button::after,
.staff-tool::after,
.staff-pending-actions button::after,
.staff-banner-open::after,
.staff-banner-close::after,
.staff-message-action::after,
.staff-update-action::after {
  position: absolute;
  inset: calc((100% - 44px) / 2) 0;
  content: "";
}

.staff-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 4px;
}

.staff-screen-title {
  margin: 0;
  font-size: var(--t-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.staff-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.staff-live.is-off {
  color: var(--danger);
}

.staff-live.is-off i {
  background: var(--danger);
}

/* The ready notice takes its own room at the top and stays there while the page
   scrolls; the sticky search moves below it rather than hiding under it. */
.staff-banner-anchor {
  position: sticky;
  top: var(--staff-top);
  z-index: 20;
  padding: 0 12px;
}

.staff-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 4px 6px 10px;
  border: 1px solid var(--ok-line);
  border-radius: var(--radius-lg);
  background: var(--ok-soft);
  box-shadow: var(--shadow);
  animation: staffBannerIn 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.staff-banner[hidden] {
  display: none;
}

.staff-banner-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
}

.staff-banner-ico .staff-ico {
  width: 18px;
  height: 18px;
  transform-origin: 50% 18%;
  animation: staffBell 700ms ease-in-out 2;
}

.staff-banner-text {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.staff-banner-text strong {
  color: var(--ink);
  font-size: var(--t-body);
}

.staff-banner-text span {
  overflow: hidden;
  color: var(--ok);
  font-size: var(--t-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-banner-open {
  position: relative;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-weight: 650;
}

.staff-banner-close {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ok);
}

@keyframes staffBannerIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes staffBell {
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(6deg); }
  80% { transform: rotate(-3deg); }
}

.staff-app .staff-message {
  margin: 6px 16px 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--sunk);
  color: var(--graphite);
  font-size: var(--t-small);
  white-space: pre-wrap;
}

.staff-app .staff-message[data-kind="ok"] {
  background: var(--ok-soft);
  color: var(--ok);
}

.staff-app .staff-message[data-kind="error"] {
  background: var(--orange-wash);
  color: var(--warn);
}

.staff-app .staff-message[hidden] {
  display: none;
}

/* Its own class for «Ricarica»: a shared one made the hidden update button
   answer a selector meant for «Ripristina». */
.staff-message-action,
.staff-update-action {
  position: relative;
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  font-weight: 650;
}

.staff-content {
  flex: 1;
  padding: 8px 16px 24px;
}

.staff-empty {
  margin: 20px 0;
  color: var(--muted);
  text-align: center;
}

.staff-warn {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--orange-wash);
  color: var(--warn);
}

/* Steps: the one place numbering is honest, because the order is a sequence. */
.staff-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.staff-steps button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-steps .staff-ico {
  width: 15px;
  height: 15px;
}

.staff-steps .is-done button {
  border-bottom-color: var(--orange-line);
  color: var(--graphite);
}

.staff-steps .is-current button {
  border-bottom-color: var(--orange);
  color: var(--ink);
  font-weight: 700;
}

.staff-steps .is-done .staff-ico,
.staff-steps .is-current .staff-ico {
  color: var(--orange);
}

/* Start */
.staff-start {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 14vh 8px 24px;
  text-align: center;
}

.staff-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  min-height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--orange-solid);
  box-shadow: 0 8px 22px rgba(43, 24, 10, 0.18);
  color: #fff;
  font-size: var(--t-body);
  font-weight: 700;
}

.staff-cta .staff-ico {
  width: 22px;
  height: 22px;
}

.staff-hint {
  max-width: 30ch;
  margin: 0;
  color: var(--muted);
}

/* 1 Tavolo */
.staff-title {
  margin: 0 0 10px;
  font-size: var(--t-body);
  font-weight: 650;
}

.staff-tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}

.staff-tables button {
  position: relative;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--t-body);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.staff-tables button.is-selected {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 1px var(--orange);
}

.staff-tables button.has-orders::after,
.staff-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  content: "";
}

.staff-tables button.has-orders::after {
  position: absolute;
  top: 6px;
  right: 6px;
}

.staff-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: var(--t-micro);
}

.staff-legend i {
  display: inline-block;
}

.staff-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 10px 0 2px;
  border: 0;
  background: none;
  color: var(--graphite);
  font-weight: 600;
}

/* 2 Piatti */
.staff-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.staff-context > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-body);
  font-weight: 700;
}

.staff-context .staff-ico {
  color: var(--orange);
}

.staff-context button,
.staff-slip-head button {
  position: relative;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--graphite);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-replace {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--radius);
  background: var(--orange-tint);
  color: var(--warn);
}

.staff-replace button {
  position: relative;
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--warn);
  font-weight: 650;
}

.staff-search {
  position: sticky;
  top: calc(var(--staff-top) + var(--staff-banner-h, 0px));
  z-index: 5;
  display: block;
  margin: 0 -16px 4px;
  padding: 6px 16px;
  background: var(--ground);
}

.staff-search .staff-ico {
  position: absolute;
  top: 50%;
  left: 29px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.staff-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
}

.staff-search input::-webkit-search-cancel-button {
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a6058' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E") center / contain no-repeat;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.staff-search input:focus,
.staff-note-field input:focus,
.staff-general textarea:focus,
.staff-table-filter input:focus {
  border-color: var(--orange);
  outline: 2px solid rgba(var(--orange-rgb), 0.3);
  outline-offset: 0;
}

/* The chips scroll sideways; the padding gives their taller hit areas room
   inside the scroller, which would otherwise clip them. */
.staff-chips {
  display: flex;
  gap: 6px;
  margin: -2px -16px 4px;
  padding: 6px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.staff-chips button {
  position: relative;
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--graphite);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-chips button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.staff-dish-group + .staff-dish-group {
  margin-top: 14px;
}

.staff-dish-group h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 650;
}

.staff-dish-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.staff-dish {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 2px 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 8px 8px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
}

.staff-dish:first-child {
  border-top: 0;
}

.staff-dish-name {
  font-size: var(--t-body);
  font-weight: 600;
  line-height: 1.25;
}

.staff-dish-price {
  grid-column: 1;
  color: var(--muted);
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
}

.staff-dish-qty {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--orange-tint);
  color: var(--orange-strong);
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.staff-dish-add {
  display: grid;
  grid-row: 1 / span 2;
  grid-column: 3;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange);
}

.staff-dish.is-in .staff-dish-add {
  background: var(--orange-solid);
  color: #fff;
}

.staff-dish.is-added .staff-dish-add {
  animation: staffPop 260ms ease-out;
}

.staff-dish:disabled {
  background: var(--paper);
}

.staff-dish:disabled .staff-dish-name {
  color: var(--muted);
}

@keyframes staffPop {
  50% { transform: scale(1.18); }
}

/* 3 Conferma: the paper comanda the kitchen will read, scalloped at the foot. */
.staff-slip {
  position: relative;
  margin: 2px 0 14px;
  padding: 12px 14px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg);
}

.staff-slip::after {
  position: absolute;
  right: -1px;
  bottom: -7px;
  left: -1px;
  height: 7px;
  background: radial-gradient(circle at 5px 0, var(--bg) 4.5px, var(--line) 5px, transparent 5.5px) 0 0 / 10px 7px repeat-x;
  content: "";
}

.staff-slip-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-strong);
}

.staff-slip-head > span {
  color: var(--muted);
  font-size: var(--t-micro);
}

.staff-slip-head strong {
  grid-row: 2;
  font-size: var(--t-h3);
  font-variant-numeric: tabular-nums;
}

.staff-slip-head button {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.staff-pending strong {
  display: block;
}

.staff-pending p {
  margin: 2px 0 8px;
}

.staff-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-pending-actions button {
  position: relative;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--orange-line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--warn);
  font-weight: 650;
}

.staff-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.staff-line {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  container-type: inline-size;
}

.staff-line-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.staff-line-name {
  font-size: var(--t-body);
  font-weight: 650;
  line-height: 1.3;
}

.staff-line-price {
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.staff-line.is-blocked .staff-line-name,
.staff-line.is-blocked .staff-line-price {
  color: var(--danger);
}

/* One row on a 360px phone: stepper, Cambia, Separa and the bin at the far end. */
.staff-line-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.staff-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.staff-stepper button {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  color: var(--orange);
}

.staff-stepper button:disabled {
  color: var(--line-strong);
}

.staff-stepper output {
  min-width: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.staff-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--graphite);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-tool .staff-ico {
  width: 15px;
  height: 15px;
  color: var(--orange);
}

.staff-tool-icon {
  justify-content: center;
  width: 36px;
  margin-left: auto;
  padding: 0;
}

.staff-tool-icon .staff-ico {
  color: var(--muted);
}

/* A narrow phone keeps the row whole: «Cambia» and «Separa» show their icon
   only, and their aria-label still names them. */
@container (max-width: 320px) {
  .staff-tool:not(.staff-tool-icon) {
    justify-content: center;
    width: 40px;
    padding: 0;
  }

  .staff-tool:not(.staff-tool-icon) span {
    display: none;
  }
}

.staff-tool:disabled,
.staff-link:disabled,
.staff-pending-actions button:disabled {
  opacity: 0.45;
}

.staff-note-field {
  position: relative;
  display: block;
  margin: 0;
  padding: 2px 0;
}

.staff-note-field .staff-ico {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transform: translateY(-50%);
}

.staff-note-field input,
.staff-general textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}

.staff-note-field input {
  min-height: 40px;
  padding: 0 10px 0 30px;
}

.staff-general {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-general textarea {
  min-height: 56px;
  padding: 8px 10px;
  resize: vertical;
}

.staff-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 4px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--orange-strong);
  font-weight: 650;
}

/* «Mostra altre pronte» sits under a list and is hidden until there are more. */
.staff-link[hidden] {
  display: none;
}

.staff-link .staff-ico {
  color: var(--orange);
}

.staff-link.staff-danger,
.staff-link.staff-danger .staff-ico {
  color: var(--danger);
}

/* Footer: the running order and the three sections, always at hand. Sticky,
   not fixed: inside the console the view is transformed while it enters, and a
   fixed bar would anchor to that instead of the screen. */
.staff-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin-top: auto;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 -8px 24px rgba(20, 16, 12, 0.05);
}

.staff-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--line);
}

.staff-actionbar[hidden] {
  display: none;
}

.staff-bar-sum {
  display: grid;
  line-height: 1.2;
}

.staff-bar-sum span {
  color: var(--muted);
  font-size: var(--t-micro);
}

.staff-bar-sum strong {
  font-size: var(--t-body);
  font-variant-numeric: tabular-nums;
}

.staff-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--orange-solid);
  color: #fff;
  font-size: var(--t-body);
  font-weight: 700;
}

.staff-primary:disabled {
  background: var(--sunk);
  color: var(--muted);
}

.staff-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.staff-nav button {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 54px;
  padding: 7px 4px 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 600;
}

.staff-nav .staff-ico {
  width: 20px;
  height: 20px;
}

.staff-nav button[aria-current="page"] {
  color: var(--ink);
}

.staff-nav button[aria-current="page"] .staff-ico {
  color: var(--orange);
}

.staff-nav button[aria-current="page"]::before {
  position: absolute;
  top: 0;
  right: 32%;
  left: 32%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--orange);
  content: "";
}

.staff-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 17px;
}

.staff-badge[hidden] {
  display: none;
}

/* Comande and Pronte */
.staff-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.staff-segment {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--sunk);
}

.staff-segment button {
  position: relative;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 650;
}

.staff-segment button[aria-pressed="true"] {
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.staff-table-filter {
  position: relative;
  width: 108px;
  padding: 4px 0;
}

.staff-table-filter .staff-ico {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transform: translateY(-50%);
}

.staff-table-filter input {
  width: 100%;
  min-height: 36px;
  padding: 0 8px 0 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
}

.staff-tickets {
  display: grid;
  gap: 8px;
}

.staff-ticket {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  /* A service can put a couple of hundred tickets in a list: the phone lays out
     and paints only those on screen. */
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}

.staff-ticket.is-own {
  border-left: 3px solid var(--orange);
}

.staff-ticket-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.staff-ticket-head strong {
  font-size: var(--t-body);
}

.staff-ticket-head time {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
}

.staff-state {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--graphite);
  font-size: var(--t-micro);
  font-weight: 650;
}

.staff-ticket.is-ready .staff-state {
  background: var(--ok-soft);
  color: var(--ok);
}

.staff-ticket-items {
  display: grid;
  gap: 2px;
  margin: 6px 0;
  padding: 0;
  list-style: none;
}

.staff-ticket-items b {
  font-variant-numeric: tabular-nums;
}

.staff-ticket-note {
  display: block;
  margin: 2px 0 0;
  padding-left: 8px;
  border-left: 2px solid var(--orange-line);
  color: var(--warn);
  font-size: var(--t-micro);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.staff-ticket-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: var(--t-micro);
}

.staff-ticket-foot strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.staff-footnote {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: var(--t-micro);
  text-align: center;
}

/* «In preparazione» since 2026-09-26: «Da portare al tavolo» first, then «In
   cucina». Each ticket carries its own actions: «Consegnata» on a ready one,
   «Annulla» on this phone's own until delivery. */
.staff-open-group + .staff-open-group {
  margin-top: 16px;
}

.staff-open-group[hidden] {
  display: none;
}

.staff-group-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: var(--t-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.staff-ticket.is-ready {
  border-color: var(--ok-line);
}

.staff-ticket.is-delivered .staff-state {
  background: var(--ok-soft);
  color: var(--ok);
}

.staff-ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.staff-ticket-actions button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: var(--t-small);
  font-weight: 700;
}

/* Drawn at 40px, touched at 44px, like every other control here. */
.staff-ticket-actions button::after {
  position: absolute;
  inset: calc((100% - 44px) / 2) 0;
  content: "";
}

.staff-ticket-deliver {
  border: 0;
  background: var(--ok);
  color: #fff;
}

.staff-ticket-cancel {
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--danger);
}

.staff-ticket-actions button:disabled {
  opacity: 0.5;
}

/* «Consegnate»: one service day at a time. */
.staff-day {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.staff-day-step {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--graphite);
}

.staff-day-step::after {
  position: absolute;
  inset: -4px;
  content: "";
}

.staff-day-step:disabled {
  opacity: 0.4;
}

.staff-day-pick input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
}

/* The day being shown, read as a heading: «Oggi», «Ieri», «Giovedì 24 settembre». */
.staff-day-label {
  margin: 0 0 10px;
  color: var(--graphite);
  font-size: var(--t-body);
  font-weight: 650;
}

@media (min-width: 600px) {
  .staff-page .staff-app {
    margin-block: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--ground);
  }
}

@media (max-width: 600px) {
  .staff-device {
    align-items: flex-start;
    flex-direction: column;
  }

  .staff-device-actions {
    flex-direction: column;
    width: 100%;
  }

  .staff-device-actions button {
    width: 100%;
  }

  .staff-device-actions .staff-share {
    justify-content: center;
    width: 100%;
  }

  .staff-dialog .staff-actions {
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: reduce) {
  .staff-banner,
  .staff-banner-ico .staff-ico,
  .staff-dish.is-added .staff-dish-add {
    animation: none;
  }
}
