/* Rahat Bakery Mini App - warm theme matching reference UI */
:root {
  --brand: #8B4513;
  --brand-light: #D2691E;
  --brand-bg: #FFF8F0;
  --bg: #FFFBF7;
  --card-bg: #ffffff;
  --text: #2C1810;
  --text-muted: #6B5344;
  --border: #E8DDD4;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(44, 24, 16, 0.08);
  --tg-theme-bg-color: #FFFBF7;
  --tg-theme-text-color: #2C1810;
  --tg-theme-hint-color: #6B5344;
  --tg-theme-button-color: #8B4513;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #FFF8F0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1512;
    --card-bg: #252019;
    --text: #f5ebe0;
    --text-muted: #b8a898;
    --border: #3d342c;
    --brand-bg: #2d231c;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

#main {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.hidden {
  display: none !important;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.logo-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn.back-btn {
  background: transparent;
  font-size: 1.4rem;
}

.profile-btn {
  background: var(--brand-bg);
  color: var(--brand);
}

/* Hero banner */
.hero-banner {
  background: linear-gradient(135deg, var(--brand-bg) 0%, #f5e6d8 100%);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.hero-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--text);
}

.hero-title strong {
  color: var(--brand);
}

.hero-subtitle {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-hero {
  padding: 12px 24px;
  border-radius: 24px;
  background: var(--brand);
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-hero:active {
  opacity: 0.9;
}

/* Section label */
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.btn-link {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

/* Menu grid - product cards with circular + */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding-bottom: 24px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card .img-wrap {
  aspect-ratio: 1;
  background: var(--brand-bg);
  overflow: hidden;
  border-radius: var(--radius);
}

.product-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.product-card .name-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}

.product-card .name-price-row .name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.product-card .name-price-sep {
  flex-shrink: 0;
  color: var(--text-muted);
  font-weight: 400;
  user-select: none;
}

.product-card .name-price-row .price-col {
  flex-shrink: 0;
  text-align: right;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

.product-card .name-price-row .price-col .price {
  font-weight: 600;
  color: var(--brand);
}

.product-card .name-price-row .price-col--discount .price-old {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85em;
  margin-right: 4px;
}

.category-heading {
  margin: 20px 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.category-heading:first-child {
  margin-top: 0;
}

.product-card .actions {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: auto;
  padding-top: 4px;
}

.product-card .cart-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.product-card .cart-stepper--solo {
  width: 100%;
}

.product-card .cart-qty {
  min-width: 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.product-card .actions .btn-add-round,
.product-card .actions .btn-round.btn-minus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-card .actions .btn-add-round {
  background: var(--brand);
  color: white;
}

.product-card .actions .btn-round.btn-minus {
  background: var(--card-bg);
  color: var(--brand);
  border: 2px solid var(--brand);
}

.product-card .actions .btn-add-round:active,
.product-card .actions .btn-round.btn-minus:active {
  opacity: 0.9;
}

.section {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* Cart screen */
.cart-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cart-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
}

.cart-count-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cart-items {
  padding: 0 0 16px;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.cart-line .name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.cart-line .subtotal {
  font-weight: 600;
  color: var(--brand);
  font-size: 0.95rem;
}

.cart-line .qty-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-line .qty-controls button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-line .qty-controls .qty {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

.order-summary {
  background: var(--brand-bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.summary-line:last-child {
  margin-bottom: 0;
}

.summary-total {
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.btn-checkout {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--brand);
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-checkout:active,
.btn-checkout:disabled {
  opacity: 0.9;
}

.btn-checkout:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 8px 8px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 30;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
}

.bottom-nav-item .nav-icon {
  font-size: 1.4rem;
}

.bottom-nav-item.active {
  color: var(--brand);
}

.bottom-nav-cart {
  position: relative;
  margin-bottom: 8px;
}

.bottom-nav-cart .nav-cart-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.nav-cart-badge {
  position: absolute;
  top: -4px;
  right: 50%;
  transform: translate(50%, 0);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #c0392b;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-cart-badge:empty,
.nav-cart-badge[data-count="0"] {
  display: none;
}

/* Success section */
#success-section {
  text-align: center;
  padding: 32px 0;
}

.success-title {
  margin: 0 0 16px;
  font-size: 1.25rem;
}

.success-msg {
  margin: 0 0 24px;
  font-size: 1rem;
  color: var(--text-muted);
}

.btn-primary {
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--brand);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* Manage section */
#profile-manage-content .manage-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

#profile-manage-content .manage-subnav button {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--brand-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

#profile-manage-content .manage-subnav button.active {
  background: var(--brand);
  color: white;
}

#profile-manage-content .staff-dish-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

#profile-manage-content .staff-dish-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

#profile-manage-content .staff-edit-category {
  width: 120px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

#profile-manage-content .staff-edit-discount {
  width: 90px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

#profile-manage-content .add-dish-fab {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

#profile-manage-content .modal-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

#profile-manage-content .modal,
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 10px 14px;
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
}

.modal label {
  display: block;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.options-modal .modal {
  overflow-x: hidden;
  box-sizing: border-box;
}

.options-modal .modal .option-group-label {
  display: block;
  margin: 14px 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.options-modal .modal .option-group-label:first-of-type {
  margin-top: 0;
}

.options-modal .option-choices {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
}

.options-modal .modal label.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: normal;
  cursor: pointer;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.options-modal .modal label.choice:has(input:checked) {
  border-color: var(--brand);
  background: rgba(139, 90, 43, 0.06);
}

.options-modal .modal label.choice input[type="radio"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.options-modal .modal label.choice .choice-name {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.35;
  color: var(--text);
}

.options-modal .modal label.choice .choice-price {
  flex-shrink: 0;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 45%;
}

.options-modal .modal .row {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.modal .text-muted.small {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 6px 0 0 0;
}

#profile-manage-content .staff-dish-thumb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

#profile-manage-content .staff-dish-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--border);
}

#profile-manage-content .staff-dish-no-photo {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  border-radius: var(--radius-sm);
}

#profile-manage-content .btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  margin-right: 8px;
  margin-top: 4px;
  border: none;
  border-radius: 8px;
  background: var(--brand-bg);
  color: var(--text);
  cursor: pointer;
}

#profile-manage-content .staff-order-line {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

#profile-manage-content .stock-input {
  width: 70px;
  padding: 4px 8px;
  margin: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

/* legacy opt-tag kept for backward compat */
#profile-manage-content .dish-options-list {
  margin: 8px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#profile-manage-content .opt-tag {
  margin-right: 4px;
}

.empty-cart {
  padding: 32px 0;
  color: var(--text-muted);
  text-align: center;
}

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

.error {
  color: #c0392b;
  padding: 12px;
  text-align: center;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
}

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

#profile-content {
  padding: 8px 0 24px;
}

#profile-section .profile-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

#profile-section .profile-header-card {
  text-align: center;
  padding-top: 20px;
  padding-bottom: 20px;
}

#profile-section .profile-avatar-wrap {
  margin: 0 auto 12px;
  width: 88px;
  height: 88px;
}

#profile-section .profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--brand-bg);
  display: block;
}

#profile-section .profile-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 2rem;
  font-weight: 700;
}

#profile-section .profile-display-name {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

#profile-section .profile-meta-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

#profile-section .profile-meta-dot {
  margin: 0 6px;
  opacity: 0.7;
}

#profile-section .profile-card-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-card-hint {
  margin: 0 0 10px;
  color: var(--text-muted);
}

.profile-input-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #c0392b;
}

#profile-section .profile-stat-main {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
}

#profile-section .profile-stat-sub {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--text);
}

#profile-section .profile-stat-muted {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#profile-section .profile-delivery-hint {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

#profile-section .profile-delivery-text {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
}

#profile-section .profile-link-maps {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
}

#profile-section .profile-btn-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand) 0%, #6b4423 100%);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(107, 68, 35, 0.35);
  box-sizing: border-box;
}

#profile-section .profile-btn-location-icon {
  font-size: 1.25rem;
}

#profile-section .payment-options-grid {
  display: grid;
  gap: 10px;
}

#profile-section .payment-option-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--brand-bg);
}

#profile-section .payment-option-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

#profile-section .payment-option-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#profile-section .payment-more-later {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

#profile-section .profile-staff-only {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 2px dashed var(--border);
}

#profile-section .staff-only-heading {
  margin: 0 0 14px 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand);
}

#profile-section .profile-manage-content {
  min-height: 80px;
}

#profile-manage-content .manage-role-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-bg);
  border: 1px solid var(--border);
}

#profile-manage-content .manage-role-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

#profile-manage-content .manage-role-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand);
}

.edit-dish-modal-body {
  max-height: 85vh;
  overflow-y: auto;
}

.edit-dish-modal .edit-dish-thumb-wrap {
  margin-bottom: 8px;
}

.edit-dish-modal .edit-dish-change-photo-btn {
  margin-bottom: 12px;
}

.edit-dish-modal .edit-option-block {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.edit-dish-modal .edit-option-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.edit-dish-modal .edit-option-header .edit-option-name {
  min-width: 120px;
  flex: 1;
  margin: 0;
}

.edit-dish-modal .edit-choices-list {
  margin-left: 8px;
}

.edit-dish-modal .edit-choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.edit-dish-modal .edit-choice-row .edit-choice-name {
  min-width: 100px;
  flex: 1;
  margin: 0;
  padding: 6px 10px;
}

.edit-dish-modal .edit-choice-row .edit-choice-price {
  width: 80px;
  margin: 0;
  padding: 6px 10px;
}

/* Manage → Dishes: sub-tabs & product types */
.manage-dishes-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.manage-dish-subtab {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
}

.manage-dish-subtab.active {
  border-color: var(--brand);
  background: var(--brand-bg);
  font-weight: 600;
}

.staff-category-heading {
  margin: 20px 0 10px;
  font-size: 1rem;
  color: var(--brand);
  scroll-margin-top: 72px;
}

.staff-inline-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 6px;
}

.staff-edit-category-select {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
}

.product-types-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

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

.product-type-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  cursor: grab;
}

.product-type-card.dragging {
  opacity: 0.6;
}

.product-type-card-drag {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.2;
  user-select: none;
  padding: 4px 2px;
}

.product-type-card-body {
  flex: 1;
  min-width: 0;
}

.product-type-name {
  font-weight: 600;
  margin-bottom: 8px;
}

.product-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.danger-text {
  color: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  .danger-text {
    color: #fca5a5;
  }
}

.cart-fulfillment-wrap {
  margin: 12px 0;
  padding: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.fulfillment-option {
  display: block;
  margin: 6px 0;
  font-size: 0.95rem;
}

.profile-input,
#cart-delivery-location-select {
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

/* Dish units badge on product cards */
.dish-units {
  font-size: 0.72em;
  color: var(--tg-theme-hint-color, #888);
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Dish description below name-price row */
.dish-desc {
  font-size: 0.78em;
  color: var(--tg-theme-hint-color, #888);
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Ingredients and analytics table */
.ingredients-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ingredients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

.ingredients-table th,
.ingredients-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #e8e8e8);
}

.ingredients-table th {
  font-weight: 600;
  color: var(--tg-theme-hint-color, #888);
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
  border: none;
}

.margin-good { color: #27ae60; font-weight: 600; }
.margin-ok   { color: #f39c12; }
.margin-low  { color: #e74c3c; }

/* Product cost category badges */
.ing-cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ing-cat-food  { background: #d5f0e0; color: #1a7a40; }
.ing-cat-other { background: #e8e0f8; color: #5a3b9a; }

/* Choice cost-item link badge */
.choice-cost-badge {
  font-size: 13px;
  margin-right: 4px;
  opacity: 0.75;
  flex-shrink: 0;
}

/* ── POS Panel ─────────────────────────────── */
.pos-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pos-sell-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--tg-theme-hint-color, #ccc);
  border-radius: 8px;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #000);
  font-size: 0.95em;
  box-sizing: border-box;
}

.pos-dish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.pos-dish-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  background: var(--tg-theme-secondary-bg-color, #f5f5f5);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s;
}
.pos-dish-tile:active { opacity: 0.7; }

.pos-tile-name {
  font-size: 0.85em;
  font-weight: 500;
  color: var(--tg-theme-text-color, #000);
  line-height: 1.3;
}

.pos-tile-price {
  font-size: 0.8em;
  color: var(--tg-theme-link-color, #2481cc);
  font-weight: 600;
}

.pos-cart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 20px;
}

.pos-cart-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #eee);
}

.pos-cart-name {
  flex: 1;
  font-size: 0.9em;
}

.pos-cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--tg-theme-secondary-bg-color, #e8e8e8);
  color: var(--tg-theme-text-color, #333);
  font-size: 1.1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pos-qty-val {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95em;
}

.pos-cart-sub {
  font-weight: 600;
  font-size: 0.9em;
  min-width: 70px;
  text-align: right;
}

.pos-total {
  font-size: 1.05em;
  padding: 8px 0 4px;
  text-align: right;
}

.pos-sell-btn {
  width: 100%;
  padding: 14px;
  font-size: 1.05em;
  font-weight: 700;
}

.pos-empty {
  color: var(--tg-theme-hint-color, #888);
  font-size: 0.9em;
  text-align: center;
  padding: 10px 0;
}

/* POS history */
.pos-history-section {
  border-top: 1px solid var(--tg-theme-secondary-bg-color, #e0e0e0);
  padding-top: 14px;
}

.pos-history-header {
  font-weight: 600;
  font-size: 0.9em;
  margin-bottom: 8px;
  color: var(--tg-theme-hint-color, #888);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pos-hist-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f0f0f0);
  font-size: 0.88em;
}

.pos-hist-time {
  color: var(--tg-theme-hint-color, #888);
  min-width: 38px;
  flex-shrink: 0;
}

.pos-hist-items {
  flex: 1;
  color: var(--tg-theme-text-color, #333);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pos-hist-item {
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
  border-radius: 4px;
  padding: 1px 5px;
}

.pos-hist-total {
  font-weight: 600;
  min-width: 70px;
  text-align: right;
  flex-shrink: 0;
}

/* Dish ingredients modal */
.dish-ing-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.dish-ing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #eee);
}

.dish-ing-name {
  flex: 1;
  font-size: 0.9em;
}

.dish-ing-qty {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--tg-theme-hint-color, #ccc);
  border-radius: 6px;
  font-size: 0.9em;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #000);
}

.dish-ing-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}

.dish-ing-add-row select {
  flex: 1;
  min-width: 120px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--tg-theme-hint-color, #ccc);
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #000);
  font-size: 0.9em;
}

/* ── Dish Detail Bottom Sheet ──────────────────── */
.dish-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dish-detail-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
}

.dish-detail-sheet--visible {
  transform: translateY(0);
}

.dish-detail-sheet--closing {
  transform: translateY(100%);
}

.dish-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.dish-detail-img-wrap {
  flex-shrink: 0;
  height: 220px;
  background: var(--brand-bg);
}

.dish-detail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dish-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.dish-detail-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  line-height: 1.25;
}

.dish-detail-name-en {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: -4px;
}

.dish-detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dish-detail-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand);
}

.dish-detail-price-old {
  font-size: 1rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.dish-detail-meta {
  font-size: 0.8em;
  color: var(--text-muted);
  background: var(--brand-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  align-self: flex-start;
}

.dish-detail-desc {
  margin: 0;
  font-size: 0.93em;
  color: var(--text-muted);
  line-height: 1.6;
}

.dish-detail-ings-title {
  margin: 8px 0 8px;
  font-size: 0.78em;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dish-detail-ing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
}

.ing-chip {
  font-size: 0.82em;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 500;
  border: 1px solid rgba(139, 69, 19, 0.15);
}

.dish-detail-ings-loading {
  font-size: 0.82em;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.dish-detail-footer {
  flex-shrink: 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.dish-detail-add-btn {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.dish-detail-add-btn:active {
  opacity: 0.85;
}

.dish-detail-add-btn:disabled {
  background: var(--brand-light);
  cursor: default;
}

/* ── Inline dish options ───────────────────────── */
.dish-detail-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dish-opt-group {
  background: var(--brand-bg);
  border-radius: 14px;
  padding: 14px;
  transition: outline 0.15s;
  outline: 2px solid transparent;
}

.dish-opt-group--error {
  outline-color: #e74c3c;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
}

.dish-opt-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dish-opt-group-name {
  font-weight: 700;
  font-size: 0.9em;
  color: var(--text);
}

.dish-opt-required {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--brand);
  background: rgba(139, 69, 19, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dish-opt-optional {
  font-size: 0.7em;
  color: var(--text-muted);
  padding: 2px 6px;
}

.dish-opt-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dish-opt-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.dish-opt-chip:active {
  transform: scale(0.94);
}

.dish-opt-chip--selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.dish-opt-chip-name {
  font-size: 0.88em;
  font-weight: 500;
  line-height: 1.2;
}

.dish-opt-chip-price {
  font-size: 0.72em;
  opacity: 0.75;
  line-height: 1;
}

.dish-opt-chip--selected .dish-opt-chip-price {
  opacity: 0.9;
}

/* ── Cart line with image thumbnail ──────────────── */
.cart-line-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--brand-bg);
}

.cart-line-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cart-line-info .name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-line-opts {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-line-info .subtotal {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand);
}

/* Cart footer */
.cart-foot {
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
}

.cart-foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.cart-foot-label {
  color: var(--text-muted);
}

.cart-foot-total {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand);
}

/* ── Fulfillment section ─────────────────────────── */
.ff-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 16px 0 10px;
}

.ff-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.ff-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ff-type-card--active {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.ff-type-card--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ff-type-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.ff-type-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.ff-type-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.ff-type-card--active .ff-type-name {
  color: var(--brand);
}

/* Delivery wrap */
.ff-delivery-wrap {
  background: var(--brand-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.ff-input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ff-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 0;
}

.ff-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Payment cards */
.ff-pay-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.ff-pay-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ff-pay-card--active {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.ff-pay-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.ff-pay-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.ff-pay-card--active .ff-pay-label {
  color: var(--brand);
}

.pay-at-place-hint {
  background: var(--brand-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}

.badge-overdue {
  display: inline-block;
  background: #dc2626;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

.btn-warning {
  background: #dc2626 !important;
  color: white !important;
  border-color: #dc2626 !important;
}
.btn-warning:active {
  opacity: 0.85;
}

/* Staff orders redesign */
.orders-search-wrap {
  margin-bottom: 14px;
}

.orders-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.95rem;
}

.orders-search-input:focus {
  outline: none;
  border-color: var(--brand);
}

.orders-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 16px 0 8px;
  list-style: none;
  cursor: pointer;
}

.orders-group-header:first-child {
  margin-top: 0;
}

.orders-group-count {
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.orders-done-group {
  margin-top: 8px;
}

.orders-done-group summary {
  list-style: none;
}

.orders-done-group summary::-webkit-details-marker {
  display: none;
}

.orders-done-summary::after {
  content: " \25B8";
  font-size: 0.7rem;
  opacity: 0.6;
}

.orders-done-group[open] .orders-done-summary::after {
  content: " \25BE";
}

.orders-empty-active {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px 0;
}

.order-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.order-card:active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.1);
}

.order-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.order-card-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.order-card-body {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.order-card-id {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.order-card-user {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.order-card-items {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--brand-bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.order-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-card-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
}

.order-card-btn {
  font-size: 0.8rem;
  padding: 6px 14px;
}

/* Status chip colours */
.order-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-new       { background: #fef9c3; color: #854d0e; }
.status-payment   { background: #fce7f3; color: #9d174d; }
.status-preparing { background: #dbeafe; color: #1e40af; }
.status-ready     { background: #dcfce7; color: #166534; }
.status-delivering{ background: #e0f2fe; color: #075985; }
.status-done      { background: var(--brand-bg); color: var(--text-muted); }
.status-cancelled { background: #fee2e2; color: #7f1d1d; }
.status-rejected  { background: #fee2e2; color: #7f1d1d; }

/* Unpaid badge for QR orders */
.badge-unpaid {
  display: inline-block;
  background: #fbbf24;
  color: #78350f;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (prefers-color-scheme: dark) {
  .status-new       { background: #422006; color: #fef08a; }
  .status-payment   { background: #500724; color: #fbcfe8; }
  .status-preparing { background: #1e3a8a; color: #bfdbfe; }
  .status-ready     { background: #14532d; color: #bbf7d0; }
  .status-delivering{ background: #0c4a6e; color: #bae6fd; }
  .status-done      { background: var(--brand-bg); color: var(--text-muted); }
  .status-cancelled { background: #450a0a; color: #fecaca; }
  .status-rejected  { background: #450a0a; color: #fecaca; }
  .badge-unpaid     { background: #78350f; color: #fef3c7; }
}

/* ── Order Detail (od-*) ── */
.od-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 16px;
  cursor: pointer;
}
.od-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.od-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.od-order-id {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.od-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.od-header-time { margin-left: auto; }

.od-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.od-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.od-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 4px 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.od-item:last-of-type { border-bottom: none; }
.od-item-name { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.od-item-qty { font-size: 0.82rem; color: var(--text-muted); }
.od-item-price { font-size: 0.88rem; font-weight: 600; color: var(--text); text-align: right; }
.od-item-opts-row { grid-column: 1 / -1; }
.od-item-opts { font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.od-totals { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.od-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 3px 0;
}
.od-total-grand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 4px;
}

.od-address-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.od-address-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.od-address-text { font-size: 0.9rem; color: var(--text); }
.od-address-note { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.od-maps-link { font-size: 0.82rem; color: var(--brand); font-weight: 600; text-decoration: none; }

.od-track-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.od-track-block a { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 0.9rem; }

.od-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 16px;
}
.od-action-btn { width: 100%; }
.od-action-danger { color: #ef4444 !important; border-color: #ef4444 !important; }
.od-fee-row { display: flex; flex-direction: column; gap: 4px; }
.od-fee-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.opt-choice-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.opt-choice-row .profile-input {
  padding: 6px 8px;
  font-size: 0.82rem;
}
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.dishes-search-wrap {
  padding: 8px 0 4px;
}

.staff-dish-add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.staff-dish-add-card:hover, .staff-dish-add-card:active {
  border-color: var(--brand);
  color: var(--brand);
}
.staff-dish-add-icon {
  font-size: 2rem;
  line-height: 1;
  font-weight: 300;
}
.staff-dish-add-label {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Profile Orders Redesign ── */
.profile-orders-wrap { margin-bottom: 16px; }
.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.profile-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.profile-history-toggle {
  font-size: 0.78rem;
  color: var(--brand);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.profile-last-order-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.profile-last-order-card--active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 15%, transparent);
}
.profile-order-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.profile-order-id {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
.profile-order-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.profile-order-items-list {
  margin: 8px 0;
}
.profile-order-item-row {
  font-size: 0.88rem;
  color: var(--text);
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.profile-order-item-row:last-of-type { border-bottom: none; }
.profile-order-item-more {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 3px;
}
.profile-order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.profile-order-total {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.profile-order-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.profile-order-ready-hint {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #16a34a;
}
/* Order history rows */
.profile-orders-history {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.profile-hist-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.profile-hist-row:last-child { border-bottom: none; }
.profile-hist-left { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.profile-hist-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
.profile-hist-id { font-weight: 700; color: var(--text); }
.profile-hist-items { color: var(--text-muted); text-align: right; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-hist-total { font-weight: 700; color: var(--text); }
.profile-hist-date { color: var(--text-muted); font-size: 0.72rem; }
/* Smaller status chip variant */
.order-status-chip--sm { font-size: 0.65rem; padding: 1px 5px; }
/* Empty orders CTA */
.profile-empty-orders {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px;
  gap: 8px;
}
.profile-empty-orders-icon { font-size: 2.5rem; }
.profile-empty-orders-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0; }
.profile-empty-orders-sub { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.profile-empty-orders .btn { margin-top: 8px; }
/* Uniform secondary buttons in profile (Save number, Add favourite place) */
.profile-secondary-btn {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: none;
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.profile-secondary-btn:hover, .profile-secondary-btn:active {
  border-color: var(--brand);
  color: var(--brand);
}
/* POS options */
.pos-cart-name-wrap { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pos-cart-opts { font-size: 0.72rem; color: var(--text-muted); font-style: italic; }

/* ── Analytics Panel ── */
.analytics-period-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.analytics-period-tab {
  flex: 1;
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  background: none;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.analytics-period-tab.active {
  background: var(--brand);
  color: #fff;
}
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.analytics-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.analytics-kpi--revenue { grid-column: 1 / -1; }
.analytics-kpi--good { border-color: #16a34a33; }
.analytics-kpi--bad { border-color: #dc262633; }
.analytics-kpi-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.analytics-kpi--revenue .analytics-kpi-value { font-size: 1.6rem; color: var(--brand); }
.analytics-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.analytics-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.analytics-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
/* Status bars */
.analytics-status-row {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.analytics-status-row:last-child { margin-bottom: 0; }
.analytics-status-label { font-size: 0.8rem; color: var(--text); }
.analytics-status-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.analytics-status-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 4px;
}
.analytics-status-count { font-size: 0.8rem; font-weight: 700; color: var(--text); text-align: right; }
/* Top dishes */
.analytics-top-dishes { display: flex; flex-direction: column; gap: 10px; }
.analytics-top-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 8px;
}
.analytics-top-rank { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-align: center; }
.analytics-top-name-wrap { min-width: 0; }
.analytics-top-name { font-size: 0.85rem; font-weight: 500; color: var(--text); display: block; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-top-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.analytics-top-bar { height: 100%; background: var(--brand); border-radius: 2px; min-width: 4px; }
.analytics-top-count { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.analytics-top-rev { font-size: 0.82rem; font-weight: 700; color: var(--text); white-space: nowrap; }
/* Profitability table */
.analytics-table-wrap { overflow-x: auto; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.analytics-table th { text-align: left; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--border); }
.analytics-table th:not(:first-child), .analytics-td-num { text-align: right; }
.analytics-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-td-name { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-margin-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}
.analytics-margin-good { background: #dcfce7; color: #16a34a; }
.analytics-margin-ok { background: #fef9c3; color: #a16207; }
.analytics-margin-low { background: #fee2e2; color: #dc2626; }
/* POS discount price */
.pos-tile-price-old { font-size: 0.65rem; color: var(--text-muted); text-decoration: line-through; margin-left: 3px; }

/* ── Delivery address flow modals ── */
.delivery-addr-modal {
  max-width: 22rem;
}
.delivery-addr-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}
.delivery-addr-intro {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.4;
}
.delivery-new-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  margin-bottom: 6px;
}
.delivery-addr-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 10px 0 4px;
}
.delivery-details-required {
  color: #b45309;
}
.delivery-addr-textarea {
  width: 100%;
  resize: vertical;
}
.delivery-save-toggle {
  margin-top: 12px;
}
.delivery-addr-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.delivery-addr-actions .btn { width: 100%; }
/* Saved place cards */
.delivery-places-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.delivery-place-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
  width: 100%;
}
.delivery-place-card--selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--card-bg));
}
.delivery-place-card--new {
  border-style: dashed;
}
.delivery-place-emoji {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.delivery-place-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.delivery-place-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.delivery-place-address {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delivery-place-dist {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand);
}
.delivery-place-check {
  font-size: 1rem;
  color: var(--brand);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Unavailable product card ── */
.product-card--unavailable {
  opacity: 0.55;
  filter: grayscale(30%);
}

.unavailable-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  white-space: nowrap;
}

/* ── Staff options panel ── */
#profile-manage-content .dish-options-panel {
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#profile-manage-content .dish-option-row {
  background: var(--surface, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

#profile-manage-content .dish-option-row--off {
  opacity: 0.5;
}

#profile-manage-content .dish-option-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

#profile-manage-content .dish-option-name {
  font-weight: 600;
  font-size: 0.85rem;
}

#profile-manage-content .opt-required {
  font-size: 0.7rem;
  color: var(--brand, #e74c3c);
  font-weight: normal;
}

#profile-manage-content .dish-option-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#profile-manage-content .opt-choice-chip {
  font-size: 0.75rem;
  background: var(--card-bg, white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  color: var(--text-muted);
}

/* ── Dish status badges (staff card) ── */
.dish-status-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.dish-status-badge--hidden {
  background: #444;
  color: white;
}

.dish-status-badge--unavail {
  background: #f39c12;
  color: white;
}
