/* ------------------------------------------------------------------
   Web ordering interface for the POS.
   Self-contained: no CDN, no framework — the POS often runs on a LAN
   with no outbound internet, so everything here is local.
   ------------------------------------------------------------------ */

:root {
  --bg:         #f4f5f7;
  --surface:    #ffffff;
  --line:       #e4e6eb;
  --line-soft:  #eef0f3;
  --ink:        #14181f;
  --ink-2:      #4a5261;
  --ink-3:      #858d9c;
  --brand:      #1668e3;
  --brand-dark: #0f52b5;
  --brand-soft: #e8f0fd;
  --price:      #e8481f;
  --ok:         #17914f;
  --ok-soft:    #e6f5ed;
  --warn:       #b9791a;
  --warn-soft:  #fdf3e2;
  --danger:     #d0342c;
  --danger-soft:#fdecea;
  --radius:     14px;
  --radius-sm:  10px;
  --shadow:     0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg:  0 12px 32px rgba(16, 24, 40, .16);
  --header-h:   60px;

  /* Footer surface. Measured, not eyeballed: body text lands at 6.0:1 on the
     light end of the gradient and 7.6:1 on the dark end, headings at 7.5:1. */
  --ftr-bg:     #17559b;
  --ftr-bg-2:   #12467f;
  --on-ftr:     rgba(255, 255, 255, .86);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Khmer", "Khmer OS Battambang", "Khmer OS", -apple-system,
               BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px; /* room for the mobile cart bar */
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 14px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ----------------------------- header ----------------------------- */

.hdr {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.hdr-in {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand img { height: 30px; width: auto; border-radius: 6px; }

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}

/* The pill is the container now, so the category selector can sit inside it
   next to the field rather than beside a second bordered box. */
.search {
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 560px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  transition: border-color .15s, background .15s;
}

.search:focus-within {
  border-color: var(--brand);
  background: var(--surface);
}

/* Scope selector. Native arrow kept — it is the one control here a shopper
   must recognise instantly as a menu. */
.search-cat {
  flex: none;
  max-width: 165px;
  height: 38px;
  padding: 0 6px 0 15px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 999px 0 0 999px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

.search-cat:focus-visible { color: var(--brand); }

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 38px;
  border: 0;
  border-radius: 0 999px 999px 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
}

.search .icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.search .clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: none;
  color: var(--ink-3);
  padding: 6px;
  line-height: 0;
  border-radius: 50%;
  display: none;
}

.search.has-value .clear { display: block; }
.search .clear:hover { background: var(--line-soft); color: var(--ink); }

/* Language switcher — a native <details> disclosure, so it opens without JS. */
.lang {
  position: relative;
  flex-shrink: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: border-color .15s, color .15s, background .15s;
}

/* Hide the native disclosure triangle in every engine. */
.lang-btn::-webkit-details-marker { display: none; }
.lang-btn::marker { content: ""; }

.lang-btn:hover,
.lang[open] .lang-btn {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.lang-btn .label { display: none; }
.lang-btn .caret { opacity: .6; transition: transform .15s; }
.lang[open] .lang-btn .caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 176px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 45;
}

.lang-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.lang-menu a:hover { background: var(--line-soft); color: var(--ink); }

.lang-menu a.active { color: var(--brand); font-weight: 600; }

.lang-menu img {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.lang-menu .tick { margin-left: auto; flex-shrink: 0; }

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s, background .15s;
}

.login-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.login-btn .label { display: none; }

.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}

.cart-btn:hover { background: var(--brand-dark); }
.cart-btn .label { display: none; }

.cart-count {
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--price);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* -------------------------- category rail -------------------------- */

.cats {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 0 4px;
}

.cats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 4px;
}

.cat {
  border: 0;
  background: none;
  padding: 8px 4px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  transition: background .15s;
}

.cat:hover { background: var(--line-soft); }

.cat-ico {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  display: grid; place-items: center;
  transition: border-color .15s, box-shadow .15s;
}

.cat-ico img { width: 100%; height: 100%; object-fit: cover; }

.cat-ico.all {
  background: var(--brand-soft);
  border-color: #cfe0fb;
  color: var(--brand);
}

/* Discount tile. Carries the price colour the sale badges and prices already
   use, so "on offer" reads the same everywhere on the page. */
.cat-ico.promo {
  background: #fdeee9;
  border-color: #f8cfc2;
  color: var(--price);
}

.js-promo.active .cat-ico { border-color: var(--price); box-shadow: 0 0 0 2px #fdeee9; }
.js-promo.active .cat-name { color: var(--price); }

.cat-name {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.cat.active .cat-ico {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.cat.active .cat-name { color: var(--brand); font-weight: 600; }

.cats-toggle {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 0 10px;
}

/* --------------------------- subcategories --------------------------- */

.subs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  scrollbar-width: none;
}

.subs::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* Sub-category picture. Round and small — it identifies the chip at a glance
   without turning the rail into a second tile row. Padding tightens on the
   image side so the chip keeps its pill proportions. */
.chip-ico {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: -5px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

.chip:hover { border-color: var(--ink-3); }

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

/* ----------------------------- toolbar ----------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.toolbar .count {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 13px;
  margin-left: 6px;
}

.toolbar-right { display: flex; align-items: center; gap: 10px; }

.select {
  height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23858d9c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 9px center;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.switch input { accent-color: var(--brand); width: 15px; height: 15px; }

/* ---------------------------- product grid ---------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: #d5d9e0;
}

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #fafbfc;
  overflow: hidden;
}

.card-media img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 8px;
  transition: transform .25s;
}

.card:hover .card-media img { transform: scale(1.04); }

.badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  text-transform: uppercase;
}

.badge-promo { background: var(--price); color: #fff; }
.badge-out   { background: rgba(20, 24, 31, .78); color: #fff; left: auto; right: 8px; }

.card-body {
  padding: 10px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-cat {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.price {
  color: var(--price);
  font-size: 16px;
  font-weight: 700;
}

.price-was {
  color: var(--ink-3);
  font-size: 12px;
  text-decoration: line-through;
}

.stock {
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stock::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.stock-in  { color: var(--ok); }
.stock-low { color: var(--warn); }
.stock-out { color: var(--danger); }

.card-foot { margin-top: auto; padding-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13.5px;
  transition: background .15s, border-color .15s, color .15s;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }

.btn-block { width: 100%; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b32a23; }

/* Clear-cart question, asked inside the drawer footer in place of the
   Checkout / Clear buttons. Tinted rather than outlined so it reads as a
   held breath in the flow, not as another pair of things to do. */
.confirm {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
}

.confirm-q {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.confirm-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.confirm-acts .btn { width: 100%; }
.confirm-acts .btn-ghost { background: var(--surface); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-added {
  background: var(--ok-soft) !important;
  color: var(--ok) !important;
}

/* ---------------------------- empty / skeleton ---------------------------- */

.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--ink-3);
}

.empty svg { margin: 0 auto 14px; color: #c8ced8; }
.empty h3 { margin: 0 0 6px; color: var(--ink-2); font-size: 15px; }
.empty p { margin: 0; font-size: 13px; }

.skel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.skel-media { aspect-ratio: 1 / 1; }

.skel-line {
  height: 11px;
  margin: 10px 11px;
  border-radius: 5px;
}

.skel-media, .skel-line {
  background: linear-gradient(90deg, #eef0f3 25%, #e4e7ec 37%, #eef0f3 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ------------------------------ pagination ------------------------------ */

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 0 32px;
  flex-wrap: wrap;
}

.pager button {
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.pager button:hover:not(:disabled):not(.active) { border-color: var(--ink-3); }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .dots { color: var(--ink-3); padding: 0 2px; }

/* -------------------------------- drawer -------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 50;
}

.scrim.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.22,.61,.36,1);
  box-shadow: var(--shadow-lg);
}

.drawer.open { transform: translateX(0); }

.drawer-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.drawer-hdr h2 { margin: 0; font-size: 16px; font-weight: 700; }

.icon-btn {
  border: 0;
  background: none;
  color: var(--ink-3);
  padding: 7px;
  line-height: 0;
  border-radius: 8px;
}

.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px;
  -webkit-overflow-scrolling: touch;
}

.drawer-foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  flex-shrink: 0;
  background: var(--surface);
}

/* ------------------------------ cart lines ------------------------------ */

.line {
  display: flex;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.line:last-child { border-bottom: 0; }

.line-img {
  width: 62px; height: 62px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fafbfc;
}

.line-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.line-main { flex: 1; min-width: 0; }

.line-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-price { font-size: 12.5px; color: var(--ink-3); }

.line-warn {
  font-size: 11.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 6px;
  padding: 3px 7px;
  margin-top: 5px;
  display: inline-block;
}

.line-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
}

.qty button {
  width: 32px; height: 100%;
  border: 0;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
  display: grid; place-items: center;
}

.qty button:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.qty button:disabled { opacity: .35; cursor: not-allowed; }

.qty input {
  width: 42px; height: 100%;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  -moz-appearance: textfield;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.line-total { font-weight: 700; font-size: 14px; }

.line-del {
  border: 0; background: none;
  color: var(--ink-3);
  font-size: 12px;
  padding: 4px 0;
  text-decoration: underline;
}

.line-del:hover { color: var(--danger); }

/* ------------------------------- totals ------------------------------- */

.totals { margin-bottom: 12px; }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-2);
  padding: 3px 0;
}

.total-row.grand {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  border-top: 1px solid var(--line);
  margin-top: 7px;
  padding-top: 10px;
}

.total-row.grand .amount { color: var(--price); }

/* ------------------------------- forms ------------------------------- */

.field { margin-bottom: 13px; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}

.field .req { color: var(--danger); }

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field textarea { resize: vertical; min-height: 62px; }

.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

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

.seg label {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
  margin: 0;
}

.seg label:hover { border-color: var(--ink-3); }

.seg input { accent-color: var(--brand); margin: 0; }

.seg input:checked + span { color: var(--brand); font-weight: 600; }

.seg label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.alert {
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 13px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.alert-error { background: var(--danger-soft); color: #96201a; }
.alert-info  { background: var(--brand-soft); color: var(--brand-dark); }

/* --------------------------- mobile cart bar --------------------------- */

.cartbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 39;
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .07);
}

.cartbar.show { display: flex; }
.cartbar-info { font-size: 12.5px; color: var(--ink-3); }
.cartbar-total { font-size: 17px; font-weight: 700; color: var(--price); }

/* ------------------------------ toast ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, transform .2s, visibility .2s;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------------------------- detail page ---------------------------- */

.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 0;
  font-size: 12.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}

.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: #c8ced8; }

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.detail-media {
  aspect-ratio: 1 / 1;
  background: #fafbfc;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.detail-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }

.detail h1 { margin: 0 0 8px; font-size: 19px; line-height: 1.35; }
.detail .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 12px; }

.detail .price { font-size: 26px; }

.spec {
  border-top: 1px solid var(--line-soft);
  margin-top: 16px;
  padding-top: 14px;
}

.spec-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
}

.spec-row dt { color: var(--ink-3); min-width: 110px; margin: 0; }
.spec-row dd { margin: 0; color: var(--ink-2); }

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

/* ------------------------- confirmation page ------------------------- */

.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 20px 0 32px;
  max-width: 620px;
  margin-inline: auto;
}

.receipt-top { text-align: center; padding-bottom: 18px; border-bottom: 1px dashed var(--line); }

.tick {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid; place-items: center;
  margin: 0 auto 14px;
}

.receipt-top h1 { margin: 0 0 6px; font-size: 20px; }
.receipt-top p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.ref {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
}

.receipt-items { padding: 6px 0; }

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.receipt-line:last-child { border-bottom: 0; }
.receipt-line .qty-lbl { color: var(--ink-3); font-size: 12.5px; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--warn-soft);
  color: var(--warn);
}

/* --------------------------- delivery areas --------------------------- */

/* Plain text, not links: nothing in the catalogue is filterable by province,
   so linking these would promise a filter that does not exist. */
.areas {
  margin-top: 40px;
  padding: 22px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.areas h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.areas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 13px;
}

/* ------------------------------ footer ------------------------------ */

.ftr {
  margin-top: 40px;
  background: linear-gradient(180deg, var(--ftr-bg), var(--ftr-bg-2));
  color: var(--on-ftr);
  font-size: 13px;
  /* A lit top edge, so the slab reads as catching light rather than as a
     rectangle of colour butted against the page. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.ftr-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px 34px;
  padding-top: 34px;
  padding-bottom: 32px;
}

/* Small tracked caps rather than bold body size — quieter, and it separates
   the labels from the links without shouting. */
.ftr h3 {
  margin: 0 0 15px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
}

/* Khmer has no letter case and its clusters break apart under tracking;
   Chinese does not want it either. */
html[lang="km"] .ftr h3,
html[lang="zh"] .ftr h3 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
}

/* The brand column leads with the store name, so its heading needs air. */
.ftr-brand h3 { margin-top: 26px; }

.ftr-name {
  margin-bottom: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
}

/* Capped so the address wraps into a readable measure instead of running the
   full width of the column. */
.ftr-addr,
.ftr-tel {
  margin: 0 0 7px;
  max-width: 34ch;
  line-height: 1.7;
}

.ftr a { color: var(--on-ftr); transition: color .15s; }
.ftr a:hover,
.ftr a:focus-visible { color: #fff; text-decoration: underline; }

.ftr-links { margin: 0; padding: 0; list-style: none; }
.ftr-links li { margin-bottom: 11px; }
.ftr-links li:last-child { margin-bottom: 0; }
.ftr-links a { display: inline-block; }

.ftr-social {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
}

.ftr-social a { display: inline-flex; align-items: center; gap: 9px; }

/* Outlined at rest so the footer stays monochrome; each brand's colour only
   appears on hover, where it reads as feedback rather than as decoration. */
.soc {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-ftr);
  transition: background .15s, border-color .15s, color .15s;
}

.ftr-social a:hover .soc { color: #fff; }
.ftr-social a:hover .soc-fb { background: #1877f2; border-color: #1877f2; }
.ftr-social a:hover .soc-yt { background: #ff0000; border-color: #ff0000; }
.ftr-social a:hover .soc-tg { background: #229ed9; border-color: #229ed9; }

/* Standing note under the social links. Quieter than the address above it —
   it is orientation, not something to read. */
.ftr-note {
  margin: 16px 0 0;
  max-width: 34ch;
  font-size: 12px;
  line-height: 1.6;
  opacity: .75;
}

/* Live viewer count. The dot carries the "right now" meaning, so it pulses —
   gently, and not at all for anyone who asked for less motion. */
.ftr-live {
  margin: 7px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
}

.ftr-live-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .55);
  animation: ftr-live-pulse 2.4s ease-out infinite;
}

@keyframes ftr-live-pulse {
  70%  { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ftr-live-dot { animation: none; }
}

.ftr-qr {
  width: 128px;
  padding: 8px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(6, 24, 48, .28);
}

.ftr-qr img { width: 100%; height: auto; }

/* Kept at the full cream rather than a dimmed variant — anything dimmer drops
   under AA on this background. The smaller size carries the hierarchy. */
.ftr-qr-desc {
  margin: 9px 0 0;
  max-width: 210px;
  font-size: 12px;
  line-height: 1.6;
}

.ftr-bar { border-top: 1px solid rgba(255, 255, 255, .24); }

.ftr-bar-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding-top: 20px;
  padding-bottom: 22px;
}

/* One line where there is room, stacked where there is not. The separator is
   a real element rather than a pseudo-element so it can simply be dropped at
   narrow widths — a wrapped line must not open with a dangling middot. */
.ftr-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 10px;
}

.ftr-copy,
.ftr-dev { margin: 0; font-size: 12.5px; }

.ftr-sep { display: none; opacity: .45; }

/* Underlined at rest, because this link sits inside a sentence rather than in
   a list where its role would be obvious — but hairline and offset, so it
   marks the link without drawing a hard line under the footer. */
.ftr-dev a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, .42);
  transition: color .15s, text-decoration-color .15s;
}

.ftr-dev a:hover,
.ftr-dev a:focus-visible { color: #fff; text-decoration-color: currentColor; }

.ftr-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ftr-pay-lbl { margin-right: 3px; font-size: 12.5px; }

/* Wordmark chips rather than bitmap card logos — nothing extra to download
   and nothing to re-cut when a bank refreshes its artwork. Outlined in the
   footer's own cream: five brand colours on solid white read as stickers
   pasted onto the footer. */
.pay-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 26px;
  padding: 0 7px;
  border-radius: 4px;
  background: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(6, 24, 48, .25);
}

.pay-aba  { color: #0d2d6c; }
.pay-khqr { color: #e2231a; }
.pay-visa { color: #1a1f71; font-style: italic; letter-spacing: .06em; }
.pay-mc   { padding: 0 5px; }
.pay-mc svg { display: block; }

.to-top {
  position: fixed;
  right: 16px;
  bottom: 84px; /* clear of the mobile cart bar */
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .18s, transform .18s, visibility .18s;
}

.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--brand); border-color: var(--brand); }

/* ----------------------------- responsive ----------------------------- */

/* Three controls plus a search box do not fit a phone header — drop the shop
   name and keep the buttons as icons until there is room for labels. */
@media (max-width: 479px) {
  .brand-name { display: none; }
  .login-btn, .lang-btn { padding: 0 10px; }
  .lang-btn .caret { display: none; }
}

/* A phone header has no room for the scope selector next to the field; the
   category rail sits right below and does the same job there. */
@media (max-width: 699px) {
  .search-cat { display: none; }
  .search input { border-radius: 999px; }
}

@media (min-width: 700px) {
  .cart-btn .label,
  .login-btn .label,
  .lang-btn .label { display: inline; }
  /* Wide enough that copyright and credit are certain to share a line. */
  .ftr-sep { display: inline; }
}

@media (min-width: 560px) {
  .cats-grid { grid-template-columns: repeat(6, 1fr); }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .ftr-cols { grid-template-columns: repeat(2, 1fr); }
  .areas-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 820px) {
  .wrap { padding: 0 20px; }
  .cats-grid { grid-template-columns: repeat(8, 1fr); }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .detail { grid-template-columns: minmax(0, 420px) 1fr; gap: 28px; padding: 22px; }
  .detail h1 { font-size: 22px; }
  body { padding-bottom: 0; }
  .cartbar { display: none !important; }
  .ftr-cols {
    grid-template-columns: 1.5fr 1fr 1fr auto;
    gap: 30px 40px;
    padding-top: 48px;
    padding-bottom: 40px;
  }
  .to-top { right: 20px; bottom: 20px; } /* no cart bar to clear here */
  .areas-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1080px) {
  .cats-grid { grid-template-columns: repeat(10, 1fr); }
  .grid { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .hdr, .cats, .areas, .cartbar, .drawer, .scrim, .btn, .ftr, .to-top { display: none !important; }
  body { background: #fff; padding: 0; }
  .receipt { border: 0; box-shadow: none; }
}
