/* Staff mobile app — table-focused floor operations */

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-dim: #f4f4f0;
  --border: #e3e3df;
  --text: #1a1c1a;
  --text-muted: #5c5f5e;
  --primary: #154212;
  --primary-light: #2d5a27;
  --primary-soft: #e8f3e5;
  --accent: #3b6934;
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --mine: #0f766e;
  --mine-soft: #ccfbf1;
  --running: #b45309;
  --running-soft: #fef3c7;
  --clear: #9ca3af;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(26, 28, 26, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --topbar-h: 64px;
  --bottom-nav-h: 64px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.view {
  display: none;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  flex-direction: column;
}

.view--active {
  display: flex;
}

/* Login */
.login {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
}

.login__brand {
  text-align: center;
  margin-bottom: 32px;
}

.login__icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 12px;
}

.login__brand h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  color: var(--primary);
}

.login__brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.login__form {
  display: grid;
  gap: 16px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
}

.field__password {
  position: relative;
  display: flex;
  align-items: center;
}

.field__password input {
  padding-right: 48px;
}

.field__password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.field__password-toggle .material-symbols-outlined {
  font-size: 22px;
}

.field__password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--secondary {
  background: var(--surface-dim);
  color: var(--text);
}

.btn--accept {
  background: var(--accent);
  color: #fff;
}

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn--danger-solid {
  background: var(--danger);
  color: #fff;
  border: none;
}

.btn--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn);
}

.btn--apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  background: #1b7a2f;
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(27, 122, 47, 0.28);
}

.btn--apply .material-symbols-outlined {
  font-size: 20px;
}

.btn--apply:active {
  background: #156528;
}

.btn--block {
  width: 100%;
}

.btn--small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--surface-dim);
  color: var(--text);
  cursor: pointer;
}

.install-btn.hidden {
  display: none !important;
}

.install-btn .material-symbols-outlined {
  font-size: 20px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.topbar__left {
  min-width: 0;
  flex: 1;
}

.topbar__title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__sub {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.topbar__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Main */
.main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(16px + var(--bottom-nav-h) + var(--safe-bottom));
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 50;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.bottom-nav__item .material-symbols-outlined {
  font-size: 22px;
  padding: 4px 18px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.bottom-nav__item.is-active {
  color: var(--primary);
  font-weight: 700;
}

.bottom-nav__item.is-active .material-symbols-outlined {
  background: var(--primary);
  color: #fff;
  font-variation-settings: "FILL" 1;
}

.bottom-nav__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 28px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Flash / toast */
.flash,
.toast {
  margin: 0 16px 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.flash--error,
.toast--error {
  background: var(--danger-soft);
  color: var(--danger);
}

.flash--success,
.toast--success {
  background: var(--primary-soft);
  color: var(--primary);
}

.flash--warn,
.toast--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.toast {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top) + 8px);
  left: 16px;
  right: 16px;
  z-index: 100;
  box-shadow: var(--shadow);
}

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.stat-pill strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
}

.stat-pill span {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-pill--mine strong {
  color: var(--mine);
}

.stat-pill--running strong {
  color: var(--running);
}

.stat-pill--new strong {
  color: var(--danger);
}

/* Filter chips */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Table grid — single column for clearer, roomier cards (one table per row) */
.table-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.table-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  color: inherit;
  min-height: 128px;
  overflow: visible;
  transition: border-color 0.15s ease;
}

.table-card__open {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.table-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.table-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.table-card__title-row h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-card__add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.table-card__add-btn .material-symbols-outlined {
  font-size: 20px;
}

.table-card__add-btn:active {
  transform: scale(0.95);
  background: var(--accent);
  color: #fff;
}

.table-card__head-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.table-card__count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-dim);
  color: var(--text-muted);
  white-space: nowrap;
}

.table-card__count--clear {
  background: var(--surface-dim);
  color: var(--clear);
}

.table-card__count--new {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-card__count--service {
  background: var(--warn-soft);
  color: var(--warn);
}

.table-card__count--mine {
  background: var(--mine-soft);
  color: var(--mine);
}

.table-card__more-wrap {
  position: relative;
}

.table-card__more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.table-card__more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 20;
  padding: 4px;
}

.table-card__more-menu[hidden] {
  display: none;
}

.table-card__more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
}

.table-card__more-item .material-symbols-outlined {
  font-size: 18px;
  color: var(--accent);
}

.table-card__more-item:active {
  background: var(--surface-dim);
}

.table-card__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.table-card__state {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.table-card__state--alert {
  color: var(--danger);
}

.table-card__state--accepted {
  color: var(--accent);
}

.table-card__latest {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.table-card__quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.table-card__accept-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.table-card__accept-btn .material-symbols-outlined {
  font-size: 18px;
}

.table-card--clear {
  opacity: 0.72;
  border-style: dashed;
}

.table-card--new {
  border-left: 4px solid var(--danger);
}

.table-card--alert {
  border-left: 4px solid var(--danger);
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.15);
}

.table-card__print-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-width: 0;
  width: 100%;
}

.table-card__print-row .btn {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  font-size: 0.75rem;
}

.table-card__print-row .material-symbols-outlined {
  font-size: 16px;
  flex-shrink: 0;
}

.table-card__booking {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.75rem;
  min-width: 0;
  width: 100%;
}

.table-card__booking span {
  color: var(--text-muted);
  font-weight: 600;
}

.table-card__booking select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  cursor: pointer;
}

.table-card__booking-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-dim);
  color: var(--text-muted);
}

.table-card__booking-badge.is-partner {
  background: var(--info-soft);
  color: var(--info);
}

.table-card__waiter-btn {
  margin-top: 10px;
}

.table-alert {
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--danger);
}

.detail-actions--wrap {
  flex-wrap: wrap;
}

.detail-actions--wrap .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.detail-actions--wrap .material-symbols-outlined {
  font-size: 18px;
}

.table-detail-booking {
  margin-bottom: 12px;
}

.status-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-order-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.status-order-block__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: none;
  background: var(--surface-dim);
  cursor: pointer;
  text-align: left;
}

.status-order-block__detail {
  padding: 12px;
}

.status-order-block__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.settle-panel__hint {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--primary);
}

.settle-panel__orders {
  margin-bottom: 14px;
}

.order-detail-actions__row--tools {
  grid-template-columns: 1fr;
}

.order-detail-actions__row--tools .btn {
  justify-content: center;
}

@media (min-width: 420px) {
  .order-detail-actions__row--tools {
    grid-template-columns: repeat(2, 1fr);
  }
}

.change-table-panel__order {
  margin: 0 0 12px;
  font-weight: 600;
}

.table-card--mine {
  border-color: var(--mine);
  background: linear-gradient(135deg, var(--mine-soft) 0%, var(--surface) 55%);
}

.table-card--running {
  border-color: var(--running);
  background: linear-gradient(135deg, var(--running-soft) 0%, var(--surface) 55%);
}

.table-card--new {
  border-color: var(--danger);
  animation: pulse-border 1.5s ease infinite;
}

.table-card--mine.table-card--new {
  border-color: var(--danger);
}

@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(186, 26, 26, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(186, 26, 26, 0);
  }
}

.table-card__num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.table-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--mine {
  background: var(--mine);
  color: #fff;
}

.badge--new {
  background: var(--danger);
  color: #fff;
}

.badge--running {
  background: var(--running-soft);
  color: var(--running);
}

.badge--clear {
  background: var(--surface-dim);
  color: var(--clear);
}

.table-card__status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.table-card__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.table-card__placed-by {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.table-card__placed-by strong {
  color: var(--mine);
}

.tables-hero-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 4px 0 8px;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}

@media (min-width: 380px) {
  .tables-hero-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tables-hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  box-shadow: var(--shadow);
}

/* Combined-invoice / Settle buttons: light grey so they stand out from the cream page bg. */
.tables-hero-actions .btn--secondary {
  background: #dfe0dc;
  border: 1px solid #c8c9c4;
  color: var(--text);
}

.tables-hero-actions .btn--secondary:active {
  background: #d2d3ce;
}

.tables-hero-actions .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

.tables-hero-actions #btn-new-manual-order {
  grid-column: 1 / -1;
}

.table-picker-panel,
.combined-invoice-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

/* Invoice preview (shown before sending to the print agent) */
.invoice-preview {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.invoice-preview__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.invoice-preview__docs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invoice-preview__doc-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.invoice-preview__doc-title {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-dim);
  border-bottom: 1px solid var(--border);
}

.invoice-preview__doc {
  margin: 0;
  padding: 12px;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: #fff;
}

.invoice-preview__footer {
  flex-shrink: 0;
  margin: 0 -16px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  z-index: 3;
}

.table-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.table-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.table-picker-row strong {
  font-size: 0.95rem;
  color: var(--primary);
}

.table-picker-row span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.combined-invoice-orders {
  min-height: 120px;
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.combined-invoice-orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 36vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.combined-invoice-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
  cursor: pointer;
}

.combined-invoice-row.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.combined-invoice-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

.combined-invoice-row__body {
  flex: 1;
  min-width: 0;
}

.combined-invoice-row__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}

.combined-invoice-row__meta {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.combined-invoice-row__items {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.35;
}

.combined-invoice-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.combined-invoice-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(21, 66, 18, 0.12);
}

.combined-invoice-card__select {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.combined-invoice-card__select input {
  margin-top: 3px;
  flex-shrink: 0;
}

.combined-invoice-card__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  font-size: 0.9rem;
}

.combined-invoice-card__items {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.combined-invoice-card__money {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.combined-invoice-card__money strong {
  color: var(--primary);
  margin-left: auto;
}

.combined-invoice-card__disc {
  color: var(--danger);
  font-weight: 600;
}

.combined-discount-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 8px;
}

.combined-discount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.combined-discount-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.combined-discount-chip__remove {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.combined-discount-chip--applied {
  background: #1b7a2f;
  color: #fff;
  margin-top: 8px;
}

.combined-bulk-selected:not([hidden]) {
  display: block;
}

select[data-bulk-coupon].is-applied {
  border-color: #1b7a2f;
  background: #e8f6ec;
  font-weight: 600;
  color: #156528;
}

.combined-bulk-discount {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
  border: 1px solid var(--border);
}

.combined-bulk-discount [data-bulk-apply] {
  margin-top: 4px;
}

.combined-bulk-discount__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.combined-invoice-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.combined-invoice-summary--stack {
  display: grid;
  gap: 6px;
}

.combined-invoice-summary--stack > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

.combined-invoice-summary__net {
  font-size: 1rem !important;
  padding-top: 4px;
  border-top: 1px solid rgba(21, 66, 18, 0.15);
}

.combined-invoice-panel .accept-panel__footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding-top: 8px;
}

.edit-invoice-panel__hint {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--primary);
}

.edit-invoice-panel__items {
  margin: 12px 0;
}

.edit-invoice-panel__total {
  display: flex;
  justify-content: space-between;
  margin: 12px 0 16px;
  font-weight: 600;
}

.viewer-note {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.82rem;
  line-height: 1.45;
}

.viewer-note--waiter {
  background: rgba(21, 66, 18, 0.08);
  color: var(--primary);
}

.waiter-call-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fdecea;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 600;
}

.waiter-call-banner .material-symbols-outlined {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.waiter-call-banner__body {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.waiter-call-banner__body > span {
  flex: 1;
  min-width: 140px;
  line-height: 1.3;
}

.table-card__service-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
  width: 100%;
}

.table-card__service-actions .btn {
  min-width: 0;
  width: 100%;
  white-space: normal;
  line-height: 1.2;
  font-size: 0.78rem;
}

.table-service-attend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}

.calls-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--primary);
}

.calls-subtitle {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.calls-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.calls-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.call-card--waiter {
  border-color: rgba(186, 26, 26, 0.35);
}

.call-card--bill {
  border-color: rgba(180, 83, 9, 0.35);
}

.call-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.call-card__head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--primary);
}

.call-card__head p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.call-card__badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
}

.call-card__badge--bill {
  background: var(--warn-soft);
  color: var(--warn);
}

.call-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.call-card__actions .btn {
  min-width: 0;
  width: 100%;
}

.order-card__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.order-card__flag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.order-card--bill {
  border-color: #f59e0b;
}

/* Table detail */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary);
  flex: 1;
}

.detail-header .table-card__add-btn {
  flex-shrink: 0;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-orders-intro {
  margin-bottom: 12px;
}

.table-orders-intro h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--text);
}

.section-hint {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
}

.breadcrumb__link {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.breadcrumb__sep {
  color: var(--text-muted);
}

.breadcrumb__current {
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-detail-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.order-detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.order-detail-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.order-detail-hero__top h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary);
}

.order-detail-hero__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.order-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.order-detail-actions__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.order-detail-actions__row .btn {
  min-height: 44px;
}

.order-detail-actions__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.status-pill--preparing {
  border-color: var(--warn);
  color: var(--warn);
}

.status-pill--ready {
  border-color: var(--info);
  color: var(--info);
}

.status-pill--served {
  border-color: var(--primary);
  color: var(--primary);
}

.status-pill--paid {
  border-color: var(--clear);
  color: var(--text-muted);
}

.status-pill--cancelled {
  border-color: var(--danger);
  color: var(--danger);
}

.order-detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.order-detail-section h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--primary);
}

.order-detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.order-detail-meta > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-detail-meta span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.order-detail-meta strong {
  font-size: 0.88rem;
  word-break: break-word;
}

.order-detail-meta--wide {
  grid-column: 1 / -1;
}

.order-detail-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-detail-item {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.order-detail-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.order-detail-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.order-detail-item__name {
  font-weight: 600;
  font-size: 0.9rem;
}

.order-detail-item__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.order-detail-item__note {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--warn);
  font-style: italic;
}

.order-detail-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.order-detail-total strong {
  font-size: 1.05rem;
  color: var(--primary);
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.order-card--mine {
  border-left: 4px solid var(--mine);
}

.order-card--pending {
  border-left: 4px solid var(--danger);
}

.order-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.order-card__id {
  font-weight: 700;
  font-size: 0.95rem;
}

.order-card__status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-dim);
}

.order-card__status--pending {
  background: var(--danger-soft);
  color: var(--danger);
}

.order-card__status--preparing {
  background: var(--warn-soft);
  color: var(--warn);
}

.order-card__status--ready {
  background: var(--info-soft);
  color: var(--info);
}

.order-card__status--served {
  background: var(--primary-soft);
  color: var(--primary);
}

.order-card__placed {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.order-card__items {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.order-card--tap {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.order-card--tap:active {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(21, 66, 18, 0.12);
}

.order-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.order-card__view-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

.order-card__view-hint .material-symbols-outlined {
  font-size: 18px;
}

.order-card__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.order-card__footer .order-card__actions {
  margin-top: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .material-symbols-outlined {
  font-size: 48px;
  color: var(--clear);
  margin-bottom: 12px;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
}

/* Pending list */
.pending-list .order-card {
  border-left-width: 4px;
}

/* Manual order */
.manual-order {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.manual-order__toolbar {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.manual-order__search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.manual-order__cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.manual-order__cats::-webkit-scrollbar {
  display: none;
}

.manual-order__items {
  flex: 1;
  overflow: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.menu-item__info {
  flex: 1;
  min-width: 0;
}

.menu-item__name {
  font-weight: 600;
  font-size: 0.9rem;
}

.menu-item__price {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.menu-item__qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-item__qty button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
}

.menu-item__qty span {
  min-width: 20px;
  text-align: center;
  font-weight: 700;
}

.manual-order__footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

.manual-order__summary {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

/* Sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.sheet__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sheet__header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 1rem;
}

.sheet__header-spacer {
  width: 40px;
}

.sheet__body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.sheet__panel--tall {
  max-height: 96vh;
}

.sheet__body--flex {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Accept orders panel */
.accept-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.accept-panel__msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.accept-panel__select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.accept-panel__count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-dim);
  color: var(--text-muted);
}

.accept-panel__count.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.accept-panel__orders {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.accept-order-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  align-items: flex-start;
}

.accept-order-wrap {
  margin-bottom: 10px;
}

.accept-order-row__expand {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.accept-order-row__expand .material-symbols-outlined {
  font-size: 22px;
  transition: transform 0.15s;
}

.accept-order-row__expand .material-symbols-outlined.is-open {
  transform: rotate(180deg);
}

.accept-order-detail {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
}

.accept-order-items {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.accept-order-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.accept-order-item:last-child {
  border-bottom: none;
}

.accept-order-item__name {
  flex: 1;
  min-width: 0;
}

.accept-order-item__note {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--warn);
  font-style: italic;
}

.accept-order-item__qty {
  flex-shrink: 0;
}

.accept-order-detail__note {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.accept-order-detail__actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

/* Cancel / reject sheet */
.cancel-panel__order {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--primary);
}

.cancel-panel__hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.cancel-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cancel-panel__chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}

.cancel-panel__footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.field textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
}

.accept-order-row.is-selected {
  border-color: var(--accent);
  background: var(--primary-soft);
}

.accept-order-row input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.accept-order-row__body {
  flex: 1;
  min-width: 0;
}

.accept-order-row__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.accept-order-row__head strong {
  font-size: 0.95rem;
}

.accept-order-row__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.accept-order-row__items {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.accept-panel__footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* FAB */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(21, 66, 18, 0.35);
  cursor: pointer;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab .material-symbols-outlined {
  font-size: 28px;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend__dot--mine {
  background: var(--mine);
}

.legend__dot--running {
  background: var(--running);
}

.legend__dot--new {
  background: var(--danger);
}

.legend__dot--clear {
  background: var(--clear);
}
