:root {
  color-scheme: dark;
  --ink: #f6eee5;
  --muted: #b9aa9e;
  --paper: #1b1715;
  --surface: #28211e;
  --surface-strong: #312824;
  --line: #4d3f39;
  --red: #c84734;
  --red-dark: #f07a64;
  --red-soft: #4a2924;
  --gold: #e1aa4a;
  --gold-soft: #4a371e;
  --green: #4caf7d;
  --green-soft: #203d31;
  --blue: #66a9d7;
  --blue-soft: #243e50;
  --orange: #d47732;
  --orange-soft: #4b2f20;
  --danger: #f07777;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.25);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(216, 151, 49, 0.17), transparent 26rem),
    var(--paper);
  overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(185, 54, 36, 0.12);
}

textarea {
  resize: vertical;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 6vw, 2rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
}

h3 {
  margin-bottom: 7px;
  font-size: 1.05rem;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.login-card {
  width: min(100%, 430px);
  padding: 30px 24px 26px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(18px);
}

.login-logo {
  margin-bottom: 15px;
  border-radius: 21px;
  box-shadow: 0 8px 24px rgba(185, 54, 36, 0.2);
}

.login-card h1 {
  margin-bottom: 10px;
  font-size: 2.2rem;
}

.login-copy {
  margin: 0 auto 24px;
  max-width: 310px;
  color: var(--muted);
  line-height: 1.45;
}

.login-form,
.stack-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.service-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.service-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.service-toolbar input,
.service-toolbar select,
.service-toolbar button {
  min-height: 42px;
}

.saga-service-panel {
  margin-bottom: 9px;
  border: 1px solid #385e4b;
  border-radius: 16px;
  padding: 9px;
  background: #1e3029;
}

.saga-service-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.saga-service-heading .eyebrow {
  margin-bottom: 1px;
  font-size: 0.56rem;
}

.saga-service-heading h3 {
  margin: 0;
  font-size: 0.84rem;
}

.saga-service-heading .text-button {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 0.7rem;
}

.service-driver-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 6px;
}

.service-driver-stat {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 8px;
  background: var(--surface-strong);
}

.service-driver-stat strong {
  font-size: 0.82rem;
}

.service-driver-stat span,
.service-driver-stat small {
  color: var(--muted);
  font-size: 0.63rem;
}

.history-date-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.history-date-controls > * {
  width: auto;
  min-height: 42px;
}

.service-dialog-copy {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.service-driver-options {
  display: grid;
  gap: 7px;
  max-height: min(55vh, 430px);
  overflow-y: auto;
}

.service-driver-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  background: var(--surface-strong);
}

.service-driver-option input {
  width: 22px;
  min-height: 22px;
}

.service-driver-option span {
  display: grid;
  gap: 2px;
}

.service-driver-option small {
  color: var(--muted);
}

.driver-assignment label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.driver-assignment small {
  color: var(--danger);
  font-size: 0.66rem;
  line-height: 1.35;
}

.driver-select {
  min-height: 40px;
  padding-block: 7px;
  font-size: 0.78rem;
  font-weight: 820;
}

.payment-adjustment,
.status-correction {
  display: grid;
  gap: 9px;
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: var(--surface-strong);
}

.payment-adjustment > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-adjustment span,
.status-correction label,
.status-correction small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.payment-adjustment strong {
  font-size: 1.15rem;
}

.payment-adjustment.is-due {
  border-color: #87512e;
  background: var(--orange-soft);
}

.payment-adjustment.is-refund {
  border-color: #765a2f;
  background: var(--gold-soft);
}

.payment-adjustment-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.status-correction select {
  min-height: 42px;
}

.danger-card {
  border-color: #70413f !important;
}

.danger-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.danger-button,
.danger-text {
  color: var(--danger);
  border-color: #70413f;
}

.danger-text {
  margin-top: 9px;
}

.pager-settings-fields,
.pager-fixed-settings {
  display: grid;
  gap: 10px;
}

.settings-mode-note {
  margin: 2px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.76rem;
  line-height: 1.35;
}

.login-form label,
.stack-form label,
.field-block {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.form-error {
  min-height: 1.2em;
  margin: 2px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: var(--red);
  box-shadow: 0 5px 14px rgba(185, 54, 36, 0.2);
}

.primary-button:active {
  background: var(--red-dark);
  transform: translateY(1px);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.text-button {
  color: var(--red);
  background: transparent;
}

.icon-button {
  min-width: 46px;
  padding: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 1.35rem;
}

.primary-button.large {
  min-height: 56px;
  font-size: 1rem;
}

.primary-button.small,
.secondary-button.small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.full-width {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 13px;
  border-bottom: 1px solid rgba(231, 222, 210, 0.8);
  background: rgba(246, 241, 232, 0.91);
  backdrop-filter: blur(20px) saturate(1.2);
}

.app-header h1 {
  overflow: hidden;
  max-width: 58vw;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header > div:first-child,
.driver-header > div:first-child {
  min-width: 0;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.profile-switch-button {
  min-height: 28px;
  border: 0;
  border-radius: 9px;
  padding: 4px 7px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 820;
  white-space: nowrap;
  cursor: pointer;
}

.profile-switch-button:active {
  color: var(--ink);
  background: var(--surface-strong);
}

.hub-back-button {
  min-height: 28px;
  margin: 0 0 4px -4px;
  border: 0;
  border-radius: 9px;
  padding: 3px 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 820;
  cursor: pointer;
}

.hub-back-button:active {
  color: var(--ink);
  background: var(--surface-strong);
}

.connection-chip {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--surface);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.connection-chip.is-online .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(38, 112, 79, 0.12);
}

.connection-chip.is-offline {
  color: var(--danger);
  border-color: #e8c2c2;
  background: #fff3f3;
}

.connection-chip.is-offline .connection-dot {
  background: var(--danger);
}

.main-content {
  width: min(100%, 1260px);
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 20px 15px calc(150px + var(--safe-bottom));
}

.app-view {
  animation: view-in 160ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.compact-heading {
  margin-bottom: 13px;
}

.sync-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
  border: 1px solid #e7c97c;
  border-radius: var(--radius-md);
  padding: 11px 13px;
  background: var(--gold-soft);
}

.edit-banner div {
  display: grid;
  gap: 2px;
}

.edit-banner span {
  color: #765d2a;
  font-size: 0.76rem;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin: 0 -15px 15px;
  padding: 0 15px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-button {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 800;
}

.category-button.is-active {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

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

.menu-card {
  position: relative;
  display: flex;
  min-height: 116px;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  text-align: left;
  cursor: pointer;
}

.menu-card::after {
  position: absolute;
  inset: auto -18px -22px auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft, var(--red-soft));
  content: "";
}

.menu-card:active {
  border-color: var(--red);
  transform: scale(0.985);
}

.menu-card.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(185, 54, 36, 0.11), var(--shadow-soft);
}

.menu-card:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.menu-card.is-sold-out {
  border-color: #d7aaa3;
  background: #f4ece9;
}

.menu-card.is-stock-limit:not(.is-sold-out) {
  border-color: #dfc784;
}

.menu-card-name {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.15;
}

.menu-card-stock {
  position: relative;
  z-index: 1;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 7px;
  color: #285f45;
  background: var(--green-soft);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
}

.menu-card-stock.is-empty {
  color: #8d281b;
  background: var(--red-soft);
}

.menu-card-stock.is-untracked {
  color: var(--muted);
  background: #eee9e2;
}

.menu-card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menu-card-price {
  color: var(--red-dark);
  font-weight: 900;
}

.menu-card-qty {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 0.82rem;
  font-weight: 900;
}

.empty-state {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 210px;
  border: 1px dashed #cfc1b2;
  border-radius: var(--radius-xl);
  color: var(--muted);
  text-align: center;
}

.cart-bar {
  position: fixed;
  z-index: 45;
  right: 12px;
  bottom: calc(76px + var(--safe-bottom));
  left: 12px;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 17px;
  padding: 11px 16px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 30px rgba(39, 32, 28, 0.3);
  cursor: pointer;
}

.cart-bar-action {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.cart-bar-action strong {
  font-size: 1.05rem;
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(66px + var(--safe-bottom));
  padding: 7px 5px var(--safe-bottom);
  border-top: 1px solid rgba(231, 222, 210, 0.9);
  background: rgba(255, 253, 250, 0.96);
  backdrop-filter: blur(20px);
}

.nav-item {
  position: relative;
  display: grid;
  min-height: 52px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: 0.62rem;
  font-weight: 760;
}

.nav-item > span:first-child {
  font-size: 1.23rem;
  font-weight: 700;
  line-height: 1;
}

.nav-item.is-active {
  color: var(--red);
  background: var(--red-soft);
}

.nav-badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 8px);
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  padding: 0 4px;
  color: #fff;
  background: var(--red);
  font-size: 0.65rem;
}

.summary-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.summary-chip {
  min-width: 104px;
  flex: 1 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--surface);
}

.summary-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.summary-chip strong {
  font-size: 1.25rem;
}

#view-kitchen .summary-chips {
  gap: 5px;
  margin-bottom: 8px;
}

#view-kitchen .summary-chip {
  min-width: 92px;
  padding: 6px 8px;
}

#view-kitchen .summary-chip span {
  font-size: 0.62rem;
}

#view-kitchen .summary-chip strong {
  font-size: 1rem;
}

.kitchen-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.kitchen-board.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.kitchen-board.is-single .kanban-list {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.kitchen-completed {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background: var(--surface);
}

.kitchen-completed-heading,
.kitchen-completed-row,
.kitchen-completed-identity,
.kitchen-completed-meta {
  display: flex;
  align-items: center;
}

.kitchen-completed-heading {
  justify-content: space-between;
  gap: 8px;
  padding: 1px 2px 7px;
}

.kitchen-completed-heading .eyebrow {
  margin-bottom: 1px;
  font-size: 0.56rem;
}

.kitchen-completed-heading h3 {
  margin: 0;
  font-size: 0.8rem;
}

.kitchen-completed-heading h3 span {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  margin-left: 4px;
  place-items: center;
  border-radius: 999px;
  background: var(--line);
  font-size: 0.68rem;
}

.kitchen-completed-heading .text-button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 5px 8px;
  font-size: 0.68rem;
}

.kitchen-completed-list {
  display: grid;
  gap: 4px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.kitchen-completed-row {
  width: 100%;
  min-height: 46px;
  justify-content: space-between;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 7px;
  color: var(--ink);
  background: var(--surface-strong);
  text-align: left;
}

.kitchen-completed-identity {
  flex: 0 0 auto;
  gap: 5px;
  font-size: 0.72rem;
}

.kitchen-completed-row .pager-badge {
  min-height: 22px;
}

.kitchen-completed-items {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kitchen-completed-meta {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  color: var(--muted);
  font-size: 0.62rem;
}

.kitchen-completed-meta strong {
  color: var(--green);
  font-size: 0.66rem;
}

.kitchen-completed-note {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 0.62rem;
}

.kanban-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  background: rgba(255, 253, 250, 0.62);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding: 1px 2px;
}

.kanban-header h3 {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kanban-count {
  display: grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 999px;
  background: var(--line);
  font-size: 0.68rem;
  font-weight: 900;
}

.kanban-list {
  display: grid;
  gap: 6px;
}

.order-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--status-color, var(--gold));
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.order-card-main {
  width: 100%;
  border: 0;
  padding: 8px 7px 6px;
  background: transparent;
  text-align: left;
}

.order-card-top,
.order-meta,
.order-card-actions,
.history-row-top,
.admin-row,
.settings-card-header,
.checkout-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.order-identifiers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-badge {
  display: inline-flex;
  min-width: 0;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 5px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.025em;
}

.order-number {
  display: inline-grid;
  flex: 0 0 auto;
  gap: 0;
  color: var(--muted);
  line-height: 1;
}

.order-number small {
  font-size: 0.47rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.order-number strong {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.order-time {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
}

.order-items-preview {
  display: grid;
  gap: 1px;
  margin: 6px 0 5px;
  font-size: 0.76rem;
  line-height: 1.18;
}

.order-items-preview span {
  display: block;
}

.order-items-preview small {
  color: var(--muted);
  font-size: 0.66rem;
}

.order-note-preview {
  margin: 0 0 5px;
  border-radius: 7px;
  padding: 4px 6px;
  color: #65481c;
  background: var(--gold-soft);
  font-size: 0.68rem;
  line-height: 1.2;
}

.order-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.payment-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.68rem;
  font-weight: 850;
}

.payment-badge.card { color: #285575; background: var(--blue-soft); }
.payment-badge.cash { color: #225c42; background: var(--green-soft); }
.payment-badge.needs-adjustment { color: #7e4217; background: var(--orange-soft); }

.order-card-actions {
  border-top: 1px solid var(--line);
  padding: 5px;
}

.order-action {
  min-height: 36px;
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 6px 7px;
  color: #fff;
  background: var(--status-color, var(--red));
  font-size: 0.72rem;
  font-weight: 850;
}

.order-action.secondary {
  flex: 0 0 auto;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

.column-empty {
  padding: 24px 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.stock-intro {
  margin: -5px 0 13px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.stock-list,
.stock-category-list {
  display: grid;
  gap: 8px;
}

.stock-category + .stock-category {
  margin-top: 18px;
}

.stock-category > h3 {
  margin: 0 0 7px 2px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stock-row {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.stock-row.is-empty {
  border-color: #dfb1aa;
  background: #fff9f7;
}

.stock-row.is-busy {
  opacity: 0.68;
}

.stock-pool-row {
  border-color: #d8bd76;
  background: #fffaf0;
}

.stock-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 9px;
}

.stock-row-heading div {
  min-width: 0;
}

.stock-row-heading strong,
.stock-row-heading span {
  display: block;
}

.stock-row-heading strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-row-heading div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.stock-state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  color: #285f45;
  background: var(--green-soft);
  font-size: 0.67rem;
  font-weight: 850;
}

.stock-state.is-empty {
  color: #8d281b;
  background: var(--red-soft);
}

.stock-state.is-untracked {
  color: var(--muted);
  background: #eee9e2;
}

.stock-search-bar {
  display: grid;
  gap: 6px;
  margin: 13px 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.stock-search-bar label {
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 820;
}

.stock-search-bar input {
  min-height: 44px;
}

.stock-search-empty {
  margin-top: 4px;
}

.stock-controls {
  display: grid;
  grid-template-columns: 44px minmax(64px, 88px) 44px minmax(88px, 1fr);
  gap: 7px;
}

.stock-controls button,
.stock-controls input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  text-align: center;
}

.stock-controls button {
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 900;
}

.stock-controls .stock-toggle {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.1;
}

.stock-availability-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: var(--surface);
}

.stock-availability-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.stock-availability-copy strong {
  font-size: 0.79rem;
}

.stock-availability-copy span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.stock-availability-toggle {
  min-height: 40px;
  border: 1px solid #70413f;
  border-radius: 10px;
  padding: 7px 10px;
  color: #ffb6ad;
  background: #3b2322;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.stock-availability-toggle.is-restore {
  color: #a7e4c5;
  border-color: #365f4b;
  background: #203d31;
}

.stock-row.is-manually-unavailable {
  border-color: #70413f;
  opacity: 0.82;
}

.cart-line-stock {
  margin-top: 3px;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 750;
}

.cart-line-stock.is-low {
  color: var(--danger);
}

.date-control {
  width: auto;
  min-height: 42px;
  padding: 8px 10px;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 13px;
}

.history-stat {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: var(--surface);
}

.history-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.history-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1.15rem;
}

.history-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 13px;
}

.history-list {
  display: grid;
  gap: 9px;
}

.history-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.history-row p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.history-total {
  font-weight: 900;
}

.settings-grid {
  display: grid;
  gap: 13px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.settings-card-header {
  align-items: flex-start;
  margin-bottom: 12px;
}

.settings-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-list {
  display: grid;
  gap: 7px;
}

.admin-row {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
}

.admin-row.is-inactive {
  opacity: 0.55;
}

.admin-row-main {
  min-width: 0;
}

.admin-row-main strong,
.admin-row-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-main span {
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-edit-button {
  min-width: 42px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 850;
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(29, 23, 20, 0.48);
  backdrop-filter: blur(4px);
}

.sheet-dialog {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 650px);
  max-width: none;
  max-height: min(89vh, 900px);
  margin: auto;
  overflow: auto;
  border: 0;
  border-radius: 25px 25px 0 0;
  padding: 8px 16px calc(20px + var(--safe-bottom));
  background: var(--surface);
  box-shadow: 0 -15px 45px rgba(39, 32, 28, 0.18);
}

.sheet-dialog[open] {
  animation: sheet-up 180ms ease-out;
}

@keyframes sheet-up {
  from { opacity: 0.6; transform: translateY(35px); }
  to { opacity: 1; transform: translateY(0); }
}

.compact-dialog {
  max-height: 78vh;
}

.sheet-handle-row {
  display: flex;
  min-height: 35px;
  justify-content: flex-end;
}

.sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #eee8df;
  font-size: 1.35rem;
  line-height: 1;
}

.dialog-heading {
  margin-bottom: 15px;
}

.cart-lines {
  display: grid;
  gap: 9px;
  margin-bottom: 13px;
}

.cart-line {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: #fff;
}

.cart-line-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
}

.cart-line-name {
  font-weight: 850;
}

.cart-line-details {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.35;
}

.cart-line-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: 10px;
}

.quantity-control {
  display: grid;
  grid-template-columns: 40px 38px 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  text-align: center;
}

.quantity-control button {
  min-height: 40px;
  border: 0;
  background: #f5f0e9;
  font-size: 1.2rem;
  font-weight: 850;
}

.quantity-control strong {
  font-size: 0.9rem;
}

.line-options-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--red);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 850;
}

.edit-add-items {
  width: 100%;
  min-height: 48px;
  margin: 4px 0 14px;
  border: 1px solid #765a2f;
  border-radius: 12px;
  padding: 10px 12px;
  color: #f0cf89;
  background: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.dialog-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 1.05rem;
}

.dialog-total strong {
  color: var(--red-dark);
  font-size: 1.55rem;
}

.edit-payment-preview {
  display: grid;
  gap: 9px;
  margin: -3px 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px;
  background: var(--surface);
}

.edit-payment-row,
.edit-payment-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edit-payment-row {
  color: var(--muted);
  font-size: 0.78rem;
}

.edit-payment-main {
  border-radius: 11px;
  padding: 11px;
  background: var(--gold-soft);
  font-weight: 900;
}

.edit-payment-main strong {
  font-size: 1.35rem;
}

.edit-payment-main.is-refund {
  color: #ffb6ad;
  background: #3b2322;
}

.edit-payment-main.is-settled {
  color: #a7e4c5;
  background: var(--green-soft);
}

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

.extra-option {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 750;
}

.extra-option input {
  width: 22px;
  min-height: 22px;
  flex: 0 0 22px;
  margin: 0;
}

.extra-option span {
  display: grid;
  gap: 2px;
}

.extra-option small {
  color: var(--muted);
}

.checkout-total-block {
  margin: 5px 0 17px;
  border-radius: 18px;
  padding: 17px;
  color: #fff;
  background: var(--ink);
  text-align: center;
}

.checkout-total-block > span {
  display: block;
  margin-bottom: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.checkout-total-block > strong {
  font-size: 2.05rem;
}

.checkout-edit-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 11px;
}

.checkout-edit-totals span {
  display: grid;
  gap: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 750;
}

.checkout-edit-totals strong {
  color: #fff;
  font-size: 0.95rem;
}

.checkout-section {
  margin-top: 17px;
}

.checkout-section h3 {
  margin-bottom: 7px;
}

.checkout-label-row span,
.checkout-instruction {
  color: var(--muted);
  font-size: 0.77rem;
}

.pager-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.pager-button {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 0.86rem;
  font-weight: 900;
}

.pager-button.is-selected {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.pager-button.is-used {
  color: #a19991;
  background: #eee9e2;
  text-decoration: line-through;
}

.payment-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.payment-button {
  display: grid;
  min-height: 78px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  border-radius: 15px;
  color: #fff;
}

.payment-button span {
  font-size: 1.35rem;
}

.payment-button.card { background: var(--blue); }
.payment-button.cash { background: var(--green); }

.center-dialog {
  width: min(calc(100% - 32px), 420px);
  border: 0;
  border-radius: 26px;
  padding: 25px 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.success-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 1.8rem;
  font-weight: 900;
}

.success-order {
  display: grid;
  min-width: min(250px, 100%);
  gap: 1px;
  margin: 0 auto 10px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 12px 20px;
  color: var(--ink);
  background: var(--gold-soft);
}

.success-order span {
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.success-order strong {
  font-size: 2.25rem;
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1;
}

.success-pager {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface);
}

.success-pager span {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.success-pager strong {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
}

.success-dialog p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.85rem;
}

.order-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.order-detail-header h2 {
  margin: 2px 0 0;
}

.order-detail-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.order-detail-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.order-detail-line small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.order-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: calc(15px + env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 480px;
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 760;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  background: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 700px) {
  .main-content {
    padding-right: 22px;
    padding-left: 22px;
  }

  .menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kitchen-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .stock-category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .history-tools {
    grid-template-columns: minmax(0, 1fr) 220px;
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .menu-management {
    grid-row: span 2;
  }

  .cart-bar {
    right: 22px;
    left: auto;
    width: 430px;
  }
}

@media (min-width: 1050px) {
  .menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app-header {
    padding-right: max(30px, calc((100vw - 1260px) / 2));
    padding-left: max(30px, calc((100vw - 1260px) / 2));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.session-member {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.fulfillment-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 9px 8px 13px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.fulfillment-selector > span {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 800;
}

.fulfillment-selector > div {
  display: flex;
  gap: 5px;
}

.fulfillment-selector button {
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  padding: 7px 13px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 850;
}

.fulfillment-selector button.is-active {
  color: #fff;
  background: var(--red);
  box-shadow: 0 4px 12px rgba(185, 54, 36, 0.2);
}

.delivery-fields {
  display: grid;
  gap: 7px;
  margin: 15px 0;
  border: 1px solid #cddfd5;
  border-radius: 16px;
  padding: 14px;
  background: #f2faf6;
}

.delivery-heading {
  margin-bottom: 2px;
}

.delivery-heading h3 {
  margin: 0;
}

.delivery-ticket-note {
  margin: 2px 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.field-help {
  margin: -2px 0 5px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.payment-button.collect {
  grid-column: 1 / -1;
  min-height: 62px;
  background: var(--orange);
}

.pager-badge.is-delivery {
  color: var(--blue);
  border-color: #3d6982;
  background: var(--blue-soft);
}

.delivery-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.69rem;
}

.delivery-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card .delivery-summary {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.order-card .delivery-summary strong {
  overflow: visible;
  white-space: normal;
}

.delivery-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #eee9e2;
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.delivery-status.is-assigned { color: var(--blue); background: var(--blue-soft); }
.delivery-status.is-driving { color: var(--orange); background: var(--orange-soft); }
.delivery-status.is-delivered { color: var(--green); background: var(--green-soft); }
.delivery-status.is-unassigned { color: var(--danger); background: var(--red-soft); }

.driver-assignment {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fbf8f3;
}

.order-card > .driver-assignment {
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
  padding: 7px 8px;
  background: #fbf8f3;
}

.driver-assignment > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.driver-picker {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.driver-picker::-webkit-scrollbar {
  display: none;
}

.driver-choice {
  flex: 0 0 auto;
  min-height: 37px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: #fff;
  font-size: 0.74rem;
  font-weight: 830;
  white-space: nowrap;
}

.driver-choice.is-selected {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.driver-choice.is-snapshot {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  border-style: dashed;
  background: #f5f1eb;
}

.delivery-card-hint {
  display: block;
  width: 100%;
  padding: 7px 5px;
  color: var(--blue);
  font-size: 0.67rem;
  font-weight: 820;
  text-align: center;
}

.delivery-operations {
  display: grid;
  gap: 9px;
  margin: 11px 0;
  border: 1px solid #e9ba8e;
  border-radius: 15px;
  padding: 12px;
  background: var(--orange-soft);
}

.delivery-operations > div:first-child {
  display: grid;
  gap: 2px;
}

.delivery-operations > div:first-child span {
  color: #785235;
  font-size: 0.75rem;
}

.delivery-operations .driver-primary-action {
  min-height: 50px;
  border-radius: 12px;
}

.delivery-operations .driver-primary-action.is-cash {
  background: var(--green);
}

.delivery-operations .driver-primary-action.is-card {
  background: var(--blue);
}

.order-card > .delivery-operations {
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
  padding: 7px 8px;
}

.order-card > .delivery-operations > div:first-child strong {
  font-size: 0.72rem;
}

.order-card > .delivery-operations .driver-primary-action {
  min-height: 42px;
  font-size: 0.78rem;
}

.order-card-actions:empty {
  display: none;
}

.history-delivery {
  color: var(--blue) !important;
  font-size: 0.75rem !important;
}

.history-customer {
  color: var(--green) !important;
  font-size: 0.75rem !important;
}

.counter-customer-card {
  display: grid;
  gap: 2px;
  margin: 11px 0;
  border: 1px solid #cddfd5;
  border-radius: 14px;
  padding: 11px 12px;
  background: #f2faf6;
}

.counter-customer-card span,
.counter-customer-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.delivery-customer-card {
  display: grid;
  gap: 11px;
  margin: 12px 0;
  border: 1px solid #cddfd5;
  border-radius: 17px;
  padding: 14px;
  background: #f2faf6;
}

.delivery-customer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.delivery-customer-heading > div {
  display: grid;
  gap: 2px;
}

.delivery-customer-heading > div > span,
.delivery-customer-card dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.delivery-customer-card dl,
.delivery-print-sheet dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.delivery-customer-card dl > div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
}

.delivery-customer-card dd,
.delivery-print-sheet dd {
  margin: 0;
  white-space: pre-wrap;
}

.delivery-document-actions,
.driver-job-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.member-row .admin-row-main span {
  word-break: break-word;
}

.driver-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0, rgba(53, 107, 145, 0.16), transparent 24rem),
    var(--paper);
}

.driver-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(231, 222, 210, 0.9);
  padding: max(16px, env(safe-area-inset-top)) 16px 13px;
  background: rgba(255, 253, 250, 0.95);
  backdrop-filter: blur(18px);
}

.driver-header h1 {
  font-size: 1.65rem;
}

.driver-main {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 16px 13px calc(28px + var(--safe-bottom));
}

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

.driver-toolbar > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.driver-toolbar > div > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.driver-tabs {
  display: flex;
  gap: 6px;
  max-width: min(70vw, 520px);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.driver-tabs::-webkit-scrollbar {
  display: none;
}

.driver-tab {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 850;
}

.driver-tab.is-active {
  color: #101820;
  border-color: var(--blue);
  background: var(--blue);
}

.driver-tabs-empty {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.driver-jobs {
  display: grid;
  gap: 13px;
}

.driver-job {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.driver-job.is-driving {
  border-color: #e9ba8e;
  box-shadow: 0 8px 25px rgba(173, 90, 32, 0.12);
}

.driver-job-header,
.driver-customer,
.driver-order-items {
  padding: 15px 16px;
}

.driver-job-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.driver-job-header h2 {
  font-size: 1.28rem;
}

.driver-customer {
  display: grid;
  gap: 7px;
  border-bottom: 1px solid var(--line);
}

.driver-customer > strong {
  font-size: 1.2rem;
}

.driver-customer address {
  color: var(--ink);
  font-size: 1rem;
  font-style: normal;
  font-weight: 780;
  line-height: 1.35;
  white-space: pre-wrap;
}

.driver-customer span,
.driver-customer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.driver-order-items h3 {
  margin-bottom: 9px;
}

.driver-order-items ul,
.delivery-print-sheet ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.driver-order-items li,
.delivery-print-sheet li {
  display: grid;
  gap: 2px;
}

.driver-order-items li span,
.delivery-print-sheet li span {
  color: var(--muted);
  font-size: 0.84rem;
}

.driver-order-note {
  margin: 12px 0 0;
  border-radius: 11px;
  padding: 9px 10px;
  background: var(--gold-soft);
  line-height: 1.4;
}

.driver-collect-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 13px;
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  background: var(--orange);
}

.driver-collect-amount span {
  font-weight: 780;
}

.driver-collect-amount strong {
  font-size: 1.35rem;
}

.driver-job-secondary-actions {
  padding: 0 16px 12px;
}

.driver-primary-action {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: var(--green);
  font-size: 1.1rem;
  font-weight: 900;
}

.driver-job.is-driving .driver-primary-action {
  background: var(--orange);
}

.driver-payment-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.driver-payment-actions .driver-primary-action {
  padding: 9px;
  font-size: 0.92rem;
}

.driver-job.is-driving .driver-primary-action.is-cash {
  background: var(--green);
}

.driver-job.is-driving .driver-primary-action.is-card {
  background: var(--blue);
}

.driver-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed #cfc4b7;
  border-radius: 22px;
  padding: 24px;
  color: var(--muted);
  background: rgba(255, 253, 250, 0.72);
  text-align: center;
}

.driver-empty strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.bottom-nav.has-customers {
  grid-template-columns: repeat(6, 1fr);
}

.bottom-nav.has-customers .nav-item {
  padding-inline: 2px;
  font-size: 0.58rem;
}

.customer-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.customer-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.customer-search-bar {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.customer-search-bar label,
.cart-customer-picker > label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.customer-list {
  display: grid;
  gap: 9px;
}

.customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.customer-row.is-inactive {
  opacity: 0.65;
}

.customer-row-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.customer-row-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.customer-row-main > strong,
.customer-row-heading > strong {
  font-size: 1rem;
}

.customer-phone {
  font-weight: 780;
}

.customer-address,
.customer-row-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row-actions {
  display: flex;
  gap: 6px;
}

.customer-row-actions button {
  min-height: 42px;
  padding-inline: 11px;
}

.consent-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--muted);
  background: #eee9e2;
  font-size: 0.64rem;
  font-weight: 850;
}

.consent-badge.is-opt_in {
  color: var(--green);
  background: var(--green-soft);
}

.consent-badge.is-opt_out {
  color: var(--danger);
  background: var(--red-soft);
}

.cart-customer-picker {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: #fbf8f3;
}

.cart-customer-results {
  display: grid;
  max-height: 210px;
  gap: 5px;
  overflow-y: auto;
}

.cart-customer-results button {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 10px;
  background: #fff;
  text-align: left;
}

.cart-customer-results button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-customer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #b6d8c5;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
}

.selected-customer > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.selected-customer span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-customer button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--danger);
  background: var(--red-soft);
  font-size: 0.72rem;
  font-weight: 820;
}

.customer-dialog {
  max-width: 620px;
}

.sms-consent-box {
  display: grid;
  gap: 8px;
  margin: 7px 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: #fbf8f3;
}

.sms-consent-box.is-opt_in {
  border-color: #b6d8c5;
  background: #f2faf6;
}

.sms-consent-box.is-opt_out {
  border-color: #e8c2c2;
  background: #fff5f5;
}

.sms-consent-box .extra-option {
  margin: 0;
}

.sms-consent-box small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.customer-order-history {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.customer-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.customer-history-heading h3 {
  margin: 0;
}

.customer-history-heading span {
  color: var(--muted);
  font-size: 0.74rem;
}

.customer-history-list {
  display: grid;
  gap: 7px;
}

.customer-history-list > div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.customer-history-list span,
.customer-history-list small {
  color: var(--muted);
  font-size: 0.73rem;
}

.driver-print-area {
  color: #111;
  background: #fff;
}

@media (max-width: 430px) {
  .app-header h1 {
    max-width: 47vw;
  }

  #view-stock .summary-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  #view-stock .summary-chip {
    min-width: 0;
  }

  .stock-availability-control {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .stock-availability-toggle {
    width: 100%;
  }

  .service-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  }

  .service-toolbar > button {
    grid-column: 1 / -1;
  }

  .history-date-controls {
    width: 100%;
    justify-content: stretch;
  }

  .history-date-controls > * {
    min-width: 0;
    flex: 1 1 130px;
  }

  .payment-adjustment-actions {
    grid-template-columns: 1fr;
  }

  .driver-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .driver-tabs {
    max-width: 100%;
  }

  .driver-toolbar > .secondary-button {
    align-self: flex-end;
    min-height: 38px;
  }

  .fulfillment-selector {
    align-items: stretch;
    flex-direction: column;
  }

  .fulfillment-selector > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .driver-header .connection-chip span:last-child {
    display: none;
  }

  .driver-header .connection-chip {
    min-width: 42px;
    padding-inline: 12px;
  }

  .customer-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-heading-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .customer-row {
    grid-template-columns: 1fr;
  }

  .customer-row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.bottom-nav.is-limited {
  grid-template-columns: repeat(2, 1fr);
}

@media screen {
  html,
  body {
    background-color: var(--paper);
  }

  input,
  select,
  textarea {
    color: var(--ink);
    border-color: var(--line);
    background: #241e1b;
  }

  input::placeholder,
  textarea::placeholder {
    color: #887a70;
    opacity: 1;
  }

  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(225, 170, 74, 0.18);
  }

  .login-card {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(40, 33, 30, 0.96);
  }

  .login-logo {
    box-shadow: 0 9px 26px rgba(213, 82, 62, 0.3);
  }

  .app-header,
  .driver-header {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(27, 23, 21, 0.94);
  }

  .bottom-nav {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(34, 28, 25, 0.97);
  }

  .connection-chip,
  .secondary-button,
  .icon-button,
  .admin-edit-button,
  .stock-controls button {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
  }

  .connection-chip.is-offline {
    color: #ffaaaa;
    border-color: #70413f;
    background: #3b2322;
  }

  .edit-banner {
    border-color: #765a2f;
    background: var(--gold-soft);
  }

  .edit-banner span,
  .order-note-preview,
  .delivery-operations > div:first-child span {
    color: #f0cf89;
  }

  .category-button,
  .fulfillment-selector,
  .summary-chip,
  .history-stat,
  .settings-card,
  .customer-search-bar {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
  }

  .menu-card.is-sold-out {
    border-color: #74443f;
    background: #392522;
  }

  .menu-card.is-stock-limit:not(.is-sold-out) {
    border-color: #7e6233;
  }

  .menu-card-stock,
  .stock-state {
    color: #9ee0bb;
  }

  .menu-card-stock.is-empty,
  .stock-state.is-empty {
    color: #ffaaa0;
  }

  .menu-card-stock.is-untracked,
  .stock-state.is-untracked,
  .delivery-status,
  .consent-badge,
  .pager-button.is-used {
    color: var(--muted);
    background: #3b322e;
  }

  .empty-state,
  .driver-empty {
    border-color: #5d4c43;
  }

  .cart-bar,
  .checkout-total-block {
    color: var(--ink);
    background: #12100f;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  }

  .success-pager,
  .pager-badge:not(.is-delivery) {
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface);
    box-shadow: none;
  }

  #view-kitchen .kanban-column.status-pending {
    border-color: #725328;
    background: #2c2116;
  }

  #view-kitchen .kanban-column.status-ready {
    border-color: #336a52;
    background: #182b24;
  }

  #view-kitchen .kanban-column.status-pending .kanban-header h3 {
    color: #f0c56d;
  }

  #view-kitchen .kanban-column.status-ready .kanban-header h3 {
    color: #83d2aa;
  }

  #view-kitchen .kanban-column.status-pending .order-card {
    --status-color: var(--gold) !important;
  }

  #view-kitchen .kanban-column.status-ready .order-card {
    --status-color: var(--green) !important;
  }

  #view-kitchen .kanban-column.status-pending .order-action {
    color: #21170a;
    background: var(--gold);
  }

  #view-kitchen .kanban-column.status-ready .order-action {
    color: #102019;
    background: var(--green);
  }

  .kanban-count {
    color: var(--ink);
    background: #463a34;
  }

  .kanban-column,
  .order-card,
  .kitchen-completed,
  .kitchen-completed-row,
  .stock-row,
  .history-row,
  .admin-row,
  .cart-line,
  .extra-option,
  .pager-button,
  .driver-choice,
  .customer-row,
  .cart-customer-results button,
  .selected-customer,
  .customer-history-list > div {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface-strong);
  }

  .order-card-main,
  .history-row {
    color: var(--ink);
  }

  .payment-badge.card {
    color: #b9ddf4;
  }

  .payment-badge.cash {
    color: #a8e1c0;
  }

  .payment-badge.needs-adjustment {
    color: #f3bd87;
  }

  .stock-row.is-empty {
    border-color: #74443f;
    background: #392522;
  }

  .stock-pool-row {
    border-color: #765a2f;
    background: #34291b;
  }

  dialog::backdrop {
    background: rgba(4, 3, 3, 0.72);
  }

  .sheet-dialog,
  .center-dialog {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 -18px 55px rgba(0, 0, 0, 0.5);
  }

  .sheet-close,
  .quantity-control button {
    color: var(--ink);
    background: #3a302c;
  }

  .line-options-button {
    color: #f08b78;
    border-color: var(--line);
    background: var(--surface-strong);
  }

  .dialog-total strong,
  .menu-card-price {
    color: #ff8e78;
  }

  .delivery-fields,
  .delivery-customer-card,
  .counter-customer-card {
    border-color: #385e4b;
    background: #1e3029;
  }

  .driver-assignment,
  .order-card > .driver-assignment,
  .cart-customer-picker,
  .sms-consent-box {
    background: #241f1c;
  }

  .driver-choice.is-selected,
  .pager-badge.is-delivery {
    color: #101820;
  }

  .driver-choice.is-snapshot {
    color: var(--muted);
    background: #352d29;
  }

  .delivery-operations {
    border-color: #7a4d2d;
    background: var(--orange-soft);
  }

  .delivery-status.is-assigned,
  .history-delivery {
    color: #9fd2f1 !important;
  }

  .delivery-status.is-driving {
    color: #f2af78;
  }

  .delivery-status.is-delivered,
  .history-customer {
    color: #9cdbb8 !important;
  }

  .delivery-status.is-unassigned {
    color: #ff9c96;
  }

  .driver-shell {
    background:
      radial-gradient(circle at 100% 0, rgba(102, 169, 215, 0.12), transparent 24rem),
      radial-gradient(circle at 0 42%, rgba(213, 82, 62, 0.08), transparent 26rem),
      var(--paper);
  }

  .driver-job {
    color: var(--ink);
    background: var(--surface-strong);
  }

  .driver-job.is-driving {
    border-color: #87512e;
    box-shadow: 0 9px 28px rgba(0, 0, 0, 0.3);
  }

  .driver-empty {
    background: rgba(40, 33, 30, 0.75);
  }

  .driver-primary-action,
  .payment-button.cash {
    color: #101b16;
  }

  .payment-button.card,
  .driver-primary-action.is-card,
  .driver-job.is-driving .driver-primary-action.is-card {
    color: #101820;
  }

  .sms-consent-box.is-opt_in {
    border-color: #38664f;
    background: #1e3029;
  }

  .sms-consent-box.is-opt_out {
    border-color: #70413f;
    background: #392322;
  }

  .selected-customer {
    border-color: #38664f;
  }

  .toast {
    color: var(--ink);
    background: #11100f;
  }

  .toast.is-error {
    color: #fff;
    background: #9d3636;
  }
}

@media print {
  @page {
    margin: 12mm;
    size: auto;
  }

  html {
    color-scheme: light;
    background: #fff !important;
  }

  body {
    min-height: 100vh;
    background: #fff !important;
  }

  body > * {
    display: none !important;
  }

  body > #driver-print-area {
    display: block !important;
  }

  .delivery-print-sheet {
    color-scheme: light;
    color: #111 !important;
    background: #fff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11pt;
  }

  .delivery-print-sheet h1,
  .delivery-print-sheet h2,
  .delivery-print-sheet p,
  .delivery-print-sheet strong,
  .delivery-print-sheet dd,
  .delivery-print-sheet li {
    color: #111 !important;
  }

  .delivery-print-sheet dt,
  .delivery-print-sheet li span {
    color: #444 !important;
  }

  .delivery-print-sheet h1 {
    margin: 3mm 0 5mm;
    font-size: 22pt;
  }

  .delivery-print-sheet h2 {
    margin: 7mm 0 3mm;
    border-bottom: 1px solid #555;
    padding-bottom: 2mm;
    font-size: 14pt;
  }

  .print-brand {
    margin: 0;
    font-size: 10pt;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .print-driver {
    margin-bottom: 5mm;
  }

  .delivery-print-sheet dl > div {
    display: grid;
    grid-template-columns: 28mm 1fr;
    gap: 3mm;
    border-bottom: 1px solid #ddd;
    padding: 2mm 0;
  }

  .delivery-print-sheet dt {
    color: #444;
    font-weight: 700;
  }

  .delivery-print-sheet li {
    break-inside: avoid;
    border-bottom: 1px solid #ddd;
    padding: 2mm 0;
  }

  .print-note {
    margin-top: 5mm;
    border: 1px solid #777;
    padding: 3mm;
  }
}
