:root {
  --bg: #F8FAF9;
  --surface: #FFFFFF;
  --text: #17221D;
  --muted: #56645C;
  --primary: #166534;
  --primary-hover: #14532D;
  --accent: #ECFDF3;
  --border: #DDE5DF;
  --error: #B42318;
  --warn-bg: #FFF8E6;
  --warn-border: #F2D58A;
  --warn-text: #6B4E00;
  --radius-card: 16px;
  --radius-control: 12px;
  --max: 1200px;
  --gutter: 16px;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
a { color: var(--primary); }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 768px) { :root { --gutter: 24px; } }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.logo { display: block; margin-right: auto; }
.logo-img { display: block; width: 100px; height: auto; }
.footer-logo { display: block; width: 140px; height: auto; }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a, .nav-links button, .header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-links a:hover, .nav-links button:hover, .header-link:hover { background: var(--accent); }

.menu-toggle, .header-link { display: none; }
.logo, .header-link, .menu-toggle { white-space: nowrap; overflow-wrap: normal; }

@media (max-width: 359px) {
  .header-inner { gap: 8px; }
  .site-header .header-link, .site-header .menu-toggle { padding: 0 8px; font-size: 15px; }
}

@media (max-width: 767px) {
  .logo-img { width: 92px; }
  .header-link { display: inline-flex; padding: 0 8px; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    font: inherit;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 20;
  }
  .site-nav.is-open { display: block; }
  .nav-links { flex-direction: column; padding: 8px var(--gutter) 12px; }
  .nav-links a, .nav-links button { width: 100%; }
  .nav-links .nav-lookup { display: none; }
}

/* Màn hẹp: icon logo làm header rộng hơn, nên "Tra cứu đơn" nằm trong menu. */
@media (max-width: 419px) {
  .site-header .header-link { display: none; }
  .nav-links .nav-lookup { display: list-item; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-telegram { gap: 8px; background: #0077B5; color: #fff; }
.btn-telegram:hover, .btn-telegram:active { background: #00669C; }
.btn-telegram img { flex: none; display: block; }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent); }
.btn[disabled], .btn[aria-disabled='true'] {
  background: #E4E9E6;
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.btn-block { width: 100%; }

/* Hero */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: 32px; max-width: 18ch; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin-top: 12px; max-width: 52ch; }
.hero .btn { margin-top: 24px; }
@media (min-width: 768px) {
  .hero { padding: 64px 0 32px; }
  .hero h1 { font-size: 46px; }
  .hero p { font-size: 18px; }
}

/* Catalog */
.section { padding: 32px 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 24px; }
@media (min-width: 768px) { .section { padding: 48px 0; } .section-head h2 { font-size: 28px; } }

.search-field { position: relative; }
.search-field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus-visible { outline-offset: 0; border-color: var(--primary); }
.search-field svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; padding: 0; list-style: none; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed='true'] { background: var(--primary); border-color: var(--primary); color: #fff; }

.result-count { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 360px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.card:hover { border-color: var(--primary); }
.card:focus-within { border-color: var(--primary); }
.card h3 { font-size: 17px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-card); }
.card h3 a:focus-visible { outline: none; }
.card:has(h3 a:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.card-meta { color: var(--muted); font-size: 14px; display: grid; gap: 2px; }
.card-price { font-weight: 700; font-size: 18px; margin-top: auto; padding-top: 4px; }
.card-price small { font-weight: 500; font-size: 14px; color: var(--muted); }
.card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--primary);
  font-weight: 600;
  font-size: 15px;
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

.monogram {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  font-size: 18px;
  border: 1px solid var(--border);
}
.monogram-lg { width: 72px; height: 72px; font-size: 26px; border-radius: 16px; }
/* Logo thật: nền trắng, giữ tỷ lệ, không đổi màu logo */
.monogram.has-logo { background: var(--surface); padding: 8px; }
.monogram-lg.has-logo { padding: 12px; }
.monogram.has-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

.empty-state {
  padding: 32px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  text-align: center;
}
.empty-state p { margin-bottom: 16px; }

/* Steps */
.steps { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; counter-reset: step; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  margin-bottom: 8px;
}
.steps h3 { font-size: 18px; margin-bottom: 4px; }
.steps p { color: var(--muted); }
.steps-note { margin: 16px 0; font-weight: 600; }

/* FAQ */
.faq { display: grid; gap: 8px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
}
.faq summary { list-style: none; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
/* Dấu +/− theo trạng thái mở thật của <details> */
.faq summary::after {
  content: '+' / '';
  margin-left: auto;
  flex: none;
  width: 24px;
  text-align: center;
  font-size: 22px;
  line-height: 1;
  color: var(--primary);
}
.faq details[open] > summary::after { content: '−' / ''; }
.faq details p { padding: 0 16px 16px; color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  margin-top: 32px;
  font-size: 14px;
  color: var(--muted);
}
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h2 { font-size: 15px; color: var(--text); margin-bottom: 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

/* Product page */
.breadcrumb { font-size: 14px; color: var(--muted); padding: 16px 0 0; }
.breadcrumb a { color: var(--muted); }

.product-layout {
  display: grid;
  gap: 24px;
  padding: 16px 0 32px;
  grid-template-areas: 'intro' 'buy' 'details';
}
@media (min-width: 900px) {
  .product-layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-areas: 'intro buy' 'details buy';
    gap: 24px 48px;
    padding-top: 24px;
    align-items: start;
  }
}
.product-intro { grid-area: intro; display: grid; gap: 12px; }
.product-intro h1 { font-size: 30px; letter-spacing: -0.02em; }
.product-intro p { color: var(--muted); }
@media (min-width: 900px) { .product-intro h1 { font-size: 44px; } .product-intro p { font-size: 18px; } }
/* Mobile: logo cạnh tiêu đề, khoảng cách gọn để phần chọn gói hiện sớm hơn */
@media (max-width: 899px) {
  .breadcrumb { padding-top: 12px; }
  .product-layout { gap: 16px; padding-top: 12px; }
  .product-intro { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; }
  .product-intro > :not(.monogram):not(h1) { grid-column: 1 / -1; }
  .product-intro .monogram-lg { width: 56px; height: 56px; font-size: 22px; }
  .product-intro .monogram-lg.has-logo { padding: 8px; }
}

.buy-box {
  grid-area: buy;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: grid;
  gap: 16px;
}
@media (min-width: 900px) { .buy-box { position: sticky; top: 24px; padding: 24px; } }

.variant-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.variant-group legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.variant-options { display: grid; gap: 8px; }
.variant-option { position: relative; display: block; }
.variant-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.variant-option span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.variant-option span b { font-weight: 600; }
.variant-option span em { font-style: normal; color: var(--muted); font-size: 14px; text-align: right; }
.variant-option input:checked + span {
  border: 2px solid var(--primary);
  background: var(--accent);
  padding: 11px 15px;
}
.variant-option input:checked + span b::before { content: '✓ '; color: var(--primary); }
.variant-option input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }

.price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.price-row .price { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }

.facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--border); }
.facts div {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.unverified { color: var(--warn-text); font-weight: 500; }

.notes {
  margin: 0;
  padding: 12px 16px 12px 36px;
  background: var(--accent);
  border-radius: var(--radius-control);
  font-size: 15px;
}
.notes:empty { display: none; }

.buy-actions { display: grid; gap: 8px; }

.product-details { grid-area: details; display: grid; gap: 24px; }
.product-details section { display: grid; gap: 8px; }
.product-details h2 { font-size: 20px; }
.product-details p, .product-details li { color: var(--muted); }
.product-details ul, .product-details ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

.not-found { padding: 48px 0; display: grid; gap: 16px; justify-items: start; }

/* Mobile buy bar */
.buybar { display: none; }
@media (max-width: 899px) {
  body.has-buybar { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  body.has-buybar .buybar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 30;
  }
  .buybar-info { min-width: 0; flex: 1; }
  .buybar-info small { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buybar-info strong { font-size: 18px; white-space: nowrap; }
  .buybar .btn { flex: none; padding: 0 16px; }
}
@media (max-width: 359px) {
  body.has-buybar .buybar { gap: 8px; padding-left: 4px; padding-right: 4px; }
  /* Vùng giá không co nhỏ hơn chuỗi giá; nhãn gói tự cắt bằng dấu … thay vì đẩy rộng vùng này. */
  .buybar-info { min-width: max-content; }
  .buybar-info small { width: 0; min-width: 100%; }
  .buybar .btn { padding: 0 3px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* Link "Bỏ qua" hiện khi dùng bàn phím */
a.visually-hidden:focus {
  position: fixed !important;
  top: 8px; left: 8px;
  width: auto; height: auto;
  clip: auto;
  padding: 8px 12px;
  background: var(--surface);
  z-index: 60;
}


/* Khối mua qua Telegram */
.btn-small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.bot-open { display: grid; gap: 16px; max-width: 420px; }
.bot-open > * { margin: 0; }
.bot-title { font-size: 20px; }
.bot-product { display: grid; gap: 2px; }
.bot-product span { font-size: 14px; color: var(--muted); }
.bot-product strong { font-size: 18px; overflow-wrap: anywhere; }
.bot-cta { display: grid; gap: 8px; }
.bot-cta > p { margin: 0; }
.bot-web { font-size: 14px; color: var(--muted); text-align: center; }
.bot-web a { color: var(--primary); font-weight: 600; }
.bot-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.bot-handle { font-size: 16px; overflow-wrap: anywhere; }
.bot-copy-status { font-size: 14px; color: var(--primary); }
.bot-guide { font-size: 15px; }
.bot-note { font-size: 15px; color: var(--muted); }
.bot-lookup { font-size: 14px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); }
