:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f0f2f5;
  --ink: #14161a;
  --muted: #6b7280;
  --line: rgba(20, 22, 26, 0.09);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.11);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.13);
  --orange: #ff9f0a;
  --red: #ff3b30;
  --shadow: 0 16px 42px rgba(22, 29, 45, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 17px;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  padding: 24px 18px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #15171c;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.segment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #333842;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.segment-item span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: rgba(118, 118, 128, 0.13);
  color: var(--muted);
}

.segment-item strong {
  font-size: inherit;
}

.segment-item.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(22, 29, 45, 0.08);
}

.segment-item.active span {
  background: var(--accent-soft);
  color: var(--accent);
}

.plan-badge {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.plan-badge strong {
  display: block;
  font-size: 20px;
}

.workspace {
  min-width: 0;
  padding: 28px clamp(20px, 4vw, 46px) 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  min-height: 42px;
}

.user-chip button,
.user-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(22, 29, 45, 0.05);
}

.user-chip button {
  cursor: pointer;
}

.language-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 6px 0 12px;
  box-shadow: 0 8px 22px rgba(22, 29, 45, 0.05);
}

.language-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-control select {
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.sync-pill,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #005ecc;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
}

.sync-pill {
  background: var(--green-soft);
  color: #1d7b37;
}

.sync-pill.offline {
  background: rgba(255, 159, 10, 0.13);
  color: #9a5a00;
}

.icon-button,
.quantity-button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.13);
  color: var(--accent);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 24px;
}

.section-title,
.panel-header,
.order-header,
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-title {
  margin-bottom: 16px;
}

.kitchen-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.13);
  color: #303640;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.toggle-button.active {
  background: var(--green-soft);
  color: #1d7b37;
}

.filter-block {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.table-strip,
.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.table-strip::-webkit-scrollbar,
.category-strip::-webkit-scrollbar {
  height: 0;
}

.chip {
  flex: 0 0 auto;
  min-width: 68px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #282d35;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chip.active {
  border-color: transparent;
  background: #15171c;
  color: white;
}

.chip.busy {
  color: var(--orange);
}

.dish-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.dish-card,
.order-card,
.panel,
.metric-card,
.cartbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dish-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 13px;
  min-height: 136px;
  padding: 12px;
}

.dish-image {
  width: 112px;
  min-height: 112px;
  border-radius: 8px;
  background-color: var(--surface-muted);
  background-position: center;
  background-size: cover;
}

.dish-copy {
  min-width: 0;
}

.dish-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dish-title {
  margin: 2px 0 6px;
  font-size: 17px;
  line-height: 1.22;
}

.dish-description {
  display: -webkit-box;
  min-height: 38px;
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-size: 18px;
  font-weight: 900;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-button {
  width: 30px;
  height: 30px;
  font-size: 18px;
  font-weight: 800;
}

.quantity-button.add {
  background: var(--accent);
  color: white;
}

.quantity-value {
  min-width: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
}

.cartbar {
  position: sticky;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.cartbar strong {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.cart-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cart-note span {
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:disabled {
  background: rgba(118, 118, 128, 0.18);
  color: rgba(60, 60, 67, 0.36);
  cursor: default;
}

.secondary-button {
  background: rgba(118, 118, 128, 0.13);
  color: #20242b;
}

.danger-button {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.order-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.order-card {
  padding: 16px;
}

.order-meta {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.item-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #2c3139;
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  letter-spacing: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.management-shell {
  display: grid;
  gap: 14px;
}

.management-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  box-shadow: var(--shadow);
}

.management-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: #303640;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.management-tabs button.active {
  background: #15171c;
  color: white;
}

.management-panel {
  display: grid;
  gap: 14px;
}

.admin-card,
.admin-form,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.admin-card {
  display: grid;
  gap: 12px;
}

.admin-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.demo-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.demo-users button {
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: #303640;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.role-pill {
  border-radius: 999px;
  background: var(--accent-soft);
  color: #005ecc;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.role-pill.success {
  background: var(--green-soft);
  color: #1c7c36;
}

.role-pill.danger {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.usage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  width: 100%;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 900;
}

.merchant-admin-card,
.audit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.merchant-admin-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 900;
}

.audit-row span {
  color: #303640;
}

.audit-row strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #1c7c36;
}

.audit-failed {
  border-color: rgba(255, 59, 48, 0.28);
}

.audit-failed strong {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.availability-off {
  opacity: 0.62;
}

.order-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(9, 12, 17, 0.28);
  padding: 24px;
  backdrop-filter: blur(10px);
}

.order-detail-panel {
  width: min(920px, 100%);
  max-height: min(840px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(10, 15, 25, 0.18);
  padding: 18px;
}

.modal-header,
.detail-summary,
.detail-line,
.payment-row,
.total-stack div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 21px;
}

.detail-summary {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  padding-bottom: 14px;
  font-size: 13px;
  font-weight: 800;
}

.detail-section {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.detail-line,
.payment-row,
.total-stack div {
  min-height: 34px;
  font-size: 14px;
}

.detail-line span,
.payment-row span,
.total-stack span {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.total-stack,
.payment-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.total-stack div {
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 8px 10px;
}

.payment-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.payment-row div {
  display: grid;
  gap: 3px;
}

.shift-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.shift-metric {
  display: grid;
  gap: 5px;
  min-height: 66px;
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px;
}

.shift-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shift-metric strong {
  font-size: 18px;
  letter-spacing: 0;
}

.shift-history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.printer-task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.printer-queued {
  border-color: rgba(0, 122, 255, 0.28);
}

.printer-failed {
  border-color: rgba(255, 59, 48, 0.28);
  background: rgba(255, 59, 48, 0.04);
}

.action-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.panel-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.plan-features,
.store-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.feature {
  border-radius: 999px;
  background: var(--green-soft);
  color: #1c7c36;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
}

.store-item {
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.store-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.store-item strong {
  display: block;
  font-size: 15px;
}

.store-item span {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 5;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(17, 19, 24, 0.88);
  color: white;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 800;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty {
  border: 1px dashed rgba(17, 19, 24, 0.18);
  border-radius: 8px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
  font-size: 14px;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plan-badge {
    display: none;
  }

  .order-layout {
    grid-template-columns: 1fr;
  }

  .cartbar {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 22px 16px 32px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .dish-list,
  .order-list,
  .metric-grid,
  .admin-grid,
  .admin-grid-form,
  .detail-grid,
  .action-form,
  .shift-summary-grid {
    grid-template-columns: 1fr;
  }

  .order-detail-overlay {
    align-items: stretch;
    padding: 12px;
  }

  .order-detail-panel {
    max-height: calc(100vh - 24px);
  }

  .dish-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .dish-image {
    width: 96px;
    min-height: 96px;
  }
}
