:root {
  color-scheme: light;
  --bg: #eef5f3;
  --surface: #ffffff;
  --surface-2: #e3f1ec;
  --ink: #102027;
  --muted: #62727a;
  --line: #cbd9d5;
  --brand: #0f6f65;
  --brand-dark: #0b2f3a;
  --accent: #f4b63f;
  --green: #16a36b;
  --danger: #d64545;
  --shadow: 0 18px 44px rgba(16, 32, 39, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 111, 101, 0.18), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px 112px;
}

.admin-shell {
  padding-bottom: 32px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-dark);
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.05;
  font-size: 18px;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cart-pill {
  display: inline-flex;
  min-width: 64px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
}

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

.admin-pill {
  display: inline-flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(15, 111, 101, 0.28);
  border-radius: 999px;
  background: #e8f8f1;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.cart-icon::before {
  content: "▣";
  color: var(--brand);
  font-weight: 800;
}

.welcome {
  overflow: hidden;
  position: relative;
  min-height: 210px;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(11, 47, 58, 0.94), rgba(15, 111, 101, 0.72)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1200&q=80") center/cover;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.welcome::after {
  content: "";
  position: absolute;
  right: -24px;
  top: 28px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.welcome > div {
  position: relative;
  z-index: 1;
  max-width: 350px;
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--brand);
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}

.welcome p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.45;
}

.search-card,
.section-block,
.quick-actions,
.promo-strip {
  margin-top: 18px;
}

.search-field {
  display: flex;
  height: 54px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(16, 32, 39, 0.07);
}

.search-field span {
  color: var(--brand);
  font-size: 24px;
  line-height: 1;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

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

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.2;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.category-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(15, 111, 101, 0.22);
  border-radius: 999px;
  background: var(--surface);
}

.category-toggle[aria-expanded="true"] {
  background: var(--brand);
  color: #ffffff;
}

.category-dropdown {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(16, 32, 39, 0.07);
}

.category-dropdown[hidden] {
  display: none;
}

.category-dropdown p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

.category-menu button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.category-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  cursor: grab;
  scroll-behavior: smooth;
  touch-action: pan-y;
  user-select: none;
}

.category-grid[hidden] {
  display: none;
}

.category-grid.is-hidden {
  display: none !important;
}

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

.category-grid.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.category-chip.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

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

.promo-card {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.promo-card.primary {
  border-color: rgba(244, 182, 63, 0.44);
  background: linear-gradient(135deg, #fff7df, #ffffff);
}

.promo-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.promo-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.18;
}

.promo-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.action-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.action-button.dark {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #ffffff;
}

.action-button.manager {
  grid-column: 1 / -1;
  border-color: rgba(22, 163, 107, 0.42);
  background: #e8f8f1;
  color: #08724f;
}

.manager-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(22, 163, 107, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, #e8f8f1, #ffffff);
}

.manager-block h2 {
  margin: 0;
}

.manager-block p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.manager-block .manager {
  margin-top: 4px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.product-thumb {
  display: grid;
  width: 64px;
  height: 64px;
  min-width: 64px;
  place-items: center;
  align-self: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 28px;
  overflow: hidden;
}

.product-thumb img,
.admin-thumb img,
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb img,
.admin-thumb img {
  border-radius: 8px;
}

.product-thumb span {
  display: block;
}

.product-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.product-card strong {
  display: block;
  margin-top: 7px;
  font-size: 15px;
}

.product-modal {
  max-height: min(90vh, 780px);
}

.product-detail {
  display: grid;
  gap: 16px;
  padding: 16px 18px 20px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
}

.detail-image {
  display: grid;
  min-height: 132px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 44px;
}

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

.detail-main h3 {
  margin: 6px 0 12px;
  font-size: 20px;
  line-height: 1.18;
}

.sku {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.price-grid {
  display: grid;
  gap: 8px;
}

.price-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.price-grid span,
.cart-summary span {
  display: block;
}

.price-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.stock {
  margin: 10px 0 0;
  font-weight: 800;
}

.in-stock {
  color: var(--green);
}

.out-stock {
  color: var(--danger);
}

.detail-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.detail-section p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.spec-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.variant-row {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.variant-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.variant-row div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-row button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.detail-actions {
  display: grid;
  gap: 10px;
}

.buy-now {
  border-color: var(--accent);
  background: var(--accent);
  color: #111827;
}

.similar-list {
  display: grid;
  gap: 8px;
}

.similar-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.similar-card > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
}

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

.similar-card strong {
  font-size: 13px;
}

.similar-card small {
  color: var(--muted);
  font-weight: 800;
}

.add-button {
  width: 42px;
  height: 42px;
  justify-self: end;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #111827;
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.cart-bar {
  position: fixed;
  z-index: 5;
  right: max(16px, calc((100vw - 520px) / 2 + 16px));
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: max(16px, calc((100vw - 520px) / 2 + 16px));
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(11, 47, 58, 0.96);
  color: #ffffff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.cart-bar span,
.cart-bar strong {
  display: block;
}

.cart-bar span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.cart-bar strong {
  margin-top: 3px;
  font-size: 19px;
}

.cart-bar button,
.pay-button,
.payment-methods button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.cart-bar button {
  min-width: 116px;
  background: #ffffff;
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 23, 30, 0.48);
}

.modal-backdrop.open {
  display: flex;
}

.cart-modal {
  width: min(100%, 520px);
  max-height: min(86vh, 720px);
  overflow: auto;
  border-radius: 16px 16px 8px 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-edit-modal {
  max-height: min(90vh, 760px);
}

.modal-form {
  padding: 16px 18px 18px;
}

.modal-head,
.cart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.cart-items {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
}

.cart-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

.cart-item h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.cart-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 34px 34px 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.qty-control button {
  height: 34px;
  border: 0;
  background: var(--surface-2);
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
}

.qty-control span {
  text-align: center;
  font-weight: 800;
}

.checkout-panel {
  display: grid;
  gap: 12px;
  padding: 0 18px 16px;
}

.checkout-panel[hidden],
.payment-screen[hidden] {
  display: none;
}

.checkout-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkout-panel input,
.checkout-panel select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: 0;
}

.payment-screen {
  padding: 20px 18px;
  text-align: center;
}

.success-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: #e8f8f1;
  color: var(--green);
  font-size: 30px;
  font-weight: 800;
}

.payment-screen p {
  color: var(--muted);
  line-height: 1.45;
}

.payment-methods {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.payment-methods button,
.pay-button {
  background: var(--brand);
  color: #ffffff;
}

.payment-methods button:last-child {
  background: var(--brand-dark);
}

.cart-summary {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.cart-summary span,
.cart-summary strong {
  display: block;
}

.cart-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.cart-summary strong {
  margin-top: 4px;
  font-size: 22px;
}

.pay-button {
  min-width: 172px;
  padding: 0 16px;
}

.pay-button:disabled {
  background: #b8c5c1;
  cursor: not-allowed;
}

.admin-panel[hidden] {
  display: none;
}

.admin-login[hidden] {
  display: none;
}

.admin-login {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-login h1 {
  color: var(--ink);
}

.admin-login p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.admin-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-card {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.admin-action-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  padding: 12px;
}

.admin-form input,
.admin-form select {
  min-height: 46px;
}

.admin-form textarea {
  resize: vertical;
}

.image-preview {
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
  font-weight: 700;
}

.image-preview img {
  max-height: 220px;
}

.admin-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

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

.admin-thumb {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 25px;
}

.admin-item h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.admin-item p,
.admin-item small {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.admin-item-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.admin-item-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
}

.admin-item-actions .danger {
  border-color: rgba(214, 69, 69, 0.28);
  background: #fff1f1;
  color: var(--danger);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 94px;
  left: 18px;
  max-width: 484px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: #102027;
  color: #ffffff;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.22s ease;
  pointer-events: none;
  text-align: center;
  font-weight: 700;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 390px) {
  .promo-strip,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-columns: 56px minmax(0, 1fr) 42px;
  }

  .product-thumb {
    width: 56px;
    height: 56px;
    min-width: 56px;
  }

  .detail-hero,
  .similar-card {
    grid-template-columns: 1fr;
  }

  .detail-image {
    min-height: 210px;
  }

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

  .pay-button {
    width: 100%;
  }

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

  .top-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .admin-form-actions,
  .admin-item-actions,
  .admin-toolbar,
  .admin-action-panel {
    grid-template-columns: 1fr;
  }
}
