:root {
  --bg: #f5f0ea;
  --surface: #fffaf4;
  --card: #ffffff;
  --ink: #201b16;
  --muted: #786d62;
  --line: #e8dccf;
  --brand: #7a4f2b;
  --dark: #211a14;
  --shadow: 0 18px 42px rgba(37, 27, 18, .1);
  --admin-touch: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
html {
  width: 100%;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.admin-page,
.admin-shell,
.admin-layout,
.admin-main,
.dashboard-container,
.merchant-admin .shell,
.shell,
.panel,
.view,
.orders-grid,
.order-card,
.topbar,
.hero-panel,
.stats,
.stats-dashboard,
.dashboard-grid {
  min-width: 0;
  max-width: 100%;
}
.merchant-admin.admin-page,
.admin-shell,
.admin-main,
.dashboard-container {
  width: 100%;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; font-weight: 800; }
button {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  min-height: var(--admin-touch);
  padding: 0 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
  touch-action: manipulation;
}
button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.12); }
button.secondary { background: var(--dark); }
button.soft { background: #efe6dc; color: var(--ink); box-shadow: none; }
button.danger { background: #9f1239; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  font-size: 16px;
  line-height: 1.35;
  outline-color: var(--brand);
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-inline-end: 36px;
}
textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 800; }
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  background:
    radial-gradient(circle at top left, rgba(122,79,43,.18), transparent 34%),
    var(--bg);
}
.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.login-card form { display: grid; gap: 14px; }
.message { min-height: 20px; color: #b91c1c; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left));
  background: rgba(255,250,244,.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.brand-title strong {
  font-size: clamp(15px, 4vw, 18px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.brand-title span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 1 auto;
  max-width: min(100%, 520px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--admin-touch);
  padding: 0 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 20px calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  display: grid;
  gap: 18px;
}
.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 24px;
  border-radius: 28px;
  background: #211a14;
  color: #fff;
  box-shadow: var(--shadow);
}
.hero-panel h1 { margin: 0 0 8px; font-size: clamp(28px, 5vw, 44px); }
.hero-panel p { margin: 0; color: rgba(255,255,255,.72); }
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 10px;
  margin: 0 -2px;
}
.merchant-admin .tabs {
  margin: 0;
  max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
  min-height: var(--admin-touch);
  padding: 0 16px;
  font-size: 15px;
  white-space: nowrap;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(37,27,18,.06);
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 800; }
.stat strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 6vw, 30px);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stat-alert {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff7ed, #fff);
}
.stat-alert strong { color: #c2410c; }
.stat-label-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.notification-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.notification-badge[hidden] { display: none !important; }
.order-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--admin-touch);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  flex: 0 0 auto;
  cursor: pointer;
}
.order-bell-btn.order-bell-active {
  border-color: #fca5a5;
  background: #fff7ed;
}
.order-bell-icon {
  font-size: 18px;
  line-height: 1;
}
.order-bell-label {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.order-bell-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -4px;
}
.enable-sound-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.enable-sound-btn.sound-enabled {
  opacity: .72;
}
.tab.tab-has-alert {
  box-shadow: inset 0 -3px 0 #dc2626;
}
.order-toast strong {
  display: block;
  font-size: 15px;
}
.order-toast-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  opacity: .82;
}
.toast-stack {
  position: fixed;
  top: 76px;
  inset-inline-end: 18px;
  z-index: 40;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}
.order-toast {
  pointer-events: auto;
  padding: 14px 18px;
  border-radius: 16px;
  background: #1f2937;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  transform: translateY(-10px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  cursor: pointer;
}
.order-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.order-card-new-pulse,
.recent-order-card.order-card-new-pulse {
  animation: orderPulse 1.15s ease-in-out 3;
  border-color: #fca5a5 !important;
}
@keyframes orderPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .22); }
  50% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
}
.stats-dashboard {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}
.recent-orders-list {
  display: grid;
  gap: 10px;
}
.recent-order-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.recent-order-card {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.recent-order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 27, 18, .08);
  border-color: rgba(122, 79, 43, .35);
}
.recent-order-items {
  display: block;
  font-size: 12px;
  line-height: 1.45;
}
.order-highlight {
  outline: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(122, 79, 43, .16);
}
.address-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  line-height: 1.5;
}
.address-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
html[dir="rtl"] .address-line {
  flex-direction: row-reverse;
  text-align: right;
}
html[dir="rtl"] .order-details {
  direction: rtl;
}
html[dir="rtl"] .order-detail {
  text-align: right;
}
html[dir="rtl"] .order-detail span {
  letter-spacing: 0;
}
html[dir="rtl"] .order-items-block,
html[dir="rtl"] .order-line {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .recent-order-row {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .recent-order-meta {
  justify-items: start;
  text-align: start;
}
.recent-order-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.recent-order-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: end;
}
.empty-block {
  padding: 12px 4px;
  margin: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select {
  min-width: 180px;
  flex: 1 1 180px;
}
.export-toolbar {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.export-toolbar .export-btn {
  min-height: var(--admin-touch);
  white-space: nowrap;
}

.filters-toolbar {
  margin-bottom: 16px;
}
.panel-head-stack {
  align-items: flex-start;
}
.panel-head-stack .toolbar {
  width: 100%;
  justify-content: flex-end;
}
.products-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.product-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.product-card-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.product-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.product-card-desc {
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.thumb-lg {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}
.order-card-premium {
  border: 1px solid rgba(234, 223, 210, .95);
  background: linear-gradient(180deg, #fff, #fffaf4);
}
.order-items-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: #faf6f1;
}
.pickup-confirmation-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.pickup-confirmation-block.pickup-confirmed {
  background: #ecfdf5;
  border-color: #86efac;
}
.pickup-confirmation-block.pickup-pending {
  background: #fffbeb;
  border-color: #fcd34d;
}
.pickup-details {
  margin-top: 0;
}
.pickup-correction-history {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.pickup-correction-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.pickup-correction-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
}
.pickup-correction-item strong {
  font-size: 14px;
}
.item-card-compact {
  padding: 12px;
}
.product-modal .modal-body {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px;
  align-items: start;
}
.modal-preview-col,
.modal-fields-col {
  display: grid;
  gap: 12px;
}
.modal-image-wrap .product-preview {
  max-width: none;
  width: 100%;
  height: 220px;
}
.product-modal-preview-name {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
}
.modal-footer,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-footer {
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.modal-head {
  margin-bottom: 8px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(37,27,18,.06);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel h2, .panel h3 { margin: 0; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 13px;
  align-items: end;
}
.compact-form { display: grid; gap: 10px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check input { width: auto; }
.table-wrap,
.table-wrapper,
.package-wallets-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}
.table-wrap table,
.table-wrapper table {
  min-width: 0;
}
@media (min-width: 1025px) {
  .table-wrap table:not(.package-wallets-table):not(.package-wallet-tx-table) {
    min-width: 760px;
  }
  .business-list-table {
    min-width: 900px;
  }
}
.business-list-cards {
  display: none;
  grid-template-columns: 1fr;
  gap: 14px;
}
.business-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 28px rgba(37, 27, 18, .06);
}
.business-card-alert {
  background: #fffbeb;
  border-color: #fcd34d;
}
.business-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.business-card-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.business-card-title strong {
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.business-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
}
.business-card-meta > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.business-card-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.business-card-meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.slug-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  background: #faf6f1;
  padding: 2px 8px;
  border-radius: 8px;
}
.business-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.business-card-actions button {
  flex: 1 1 calc(50% - 4px);
  min-width: 140px;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 13px;
}
.item-card, .order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.orders-grid,
.mobile-orders-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
}
.order-card {
  padding: 18px;
  box-shadow: 0 14px 34px rgba(37, 27, 18, .08);
  width: 100%;
  max-width: 100%;
}
.order-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.order-card-actions button,
.order-card-actions select {
  min-height: var(--admin-touch);
  font-size: 16px;
}
.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.order-card-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
}
.order-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 14px;
  border-radius: 16px;
  background: #faf6f1;
}
.order-detail {
  display: grid;
  gap: 4px;
}
.order-detail.span-2 {
  grid-column: 1 / -1;
}
.order-detail span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.order-detail strong {
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.order-total {
  color: var(--brand);
  font-size: 16px !important;
}
.order-items-list {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}
.order-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.status-new { background: #ffedd5; color: #c2410c; }
.status-accepted { background: #dbeafe; color: #1d4ed8; }
.status-preparing { background: #ede9fe; color: #6d28d9; }
.status-delivery { background: #fef9c3; color: #a16207; }
.status-delivered { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #b91c1c; }
.empty-orders {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.thumb {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.muted { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #efe6dc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}
.pill.active { background: #dcfce7; color: #166534; }
.pill.off { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.stat-alert strong { color: #b45309; }
.warn-text { color: #b45309; font-size: 12px; margin-top: 4px; }
.row-alert { background: #fffbeb; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.subscription-banner {
  display: grid;
  gap: 4px;
  padding: 14px calc(18px + var(--safe-right)) 14px calc(18px + var(--safe-left));
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
}
.subscription-banner[hidden] { display: none !important; }
.read-only-admin .write-control,
.read-only-admin .status-actions button,
.read-only-admin #addProductBtn,
.read-only-admin .item-card .row button,
.read-only-admin #categoryForm button[type="submit"],
.read-only-admin #settingsForm button[type="submit"],
.read-only-admin #productForm button[type="submit"] {
  opacity: 0.55;
  pointer-events: none;
}
.read-only-admin #categoryForm input,
.read-only-admin #categoryForm select,
.read-only-admin #settingsForm input,
.read-only-admin #settingsForm select,
.read-only-admin #settingsForm textarea,
.read-only-admin #productForm input,
.read-only-admin #productForm select,
.read-only-admin #productForm textarea {
  background: #f8fafc;
}
.view { display: none; }
.view.active { display: grid; gap: 18px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: calc(18px + var(--safe-top)) calc(18px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(18px + var(--safe-left));
  background: rgba(20, 14, 9, .55);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop.show { display: grid; }
.modal {
  width: min(720px, 100%);
  max-height: min(90vh, calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin: auto;
}
.modal form { display: grid; gap: 12px; }
.status-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.status-actions button,
.status-btn {
  min-height: var(--admin-touch);
  padding: 0 14px;
  font-size: 14px;
  background: #efe6dc;
  color: var(--ink);
  box-shadow: none;
}
.status-actions button.active,
.status-btn.active {
  background: var(--brand);
  color: #fff;
}
.status-btn.danger {
  background: #fee2e2;
  color: #b91c1c;
}
.status-btn.danger.active {
  background: #b91c1c;
  color: #fff;
}
.order-status-control {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.order-status-control label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.order-status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}
.order-status-select {
  flex: 1 1 180px;
  min-height: var(--admin-touch);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
}
.branding-preview {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.settings-name-preview {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #faf6f1;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.store-status-panel .panel-head-stack {
  align-items: center;
}
.store-open-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-weight: 800;
}
.store-open-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.store-open-switch-ui {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background .2s ease;
  flex: 0 0 auto;
}
.store-open-switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
  transition: transform .2s ease;
}
.store-open-switch input:checked + .store-open-switch-ui {
  background: #16a34a;
}
.store-open-switch input:checked + .store-open-switch-ui::after {
  transform: translateX(22px);
}
html[dir="rtl"] .store-open-switch input:checked + .store-open-switch-ui::after {
  transform: translateX(-22px);
}
.store-open-field {
  grid-column: 1 / -1;
}
.weekly-hours-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #faf6f1;
}
.weekly-hours-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.weekly-hours-editor {
  display: grid;
  gap: 10px;
}
.weekly-hours-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) repeat(2, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}
.weekly-day-toggle {
  margin: 0;
  font-weight: 800;
}
.order-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.order-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.order-type-badge.delivery {
  background: #dbeafe;
  color: #1d4ed8;
}

.order-type-badge.pickup {
  background: #fef3c7;
  color: #b45309;
}

.delivery-area-form {
  margin-bottom: 1rem;
}

.delivery-area-card .row {
  justify-content: space-between;
  gap: 0.75rem;
}

.coupon-form {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.coupon-card .row {
  align-items: flex-start;
}
.brand-preview-card {
  display: grid;
  gap: 8px;
}
.brand-preview-card.banner img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}
.brand-preview-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
}
.preview-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.image-preview-wrap {
  display: grid;
  gap: 8px;
}
.product-preview {
  width: 100%;
  max-width: 280px;
  height: 180px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #faf6f1;
}
.lang-toggle {
  min-width: 44px;
  padding: 0 12px;
  font-weight: 900;
}

html[dir="rtl"] body {
  font-family: Tahoma, Arial, sans-serif;
}
html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}
html[dir="rtl"] .panel-head,
html[dir="rtl"] .order-card-head,
html[dir="rtl"] .row,
html[dir="rtl"] .order-line,
html[dir="rtl"] .hero-panel {
  direction: rtl;
}
html[dir="rtl"] .tabs {
  direction: rtl;
}
html[dir="rtl"] .check {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
html[dir="rtl"] .status-actions {
  direction: rtl;
}
html[dir="rtl"] .recent-order-meta {
  justify-items: start;
  text-align: start;
}
html[dir="rtl"] .modal-footer,
html[dir="rtl"] .modal-actions {
  direction: rtl;
}

.order-actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.whatsapp-btn {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.receipt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  place-items: center;
  z-index: 1200;
  padding: 1rem;
}

.receipt-modal-backdrop.show {
  display: grid;
}

.receipt-modal {
  width: min(100%, 420px);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.receipt-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.receipt-modal-toolbar h2 {
  margin: 0;
  font-size: 1rem;
}

.receipt-modal-actions {
  display: flex;
  gap: 0.5rem;
}

.receipt-paper {
  padding: 1rem 1.1rem 1.25rem;
  color: #111827;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.45;
  background: #fff;
}

.receipt-header {
  text-align: center;
  margin-bottom: 0.75rem;
}

.receipt-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 0.5rem;
  display: block;
}

.receipt-store-name {
  margin: 0 0 0.25rem;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
}

.receipt-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.receipt-meta,
.receipt-totals {
  display: grid;
  gap: 0.35rem;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.receipt-row-block {
  flex-direction: column;
  align-items: stretch;
}

.receipt-row-block strong {
  white-space: pre-wrap;
  font-weight: 600;
}

.receipt-divider {
  border-top: 1px dashed #9ca3af;
  margin: 0.75rem 0;
}

.receipt-items-head {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.receipt-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.receipt-items-table th,
.receipt-items-table td {
  padding: 0.25rem 0;
  vertical-align: top;
}

.receipt-items-table th {
  font-weight: 700;
  border-bottom: 1px solid #d1d5db;
}

.receipt-items-table td:last-child,
.receipt-items-table th:last-child {
  text-align: end;
}

.receipt-items-table td:nth-child(2),
.receipt-items-table th:nth-child(2),
.receipt-items-table td:nth-child(3),
.receipt-items-table th:nth-child(3) {
  text-align: center;
  white-space: nowrap;
}

.receipt-total-row {
  font-size: 13px;
  font-weight: 700;
  padding-top: 0.25rem;
  border-top: 1px solid #111827;
  margin-top: 0.25rem;
}

.receipt-thanks {
  text-align: center;
  margin: 0.85rem 0 0;
  font-size: 11px;
}

.receipt-paper[dir="rtl"] .receipt-items-table td:last-child,
.receipt-paper[dir="rtl"] .receipt-items-table th:last-child {
  text-align: start;
}

.receipt-paper[dir="rtl"] .receipt-row {
  direction: rtl;
}

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

  body.printing-receipt * {
    visibility: hidden;
  }

  body.printing-receipt #receiptModal,
  body.printing-receipt #receiptModal * {
    visibility: visible;
  }

  body.printing-receipt #receiptModal {
    position: absolute;
    inset: 0;
    display: block !important;
    background: #fff;
    padding: 0;
  }

  body.printing-receipt .receipt-modal {
    width: 80mm;
    max-width: 80mm;
    margin: 0 auto;
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border-radius: 0;
  }

  body.printing-receipt .no-print,
  body.printing-receipt .receipt-modal-toolbar {
    display: none !important;
  }

  body.printing-receipt #receiptPrintArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 0;
  }

  body.printing-receipt .topbar,
  body.printing-receipt .shell,
  body.printing-receipt .toast-stack,
  body.printing-receipt .subscription-banner {
    display: none !important;
  }
}
html[dir="rtl"] .toolbar {
  direction: rtl;
}

.panel-subcard {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.panel-subcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-subcard-head .soft + .soft {
  margin-inline-start: 0;
}

.kuwait-missing-count {
  margin: 0 0 12px;
}

.panel-subcard-head h3 {
  margin: 0 0 4px;
}

.kuwait-governorate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.kuwait-governorate-row {
  display: grid;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  min-width: 0;
}

.kuwait-governorate-row.is-disabled {
  opacity: 0.72;
  background: #f8fafc;
}

.kuwait-governorate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.kuwait-governorate-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.status-toggle input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.kuwait-governorate-areas {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.kuwait-areas-heading {
  font-size: 12px;
  font-weight: 700;
}

.kuwait-area-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-inline-end: 4px;
}

.kuwait-area-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
  min-width: 0;
}

.kuwait-area-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
}

.kuwait-area-empty {
  margin: 0;
  font-size: 12px;
}

.kuwait-governorate-inputs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kuwait-governorate-field {
  display: grid;
  gap: 4px;
}

.kuwait-governorate-field span {
  font-size: 12px;
}

.kuwait-governorate-min-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
}

.kuwait-governorate-name {
  font-weight: 800;
}

.kuwait-governorate-meta {
  font-size: 12px;
}

.kuwait-governorate-enabled {
  flex-shrink: 0;
}

.kuwait-setup-save {
  grid-column: 1 / -1;
  justify-self: start;
}

.kuwait-setup-note {
  margin: 12px 0 0;
}

.package-wallet-detail {
  margin-top: 16px;
}

.package-wallet-tx-list,
.package-wallet-tx-mini {
  display: grid;
  gap: 8px;
}

.package-wallet-tx-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
  font-size: 13px;
}

.package-wallet-order-block {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.package-wallet-deduct-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.package-wallet-deduct-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.package-wallet-deduct-hint {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
}

.package-wallets-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.package-wallets-table,
.package-wallet-tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.package-wallets-table th,
.package-wallets-table td,
.package-wallet-tx-table th,
.package-wallet-tx-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

.package-wallets-table tr.selected td {
  background: rgba(30, 95, 140, 0.06);
}

.package-wallet-row-actions {
  white-space: nowrap;
}

.package-wallet-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 8px 0 12px;
  font-size: 12px;
}

.package-credit-added-badge {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--primary, #1e5f8c);
}

.subscription-blocked-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 72px);
  padding: 24px;
}

.subscription-blocked-card {
  width: min(100%, 520px);
  padding: 32px 28px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.subscription-blocked-card h1 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.subscription-blocked-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.subscription-blocked-card .soft + .soft {
  margin-inline-start: 8px;
}

.cleanup-note {
  margin: 0 0 12px;
}

.cleanup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.confirm-modal h2 {
  margin: 0 0 10px;
}

.confirm-modal p {
  margin: 0 0 16px;
  color: var(--muted);
}

/* ——— Merchant admin: touch-friendly order actions ——— */
.merchant-admin .order-status-row,
.merchant-admin .order-actions-row,
.merchant-admin .status-actions {
  width: 100%;
}

/* ——— Responsive: iPad & iPhone ——— */
@media (max-width: 1024px) {
  .business-list-table-wrap {
    display: none;
  }

  .business-list-cards {
    display: grid;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .hero-panel > button,
  .hero-panel > .soft {
    flex: 1 1 auto;
    min-width: 0;
  }

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

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  }

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

  .kuwait-governorate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-subcard-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-subcard-head .soft {
    width: 100%;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .shell,
  .panel,
  .view,
  .orders-grid,
  .mobile-orders-list {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell {
    padding: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
    gap: 14px;
    display: grid;
  }

  .panel {
    padding: 16px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
    min-height: var(--admin-touch);
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar nav {
    width: 100%;
    max-width: 100%;
    order: 3;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 8px;
  }

  .topbar nav a,
  .topbar nav button {
    display: inline-flex;
    align-items: center;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }

  .order-bell-btn,
  .enable-sound-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .order-bell-label {
    font-size: 12px;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  .tab {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: unset;
    white-space: normal;
    line-height: 1.25;
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
  }

  .grid-form label,
  .grid-form input,
  .grid-form select,
  .grid-form textarea,
  .grid-form button {
    width: 100%;
    max-width: 100%;
  }

  .hero-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .hero-panel h1 {
    font-size: clamp(24px, 7vw, 34px);
  }

  .hero-panel > button,
  .hero-panel > .soft,
  .cleanup-actions button {
    width: 100%;
  }

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

  .stat strong {
    font-size: 26px;
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head-stack .toolbar {
    justify-content: stretch;
  }

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

  .export-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .export-toolbar .export-btn {
    width: 100%;
    min-width: 0;
  }

  .view.active {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .list-grid,
  .products-grid {
    grid-template-columns: 1fr;
  }

  .orders-grid,
  .mobile-orders-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .order-card {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 0;
  }

  .order-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .order-card-head h3 {
    font-size: clamp(17px, 4.5vw, 20px);
  }

  .order-card-badges {
    width: 100%;
  }

  .status-badge {
    white-space: normal;
    text-align: center;
  }

  .order-details {
    grid-template-columns: 1fr;
  }

  .order-card-actions,
  .order-status-row,
  .order-actions-row,
  .status-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .order-card-actions button,
  .order-card-actions select,
  .order-status-row button,
  .order-status-row select,
  .order-actions-row button,
  .status-actions button,
  .status-btn {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
  }

  .order-status-select {
    flex: 1 1 auto;
    width: 100%;
    font-size: 16px;
  }

  .business-card-meta {
    grid-template-columns: 1fr;
  }

  .business-card-actions button {
    flex: 1 1 100%;
    min-width: 0;
  }

  .branding-preview {
    grid-template-columns: 1fr;
  }

  .brand-preview-card.banner img {
    height: 120px;
  }

  .kuwait-governorate-grid {
    grid-template-columns: 1fr;
  }

  .kuwait-governorate-inputs {
    grid-template-columns: 1fr;
  }

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

  .product-modal .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-footer,
  .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 18%);
    padding-top: 12px;
    margin-top: 8px;
  }

  .modal-footer button,
  .modal-actions button {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
  }

  .modal {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - var(--safe-top) - 24px);
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(20px + var(--safe-bottom));
    overflow-x: hidden;
  }

  .package-wallets-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .package-wallets-table,
  .package-wallet-tx-table {
    min-width: 0;
  }

  .receipt-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .receipt-modal {
    width: 100%;
    max-height: calc(100dvh - var(--safe-top));
    border-radius: 18px 18px 0 0;
    padding-bottom: var(--safe-bottom);
  }

  .toast-stack {
    top: calc(72px + var(--safe-top));
    inset-inline: 12px;
    inset-inline-end: 12px;
    max-width: none;
  }

  .subscription-blocked-page {
    min-height: calc(100dvh - 120px);
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  .subscription-blocked-card {
    padding: 24px 18px;
  }

  .subscription-blocked-card .soft {
    width: 100%;
    margin: 6px 0 0 !important;
  }

  .recent-order-row {
    flex-direction: column;
    align-items: stretch;
  }

  .recent-order-meta {
    justify-items: start;
    text-align: start;
  }

  .item-card .row,
  .product-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .thumb-lg {
    width: 100%;
    height: auto;
    max-height: 200px;
  }

  .actions-cell button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .login-page {
    padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  }

  .login-card {
    width: 100%;
    max-width: 100%;
    padding: 24px 20px;
    border-radius: 20px;
  }

  .login-card h1 {
    font-size: clamp(22px, 6vw, 28px);
  }

  .login-card form button {
    width: 100%;
  }

  .receipt-items-table {
    font-size: 12px;
    table-layout: fixed;
  }

  .receipt-items-table th,
  .receipt-items-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .shell,
  .admin-main,
  .dashboard-container {
    max-width: 100%;
    padding: 20px calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: visible;
  }

  .tab {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    white-space: nowrap;
  }

  .stats,
  .stats-dashboard,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

@media (min-width: 769px) {
  .mobile-orders-list {
    display: grid;
  }
}

html[dir="rtl"] .business-card-head,
html[dir="rtl"] .business-card-meta,
html[dir="rtl"] .business-card-actions {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .business-card-meta dt,
html[dir="rtl"] .business-card-meta dd {
  text-align: right;
}

html[dir="rtl"] select {
  background-position: 12px calc(50% + 2px), 18px calc(50% + 2px);
  padding-inline-start: 36px;
  padding-inline-end: 13px;
}

/* ——— Merchant admin dashboard: mobile / iPad (no horizontal page scroll) ——— */
.merchant-admin,
.merchant-admin.admin-page {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  touch-action: pan-y;
}

.merchant-admin img,
.merchant-admin svg,
.merchant-admin canvas,
.merchant-admin table,
.merchant-admin pre {
  max-width: 100%;
}

.merchant-admin .admin-shell,
.merchant-admin .admin-main,
.merchant-admin .dashboard-container,
.merchant-admin .restaurant-admin,
.merchant-admin .admin-content,
.merchant-admin .page-section,
.merchant-admin .shell,
.merchant-admin .panel,
.merchant-admin .view,
.merchant-admin .view.active {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.merchant-admin .shell {
  width: 100%;
  margin: 0 auto;
}

.merchant-admin .topbar {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.merchant-admin .topbar nav {
  max-width: 100%;
}

.merchant-admin .toolbar input,
.merchant-admin .toolbar select {
  min-width: 0;
  max-width: 100%;
}

.merchant-admin .products-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

.merchant-admin .list-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.merchant-admin .orders-grid,
.merchant-admin .mobile-orders-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.merchant-admin #packageWalletsList.wallets-grid {
  display: block;
  width: 100%;
  max-width: 100%;
}

.merchant-admin .package-wallets-table-wrap {
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: contain;
}

.merchant-admin .package-wallets-table,
.merchant-admin .package-wallet-tx-table {
  table-layout: fixed;
  min-width: 0;
}

.merchant-admin .package-wallets-table th,
.merchant-admin .package-wallets-table td,
.merchant-admin .package-wallet-tx-table th,
.merchant-admin .package-wallet-tx-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .merchant-admin .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .merchant-admin .topbar nav,
  .merchant-admin .top-actions,
  .merchant-admin .admin-top-actions,
  .merchant-admin .header-actions {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: auto;
  }

  .merchant-admin .topbar nav a,
  .merchant-admin .topbar nav button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    justify-content: center;
  }

  .merchant-admin .tabs,
  .merchant-admin .admin-tabs,
  .merchant-admin .dashboard-tabs,
  .merchant-admin .tab-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
  }

  .merchant-admin .tab {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: unset;
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  .merchant-admin .stats,
  .merchant-admin .stats-dashboard,
  .merchant-admin .stats-grid,
  .merchant-admin .dashboard-stats,
  .merchant-admin .cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }

  .merchant-admin .stat,
  .merchant-admin .admin-card,
  .merchant-admin .order-card,
  .merchant-admin .wallet-card,
  .merchant-admin .settings-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .merchant-admin .hero-panel,
  .merchant-admin .dashboard-hero,
  .merchant-admin .admin-hero,
  .merchant-admin .restaurant-hero {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .merchant-admin .toolbar input,
  .merchant-admin .toolbar select {
    flex: 1 1 100%;
  }

  .merchant-admin .export-toolbar,
  .merchant-admin .export-actions,
  .merchant-admin .actions-row,
  .merchant-admin .filters-row {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .merchant-admin .export-toolbar .export-btn,
  .merchant-admin .export-actions button,
  .merchant-admin .actions-row button,
  .merchant-admin .filters-row button,
  .merchant-admin .filters-row input,
  .merchant-admin .filters-row select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .merchant-admin .admin-main,
  .merchant-admin .dashboard-container,
  .merchant-admin .restaurant-admin,
  .merchant-admin .admin-content,
  .merchant-admin .shell {
    padding: 12px;
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
    margin: 0;
  }

  .merchant-admin .hero-panel,
  .merchant-admin .dashboard-hero,
  .merchant-admin .admin-hero,
  .merchant-admin .restaurant-hero {
    padding: 18px 14px;
    border-radius: 22px;
  }

  .merchant-admin .hero-panel h1,
  .merchant-admin .dashboard-hero h1,
  .merchant-admin .admin-hero h1,
  .merchant-admin .restaurant-hero h1 {
    font-size: 26px;
    line-height: 1.25;
  }

  .merchant-admin .orders-grid,
  .merchant-admin .mobile-orders-list,
  .merchant-admin .wallets-grid,
  .merchant-admin .products-grid,
  .merchant-admin .categories-grid,
  .merchant-admin #categories.list-grid,
  .merchant-admin #deliveryAreas.list-grid {
    grid-template-columns: 1fr;
  }

  .merchant-admin .export-toolbar .export-btn,
  .merchant-admin .export-actions button,
  .merchant-admin .actions-row button,
  .merchant-admin .filters-row button,
  .merchant-admin .filters-row input,
  .merchant-admin .filters-row select {
    flex: 1 1 100%;
    width: 100%;
  }

  .merchant-admin .package-wallets-table-wrap {
    overflow-x: hidden;
  }

  .merchant-admin .package-wallet-row-actions {
    white-space: normal;
  }

  .merchant-admin .package-wallet-row-actions button {
    width: 100%;
    margin-top: 4px;
  }

  .merchant-admin .modal,
  .merchant-admin .admin-modal,
  .merchant-admin .dialog,
  .merchant-admin .product-modal {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    margin-left: auto;
    margin-right: auto;
  }

  .merchant-admin .modal-backdrop {
    padding-left: 12px;
    padding-right: 12px;
  }

  .merchant-admin .receipt-modal {
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .merchant-admin .admin-main,
  .merchant-admin .dashboard-container,
  .merchant-admin .restaurant-admin,
  .merchant-admin .admin-content,
  .merchant-admin .shell {
    padding: 20px;
    padding-left: calc(20px + var(--safe-left));
    padding-right: calc(20px + var(--safe-right));
  }

  .merchant-admin .orders-grid,
  .merchant-admin .mobile-orders-list,
  .merchant-admin .wallets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .merchant-admin .list-grid,
  .merchant-admin .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
