﻿:root {
  --bg-main: #f6f1e6;
  --bg-gradient-a: #fff8de;
  --bg-gradient-b: #e9f5ea;
  --surface: #fffdf8;
  --surface-soft: #f7f2e6;
  --ink: #1f2a25;
  --muted: #66746c;
  --line: #e2dccf;
  --accent: #138a5f;
  --accent-strong: #0c6d4a;
  --accent-soft: #d6f2e5;
  --warning: #f5a524;
  --danger: #b0492f;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 30px rgba(31, 42, 37, 0.11);
  --topbar-height: 74px;
  --category-nav-height: 60px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  line-height: 1.35;
  background:
    radial-gradient(circle at 0% 0%, var(--bg-gradient-a) 0, rgba(255, 248, 222, 0) 35%),
    radial-gradient(circle at 100% 0%, var(--bg-gradient-b) 0, rgba(233, 245, 234, 0) 40%),
    var(--bg-main);
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 44px;
}

.page {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 230, 0.92);
  backdrop-filter: blur(12px);
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.brand-kicker {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.horizontal-toggle-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.horizontal-toggle-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(19, 138, 95, 0.22);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 35, 28, 0.14);
}

.cart-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(19, 138, 95, 0.28);
  transition: transform 0.18s ease;
}

.cart-btn:hover {
  transform: translateY(-1px);
}

.cart-btn.bump {
  animation: cartBump 0.28s ease;
}

@keyframes cartBump {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.cart-icon {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cart-count {
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  padding: 2px 8px;
  font-weight: 700;
}

.hero {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 237, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
}

.hero-label {
  margin: 0 0 8px;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent-strong);
}

.hero h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}

.hero-copy {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 800px;
  line-height: 1.45;
}

.category-nav {
  position: sticky;
  top: var(--topbar-height);
  z-index: 1050;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  margin: 0 -2px 20px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(246, 241, 230, 0.98), rgba(246, 241, 230, 0.76));
}

.category-nav::-webkit-scrollbar {
  height: 8px;
}

.category-nav::-webkit-scrollbar-thumb {
  background: #c7c1b4;
  border-radius: 999px;
}

.category-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.category-chip .chip-count {
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}

.category-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(20, 35, 28, 0.12);
}

.category-chip.active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 18px rgba(16, 109, 76, 0.24);
}

.category-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

.catalog-sections {
  display: grid;
  gap: clamp(20px, 3vw, 30px);
}

.category-section {
  scroll-margin-top: calc(var(--topbar-height) + var(--category-nav-height) + 14px);
}

.category-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.category-header h3 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  letter-spacing: 0.01em;
}

.category-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 8px 16px rgba(20, 35, 28, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(20, 35, 28, 0.12);
}

.square-image {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid #ece7db;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.square-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: inherit;
  background: linear-gradient(145deg, #fbf7ec, #f2ecdf);
  color: var(--muted);
  border: 1px dashed #d4cdbf;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.square-no-image {
  font-size: 0.85rem;
  padding: 10px;
}

.product-name {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.35;
  min-height: 2.45em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.variant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.variant-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.variant-chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.product-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  font-weight: 800;
  color: var(--accent-strong);
}

.add-btn {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f6b03a, #eb8f21);
  color: #2c2100;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.add-btn:hover {
  filter: brightness(1.05);
}

.cart-header {
  margin-bottom: 14px;
}

.cart-header h2 {
  margin: 0;
}

.cart-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr);
  gap: 16px;
}

.cart-workspace {
  display: grid;
  gap: 12px;
}

.cart-tools-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 8px 16px rgba(20, 35, 28, 0.05);
}

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

.section-heading h3 {
  margin: 0;
  font-size: 0.98rem;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.entry-field span {
  font-weight: 700;
  font-size: 0.82rem;
  color: #495851;
}

.entry-field input {
  width: 100%;
  border: 1px solid #d8d1c2;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

.read-only-input {
  background: #f2ecdf !important;
  color: var(--muted) !important;
}

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

.manual-entry-actions {
  margin-top: 10px;
}

.manual-add-btn {
  margin-top: 0;
}

.inline-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7f2e6;
  color: var(--ink);
  font-size: 0.84rem;
}

.inline-result.is-success {
  border-color: #cbe7d8;
  background: #eef7f2;
  color: var(--accent-strong);
}

.inline-result.is-error {
  border-color: #efc0b5;
  background: #fdeae6;
  color: #9d3f29;
}

.cart-items {
  display: grid;
  gap: 12px;
}

.cart-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.cart-thumb {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 1px solid #ece7db;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-no-image {
  font-size: 0.72rem;
  padding: 6px;
}

.cart-main {
  display: grid;
  gap: 10px;
}

.cart-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cart-name {
  margin: 0;
  font-size: 0.96rem;
}

.cart-category {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.cart-manual-flag {
  margin: 4px 0 0;
  color: #735411;
  font-size: 0.76rem;
  font-weight: 700;
}

.cart-variant {
  margin: 4px 0 0;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.remove-btn {
  border: 0;
  background: #fbe8e1;
  color: var(--danger);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  align-self: flex-start;
}

.cart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
}

.step-btn {
  border: 0;
  background: #ffffff;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.step-btn:disabled,
.remove-btn:disabled,
.price-edit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.qty-input {
  border: 0;
  width: 44px;
  text-align: center;
  background: #fffdf8;
  height: 30px;
}

.price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 9px;
}

.price-editor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.price-input {
  border: 0;
  width: 90px;
  outline: none;
}

.qty-input[readonly],
.price-input[readonly] {
  background: #f8f5ed;
  color: var(--muted);
}

.price-edit-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
}

.line-total {
  margin-left: auto;
  font-weight: 800;
  color: var(--accent-strong);
}

.bill-summary {
  position: sticky;
  top: 88px;
  height: fit-content;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #fffef9, #f6f2e8);
  padding: 16px;
  box-shadow: var(--shadow);
}

.bill-summary h3 {
  margin: 0 0 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  color: var(--muted);
}

.summary-row strong {
  color: var(--ink);
}

.total-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cfcabd;
}

.total-row strong {
  font-size: 1.1rem;
  color: var(--accent-strong);
}

.primary-wide {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.primary-wide:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.12);
}

.ghost-wide {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.upi-pay-btn {
  width: 100%;
  margin-top: 12px;
  border-radius: 12px;
  padding: 11px 14px;
  background: #222;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.order-mode-notice,
.order-status-notice {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.3;
}

.order-mode-notice {
  background: #eef7f2;
  border: 1px solid #cbe7d8;
  color: var(--accent-strong);
}

.order-status-notice {
  background: #fff3d7;
  border: 1px solid #f0d08a;
  color: #735411;
}

.order-placement-result {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #cbe7d8;
  background: #eef7f2;
  color: var(--accent-strong);
  font-size: 0.86rem;
  line-height: 1.35;
}

.review-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.review-header h2 {
  margin: 0;
}

.review-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.review-mode-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.review-mode-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.review-mode-tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.review-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdf8;
  padding: 12px;
}

.review-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

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

.review-field span {
  font-weight: 700;
  font-size: 0.84rem;
  color: #495851;
}

.review-field input {
  border: 1px solid #d8d1c2;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

.review-actions {
  margin-top: 10px;
}

.review-actions .primary-wide {
  margin-top: 0;
}

.review-helper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.review-message {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f2e6;
  border: 1px solid var(--line);
  color: var(--ink);
}

.shopkeeper-review-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.shopkeeper-order-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.shopkeeper-order-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.shopkeeper-order-row .mini-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.shopkeeper-order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-cart {
  border: 1px dashed #cfc8ba;
  border-radius: var(--radius-md);
  background: #fffdf8;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

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

@media (max-width: 1080px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 980px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .bill-summary {
    position: static;
  }

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

@media (max-width: 760px) {
  .topbar {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 10px;
  }

  .brand-kicker {
    font-size: 0.68rem;
  }

  .brand-title {
    font-size: 0.98rem;
  }

  .ghost-btn,
  .cart-btn {
    padding: 8px 11px;
    font-size: 0.84rem;
  }

  .cart-count {
    min-width: 24px;
    min-height: 24px;
    font-size: 0.76rem;
  }

  .page {
    padding: 12px;
  }

  .hero {
    padding: 16px;
  }

  .hero-copy {
    font-size: 0.88rem;
  }

  .category-nav {
    margin: 0 0 14px;
    padding: 10px 0;
    gap: 8px;
  }

  .category-chip {
    padding: 7px 11px;
    font-size: 0.84rem;
  }

  .category-chip .chip-count {
    min-width: 20px;
    min-height: 20px;
    font-size: 0.72rem;
  }

  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .product-card {
    padding: 8px;
    gap: 6px;
    border-radius: 12px;
  }

  .square-image {
    padding: 5px;
  }

  .product-name {
    font-size: 0.78rem;
    min-height: 2.1em;
    line-height: 1.22;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .variant-chip {
    font-size: 0.66rem;
    padding: 4px 6px;
  }

  .product-price {
    font-size: 0.82rem;
  }

  .add-btn {
    width: 100%;
    padding: 7px 8px;
    font-size: 0.79rem;
    border-radius: 10px;
  }

  .cart-item {
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 10px;
  }

  .manual-entry-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding-bottom: 28px;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .brand-wrap {
    max-width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .hero {
    padding: 14px;
  }

  .hero-label {
    margin-bottom: 6px;
    font-size: 0.7rem;
  }

  .hero h2 {
    font-size: 1.05rem;
  }

  .hero-copy {
    margin-top: 8px;
    font-size: 0.82rem;
  }

  .category-nav {
    gap: 7px;
    padding: 8px 0;
    margin: 0 0 12px;
  }

  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .product-card {
    padding: 7px;
    gap: 5px;
    border-radius: 12px;
  }

  .square-image {
    padding: 4px;
  }

  .product-name {
    font-size: 0.72rem;
    min-height: 1.95em;
    line-height: 1.16;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .variant-chip {
    font-size: 0.62rem;
    padding: 3px 6px;
  }

  .product-price {
    font-size: 0.76rem;
  }

  .add-btn {
    width: 100%;
    padding: 6px 6px;
    font-size: 0.72rem;
    border-radius: 8px;
  }

  .category-header {
    margin-bottom: 8px;
  }

  .category-header h3 {
    font-size: 0.95rem;
  }

  .category-header p {
    font-size: 0.76rem;
  }

  .cart-header h2 {
    font-size: 1.08rem;
  }

  .cart-item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  .cart-name {
    font-size: 0.85rem;
  }

  .cart-category {
    font-size: 0.74rem;
  }

  .remove-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .cart-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .qty-stepper,
  .price-editor,
  .price-wrap {
    width: 100%;
    justify-content: center;
  }

  .price-editor {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .price-wrap {
    padding: 4px 7px;
  }

  .price-input {
    width: 64px;
  }

  .line-total {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
    text-align: right;
    font-size: 0.88rem;
  }

  .bill-summary {
    padding: 14px;
  }

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

  .review-mode-tabs {
    flex-direction: column;
  }

  .shopkeeper-order-actions .ghost-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .page {
    padding: 10px;
  }

  .hero {
    padding: 12px;
  }

  .hero-copy {
    display: none;
  }

  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .product-name {
    font-size: 0.68rem;
    min-height: 1.86em;
  }

  .add-btn {
    padding: 5px;
    font-size: 0.68rem;
  }

  .product-price {
    font-size: 0.72rem;
  }

  .cart-btn {
    padding: 7px 10px;
  }
}

@media (hover: none) {
  .product-card:hover,
  .category-chip:hover,
  .ghost-btn:hover,
  .cart-btn:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Force mobile portrait layout */
.mobile-lock {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 0% 0%, #fff8de 0, rgba(255, 248, 222, 0) 35%),
    radial-gradient(circle at 100% 0%, #e9f5ea 0, rgba(233, 245, 234, 0) 40%),
    #f6f1e6;
}

.mobile-lock-card {
  width: min(420px, 100%);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.mobile-lock-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.mobile-lock-card p {
  margin: 0;
  color: var(--muted);
}

.lock-toggle-btn {
  margin-top: 14px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.page {
  max-width: 460px;
  padding: 10px;
}

.topbar {
  max-width: 460px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 10px;
}

.brand-kicker {
  font-size: 0.68rem;
}

.brand-title {
  font-size: 0.95rem;
}

.ghost-btn,
.cart-btn {
  padding: 7px 10px;
  font-size: 0.8rem;
}

.category-nav {
  margin: 0 0 10px;
  padding: 8px 0;
  gap: 7px;
}

.category-chip {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.category-chip .chip-count {
  min-width: 19px;
  min-height: 19px;
  font-size: 0.7rem;
}

.products-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.product-card {
  padding: 7px;
  gap: 5px;
  border-radius: 12px;
}

.square-image {
  padding: 4px;
}

.product-name {
  font-size: 0.72rem;
  min-height: 1.95em;
  line-height: 1.16;
}

.product-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

.product-price {
  font-size: 0.76rem;
}

.add-btn {
  width: 100%;
  padding: 6px 6px;
  font-size: 0.71rem;
  border-radius: 8px;
}

.cart-layout {
  grid-template-columns: 1fr;
}

.bill-summary {
  position: static;
  padding: 14px;
}

.cart-item {
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  padding: 9px;
}

.cart-name {
  font-size: 0.85rem;
}

.cart-category {
  font-size: 0.74rem;
}

.remove-btn {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.cart-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.qty-stepper,
.price-editor,
.price-wrap {
  width: 100%;
  justify-content: center;
}

.price-editor {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.price-wrap {
  padding: 4px 7px;
}

.price-input {
  width: 60px;
}

.line-total {
  grid-column: 1 / -1;
  width: 100%;
  margin-left: 0;
  text-align: right;
  font-size: 0.88rem;
}

@media (max-width: 370px) {
  .products-grid {
    gap: 6px;
  }

  .product-name {
    font-size: 0.68rem;
  }

  .add-btn {
    padding: 5px;
    font-size: 0.67rem;
  }
}

@media (min-width: 768px), (orientation: landscape) {
  body:not(.horizontal-mode-enabled) .app-shell {
    display: none;
  }

  body:not(.horizontal-mode-enabled) .mobile-lock {
    display: flex;
  }
}

/* Strong WordPress-safe mobile portrait overrides */
@media (max-width: 767px) and (orientation: portrait) {
  .app-shell .products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .app-shell .product-card {
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px !important;
    gap: 4px !important;
    border-radius: 10px !important;
  }

  .app-shell .square-image {
    padding: 3px !important;
  }

  .app-shell .product-name {
    font-size: 0.66rem !important;
    line-height: 1.12 !important;
    min-height: 1.8em !important;
  }

  .app-shell .product-footer {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  .app-shell .product-price {
    font-size: 0.7rem !important;
  }

  .app-shell .add-btn {
    width: 100% !important;
    padding: 4px !important;
    font-size: 0.64rem !important;
    border-radius: 7px !important;
  }
}
