/* ============================================================
   ຮ້ານ ສີຂຽວ ມາດ — POS / E-commerce
   ທີມ: ພື້ນຫຼັງສີຂຽວເຂັ້ມ | ແຖບສີສົ້ມ | ປຸ່ມ ແດງ/ຟ້າ/ເຫຼືອງ
   ============================================================ */

:root {
  --green-950: #03211a;
  --green-900: #052e23;
  --green-800: #073a2c;
  --green-700: #0b4a37;
  --green-600: #0f6047;
  --green-500: #17805f;

  --orange: #f97316;
  --orange-600: #ea580c;
  --orange-300: #fdba74;
  --orange-100: #ffedd5;

  --red: #dc2626;
  --red-700: #b91c1c;
  --blue: #2563eb;
  --blue-700: #1d4ed8;
  --yellow: #facc15;
  --yellow-600: #eab308;

  --ink: #14231d;
  --ink-soft: #3f5348;
  --muted: #7b8f85;
  --line: #e3e9e4;
  --paper: #fffdf7;
  --white: #ffffff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 6px rgba(3, 33, 26, 0.12);
  --shadow: 0 10px 26px rgba(3, 33, 26, 0.22);
  --shadow-lg: 0 24px 60px rgba(3, 33, 26, 0.38);
  --font: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', 'Leelawadee UI', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--paper);
  background-color: var(--green-900);
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(23, 128, 95, 0.55), transparent 65%),
    radial-gradient(800px 480px at 95% 4%, rgba(249, 115, 22, 0.16), transparent 62%),
    radial-gradient(1100px 700px at 60% 110%, rgba(3, 33, 26, 0.95), transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: 'Consolas', 'Courier New', monospace; }

/* ------------------------------ Buttons ------------------------------ */
.btn {
  --btn-bg: var(--orange);
  --btn-fg: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-red    { --btn-bg: var(--red);    --btn-fg: #fff; }
.btn-blue   { --btn-bg: var(--blue);   --btn-fg: #fff; }
.btn-yellow { --btn-bg: var(--yellow); --btn-fg: #14231d; }
.btn-orange { --btn-bg: var(--orange); --btn-fg: #14231d; }
.btn-green  { --btn-bg: var(--green-600); --btn-fg: #fff; }
.btn-dark   { --btn-bg: #12211b; --btn-fg: #fff; }
.btn-outline {
  background: transparent;
  color: inherit;
  border: 2px solid currentColor;
  box-shadow: none;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }

/* ------------------------------ Top bar ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--orange), var(--orange-600));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: #fff;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.35);
}
.brand-text { display: flex; flex-direction: column; color: #14231d; min-width: 0; }
.brand-text strong {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small { font-size: 12px; opacity: 0.78; letter-spacing: 0.3px; }

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 520px;
  margin-left: auto;
}
.search input {
  width: 100%;
  padding: 11px 44px 11px 18px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.08);
  outline: none;
}
.search input::placeholder { color: #9aa8a1; }
.search input:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), inset 0 2px 5px rgba(0, 0, 0, 0.08); }
.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0.7;
}
.cart-btn { position: relative; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.cart-btn .badge { background: var(--red); color: #fff; }
.badge.zero { background: rgba(20, 35, 29, 0.25); color: #14231d; }

/* ------------------------------ Main menu ------------------------------ */
.mainmenu {
  position: sticky;
  top: 70px;
  z-index: 35;
  background: var(--orange-600);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}
.mainmenu-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.mainmenu-inner::-webkit-scrollbar { height: 5px; }
.mainmenu-inner::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.25); border-radius: 99px; }

/* ເມນູຫຼັກ: Phetsarath OT / 18px / Bold / ສີດຳ */
.mainmenu .menu-link {
  font-family: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  padding: 8px 16px;
  border-radius: 10px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.mainmenu .menu-link:hover { background: rgba(0, 0, 0, 0.10); }
.mainmenu .menu-link.is-active {
  background: var(--yellow);
  color: #000000;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.mainmenu .btn {
  font-family: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', sans-serif;
  font-size: 18px;
  font-weight: 700;
}
.menu-spacer { flex: 1 1 auto; }
.menu-admin { margin-left: auto; }

/* ------------------------------ Layout ------------------------------ */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: center;
  padding: 30px 34px;
  margin-bottom: 28px;
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(23, 128, 95, 0.92), rgba(5, 46, 35, 0.96)),
    var(--green-800);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: var(--shadow);
}
.hero::after {
  content: '';
  position: absolute;
  width: 340px;
  height: 340px;
  right: -90px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.45), transparent 68%);
}
.hero h1 { font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; }
.hero p { margin-top: 10px; color: #d7f0e3; max-width: 52ch; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 14px;
  color: #eafaf1;
}
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  font-size: clamp(70px, 11vw, 130px);
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.4));
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 22px; }
.section-head .muted { color: #a8c6b8; }

/* ------------------------------ Product grid ------------------------------ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef3ef;
  cursor: zoom-in;
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.card:hover .card-thumb img { transform: scale(1.05); }
.card-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-cat { font-size: 12px; color: var(--green-600); font-weight: 700; letter-spacing: 0.4px; }
.card-title {
  font-size: 16px;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}
.card-price { font-size: 20px; font-weight: 700; color: var(--red); margin-top: auto; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.card-actions .btn { flex: 1; }
.card-actions .btn-icon { flex: 0 0 auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill-stock { background: #e8f7ee; color: #0f6047; }
.pill-low { background: #fff3d6; color: #92400e; }
.pill-out { background: #fee2e2; color: #991b1b; }
.pill-absolute { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(4px); box-shadow: var(--shadow-sm); }
.pill-cat { position: absolute; top: 10px; right: 10px; background: rgba(20, 35, 29, 0.78); color: #fff; }

.empty {
  text-align: center;
  padding: 56px 20px;
  border-radius: var(--radius);
  border: 2px dashed rgba(255, 255, 255, 0.24);
  color: #cfe6da;
}
.empty .big { font-size: 48px; display: block; margin-bottom: 10px; }

/* ------------------------------ Drawer (cart) ------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 18, 13, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  height: 100dvh;
  width: min(430px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  transform: translateX(103%);
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--orange), var(--orange-600));
  color: #14231d;
}
.drawer-head h3 { font-size: 19px; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; }
.drawer-foot {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 15px; }
.total-row.strong { font-size: 20px; font-weight: 700; }
.total-row.strong span:last-child { color: var(--red); }

.cart-item {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  margin-bottom: 10px;
}
.cart-item img { width: 62px; height: 62px; border-radius: 10px; object-fit: cover; }
.cart-item-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.cart-item-price { color: var(--red); font-weight: 700; font-size: 14px; }
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.qty button {
  width: 30px;
  height: 30px;
  border: 0;
  background: #f1f5f2;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.qty button:hover { background: var(--orange-300); }
.qty span { min-width: 32px; text-align: center; font-weight: 700; font-size: 14px; }

/* ------------------------------ Modal ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 18, 13, 0.72);
  backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-card {
  position: relative;
  width: min(880px, 100%);
  max-height: 92dvh;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease-out;
}
.modal-card.narrow { width: min(520px, 100%); }
@keyframes pop {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 35, 29, 0.72);
  color: #fff;
  font-size: 18px;
}
.modal-close:hover { background: var(--red); }

/* Product detail */
.detail-grid { display: grid; grid-template-columns: 1.05fr 1fr; }
.detail-media {
  position: relative;
  background: #eef3ef;
  min-height: 260px;
  cursor: zoom-in;
}
.detail-media img { width: 100%; height: 100%; max-height: 460px; object-fit: cover; }
.detail-media .zoom-hint {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(20, 35, 29, 0.75);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.detail-body { padding: 26px 26px 30px; display: flex; flex-direction: column; gap: 12px; }
.detail-body h2 { font-size: 24px; }
.detail-price { font-size: 30px; font-weight: 700; color: var(--red); }
.detail-desc { color: var(--ink-soft); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.detail-actions .btn { flex: 1 1 160px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transition: transform 0.18s ease;
  cursor: zoom-in;
}
.lightbox img.zoomed { transform: scale(1.9); cursor: zoom-out; }
.lightbox-bar {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.lightbox-bar button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
}
.lightbox-bar button:hover { background: var(--red); }

/* ------------------------------ Forms ------------------------------ */
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 6px; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-weight: 700; font-size: 14px; color: var(--ink); }
label .req { color: var(--red); }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.textarea { min-height: 86px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--red); font-size: 13px; font-weight: 700; }

/* ------------------------------ Checkout ------------------------------ */
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 22px;
  align-items: start;
}
.panel {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.panel + .panel { margin-top: 18px; }
.panel h3 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h3 .step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--orange);
  color: #14231d;
  font-size: 14px;
  font-weight: 700;
}
.sticky-side { position: sticky; top: 132px; }

.map-wrap { position: relative; margin-top: 10px; }
#map { height: 265px; border-radius: 14px; border: 2px solid var(--line); z-index: 0; }
.map-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.map-tools .btn { flex: 1 1 auto; }
.place-results {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.place-item {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.4;
}
.place-item:last-child { border-bottom: 0; }
.place-item:hover { background: #fff7ed; }
.leaflet-container { font-family: var(--font); }
.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.85);
  border-radius: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  z-index: 500;
}

.pay-options { display: grid; gap: 10px; }
.pay-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pay-option:hover { border-color: var(--orange-300); }
.pay-option input { margin-top: 4px; accent-color: var(--green-600); width: 18px; height: 18px; }
.pay-option.selected { border-color: var(--green-600); background: #f2fbf6; }
.pay-option strong { display: block; font-size: 15px; }
.pay-option small { color: var(--muted); }

.qr-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed #c9d6cd;
  background: #fff;
  text-align: center;
}
.qr-box img { width: min(240px, 80%); margin: 0 auto; border-radius: 8px; }
.qr-empty {
  padding: 22px 12px;
  color: #92400e;
  background: #fff8e6;
  border-radius: 10px;
  font-size: 14px;
}
.slip-preview { margin-top: 10px; display: flex; align-items: center; gap: 12px; }
.slip-preview img { width: 68px; height: 68px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.summary-items { display: grid; gap: 10px; margin-bottom: 14px; }
.summary-item { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.summary-item .qty-x { color: var(--muted); font-size: 13px; }
.summary-item .name { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.steps-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.steps-bar .step-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 14px;
  color: #d6ecdf;
}
.steps-bar .step-pill.active { background: var(--yellow); color: #14231d; border-color: var(--yellow); font-weight: 700; }

/* Success */
.success-wrap { max-width: 720px; margin: 20px auto; text-align: center; }
.success-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 46px;
  background: radial-gradient(circle at 30% 30%, #34d399, #059669);
  box-shadow: 0 18px 40px rgba(5, 150, 105, 0.45);
}
.success-code {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 10px 0 6px;
}
.success-card { text-align: left; margin-top: 22px; }

/* Timeline */
.timeline { display: grid; gap: 0; margin-top: 8px; }
.tl-item { display: grid; grid-template-columns: 26px 1fr; gap: 12px; }
.tl-dot {
  width: 16px;
  height: 16px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: #d7e2da;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #d7e2da;
}
.tl-line { width: 2px; height: 26px; margin: 2px auto; background: #e3e9e4; }
.tl-item.done .tl-dot { background: var(--green-600); box-shadow: 0 0 0 2px var(--green-600); }
.tl-item.done .tl-line { background: var(--green-600); }
.tl-item.current .tl-dot { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.tl-title { font-weight: 700; font-size: 14.5px; }
.tl-time { font-size: 12px; color: var(--muted); }

/* ------------------------------ Admin ------------------------------ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  border-top: 8px solid var(--orange);
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-badge {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: var(--green-700);
  margin-bottom: 16px;
}
.login-demo {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7e6;
  border: 1px dashed #f0c37a;
  font-size: 13px;
  color: #8a5a12;
}

.admin-top {
  background: linear-gradient(180deg, var(--orange), var(--orange-600));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  position: sticky;
  top: 0;
  z-index: 40;
}
.admin-top-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-title { display: flex; align-items: center; gap: 10px; color: #14231d; }
.admin-title strong { font-size: 19px; }
.admin-tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tab-btn {
  border: 0;
  background: rgba(0, 0, 0, 0.10);
  color: #000;
  font-family: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', sans-serif;
  font-size: 18px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
}
.tab-btn:hover { background: rgba(0, 0, 0, 0.18); }
.tab-btn.active { background: #14231d; color: var(--yellow); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 6px solid var(--orange);
}
.stat .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat.red { border-left-color: var(--red); }
.stat.blue { border-left-color: var(--blue); }
.stat.yellow { border-left-color: var(--yellow-600); }
.stat.green { border-left-color: var(--green-600); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 160px; }
.toolbar .grow { flex: 1 1 220px; }

.admin-panel {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: left;
  padding: 10px 12px;
  background: #f3f7f4;
  color: var(--ink-soft);
  font-size: 13px;
  text-transform: none;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fbfdfb; }
.td-prod { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.td-prod img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }

.order-list { display: grid; gap: 14px; }
.order-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.order-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.order-code { font-weight: 700; font-size: 17px; }
.order-body { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 16px; padding-top: 14px; }
.order-block h4 { font-size: 13px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.3px; }
.order-block p { font-size: 14px; }
.order-items { display: grid; gap: 6px; }
.order-items .oi { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.status-select { min-width: 190px; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.s-preparing { background: #fff3d6; color: #92400e; }
.s-shipping  { background: #dbeafe; color: #1e40af; }
.s-delivered { background: #dcfce7; color: #166534; }
.s-cancelled { background: #fee2e2; color: #991b1b; }

.slip-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.no-slip { width: 90px; height: 90px; border-radius: 10px; border: 1px dashed #cbd5cf; display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; padding: 6px; }

.img-drop {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 20px;
  border: 2px dashed #c9d6cd;
  border-radius: 14px;
  background: #fbfdfb;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.img-drop:hover, .img-drop.drag { border-color: var(--orange); background: #fff8f1; }
.img-drop strong { color: var(--ink); }
.img-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: #f3f7f4; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ------------------------------ Toast ------------------------------ */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 460px);
}
.toast {
  padding: 12px 18px;
  border-radius: 12px;
  background: #14231d;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.2s ease-out;
  max-width: 100%;
}
.toast.ok { background: #0f6047; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }
.toast.out { animation: toast-out 0.25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ------------------------------ Footer ------------------------------ */
.site-foot {
  margin-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(3, 33, 26, 0.55);
}
.site-foot-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 30px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #b9d6c8;
}
.site-foot a { color: var(--orange-300); font-weight: 700; }

/* ------------------------------ Responsive ------------------------------ */
@media (max-width: 980px) {
  .checkout-grid { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-art { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-media img { max-height: 300px; }
  .order-body { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand-text small { display: none; }
  .search { order: 3; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .mainmenu { top: auto; position: static; }
  .mainmenu-inner { padding: 6px 12px; }
  .mainmenu .menu-link { font-size: 16px; padding: 7px 12px; }
  .page { padding: 18px 14px 60px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 14px; min-height: 40px; }
  .card-price { font-size: 17px; }
  .card-actions .btn { padding: 8px 10px; font-size: 13px; }
  .panel { padding: 16px; }
  .form-row.two { grid-template-columns: 1fr; }
  .order-body { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 21px; }
  .admin-tabs { width: 100%; }
  .tab-btn { font-size: 16px; padding: 7px 12px; }
  .drawer { width: 100vw; }
  .detail-body { padding: 18px; }
}

@media print {
  body { background: #fff; color: #000; }
  .topbar, .mainmenu, .site-foot, .btn { display: none !important; }
}
