/**
 * Guests-at-this-table control, shared by POS and Waiter so the same table
 * reads the same on either screen.
 *
 * The count is the thing staff read at a glance, so it is typed as a figure
 * rather than buried in a line of meta text; the editor sits beside it on a
 * wide screen and wraps under it on a phone, instead of pushing the Save
 * button off the row.
 */
.party-row[hidden] {
  display: none;
}

.party-row {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.9rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--zy-border, #e2e8f0);
  border-radius: 12px;
  background: var(--zy-surface-2, #f8fafc);
}

.party-figure {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1 1 10rem;
  /* A flex item defaults to min-width:auto, so a long hint would refuse to
     wrap and stretch the row into a horizontal scroll. */
  min-width: 0;
  flex-wrap: wrap;
}

.party-value {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.party-hint {
  font-size: 0.82rem;
  color: var(--zy-text-muted, #64748b);
  min-width: 0;
  overflow-wrap: anywhere;
}

.party-hint[hidden] {
  display: none;
}

/* Nobody has said how many are seated: capacity and reservation checks are
   running on a guess until someone does, so the row asks rather than states. */
.party-row.is-missing .party-value {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--zy-text-muted, #64748b);
}

.party-row.is-over {
  border-color: var(--zy-amber-500, #f59e0b);
  background: #fffbeb;
}

.party-row.is-over .party-hint {
  color: #92400e;
  font-weight: 600;
}

.party-edit[hidden] {
  display: none;
}

.party-edit {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* One-tap parties, as on the customer's own screen. Compact enough to sit in
   the row beside the box rather than opening anything. */
.party-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.party-choice {
  min-width: 2.5rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  border: 1px solid var(--zy-border, #cbd5e1);
  border-radius: 10px;
  background: var(--zy-white, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.party-choice:hover {
  background: var(--zy-surface-2, #f1f5f9);
}

.party-choice.is-picked {
  border-color: transparent;
  background: var(--zy-emerald-dark, #0b3d35);
  color: var(--zy-ivory, #fbfaf5);
}

.party-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  /* The box is sized for two digits and must stay that size: as a flex item
     it would otherwise be squeezed to nothing by a stretching button. */
  flex: 0 0 auto;
}

.party-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--zy-text-muted, #64748b);
}

.party-input {
  /* Wide enough for two digits plus the spinner, never so wide that it and
     the two buttons stop fitting a phone. */
  width: 5.5rem;
  flex: none;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  border: 1px solid var(--zy-border, #cbd5e1);
  border-radius: 10px;
  background: var(--zy-white, #fff);
  font: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.party-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Touch targets: this is used standing at a table, on a tablet. */
.party-btn {
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--zy-border, #cbd5e1);
  border-radius: 10px;
  background: var(--zy-white, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.party-btn[hidden] {
  display: none;
}

.party-btn:hover:not(:disabled) {
  background: var(--zy-surface-2, #f1f5f9);
}

.party-btn.primary {
  border-color: transparent;
  background: var(--zy-emerald-dark, #0b3d35);
  color: var(--zy-ivory, #fbfaf5);
}

.party-btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.party-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Phone-width panes: the editor gets its own line at full width rather than
   squeezing the count, and Save/Cancel share that line evenly. */
/* Phone-width panes: the count takes its own line and the editor takes the
   next, with the one-tap row above the box. Buttons size to their text — a
   stretched Save next to a squeezed box was neither readable nor tappable. */
@media (max-width: 30rem) {
  /* The editor and its one-tap row take full lines; the count keeps Edit
     beside it, so a recorded table stays a single compact line. */
  .party-edit,
  .party-choices {
    flex: 1 1 100%;
  }

  .party-choice {
    flex: 1 1 2.5rem;
    max-width: 4rem;
  }

  .party-edit-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .party-edit-actions .party-btn {
    flex: 0 0 auto;
    min-width: 5rem;
  }
}
