:root {
  --blue: #1f5eff;
  --blue-dark: #1547d6;
  --blue-deep: #0b2f86;
  --navy: #071426;
  --red: #ef233c;
  --ink: #142033;
  --muted: #5d6b80;
  --line: #e6edf5;
  --bg: #f4f7fb;
  --shadow: 0 12px 32px rgba(16, 42, 92, 0.08);
  --wrap: 1160px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(#d7e0ec 1.15px, transparent 1.15px);
  background-size: 20px 20px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
.wrap { width: min(var(--wrap), calc(100% - 40px)); margin: 0 auto; }

.header {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(90deg, #1a56f5, #2d74ff);
  color: #fff;
  box-shadow: 0 8px 24px rgba(18, 64, 180, 0.18);
}
.header-bar { height: 74px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; min-width: 168px; }
.logo-badge {
  width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--blue);
  display: grid; place-items: center; font-weight: 800;
  box-shadow: inset 0 0 0 3px #d7e4ff;
}
.logo-img {
  height: 46px; width: auto; max-width: 160px; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 4px;
}
.logo strong { display: block; font-size: 13px; letter-spacing: 0.08em; line-height: 1.15; }
.logo small { display: block; opacity: 0.85; font-size: 11px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: #fff; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 8px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.16); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .cart-link {
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.14); color: #fff;
  display: grid; place-items: center; position: relative;
}
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-red { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-line { background: #fff; color: var(--blue); border: 1px solid #c9d8ff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn[disabled], .btn.is-off { opacity: .45; pointer-events: none; }
.cart-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 99px; background: var(--red); color: #fff; font-size: 11px;
  display: grid; place-items: center; padding: 0 4px; font-weight: 800;
}
.cart-badge[hidden] { display: none; }
.menu-toggle { display: none; }
.page { padding: 28px 0 72px; }
.crumb { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.crumb a { color: var(--blue); font-weight: 600; }
h1 { font-size: 32px; line-height: 1.2; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.layout { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: start; }
.panel, .card, .side-card {
  background: #fff; border: 1px solid #edf2f8; border-radius: 16px; box-shadow: var(--shadow);
}
.panel { padding: 16px; }
.panel h2, .side-card h2 { margin: 0 0 12px; font-size: 16px; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fff; color: var(--ink);
}
input[type="radio"], input[type="checkbox"] {
  width: 16px; height: 16px; padding: 0; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--blue);
}
.checks { display: grid; gap: 8px; font-weight: 500; font-size: 14px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; cursor: pointer; }
.grid-3, .grid-2 { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.15fr .85fr; }
.product-card { overflow: hidden; display: flex; flex-direction: column; }
.product-card img { height: 170px; width: 100%; object-fit: cover; }
.product-card .pad { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { margin: 0; font-size: 16px; }
.price b { color: var(--red); font-size: 18px; }
.price s { color: #93a0b3; margin-left: 6px; font-size: 13px; }
.tag { display: inline-flex; background: #eaf1ff; color: var(--blue); border-radius: 99px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.tag.warn { background: #fff4e5; color: #9a5b00; }
.tag.no { background: #fde8ec; color: var(--red); }
.tag.ok { background: #e8f8ee; color: #157a3a; }
.row-actions { display: flex; gap: 8px; margin-top: auto; }

.pdp { display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px; }
.gallery { overflow: hidden; display: flex; }
.gallery img { width: 100%; height: 100%; min-height: 420px; object-fit: cover; }
.buy { padding: 18px; }
.variants { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.variants button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; font-weight: 600; }
.variants button.on { border-color: var(--blue); background: #eaf1ff; color: var(--blue); }
.variants button:disabled { text-decoration: line-through; opacity: .45; }
.choice { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.choice.on { border-color: var(--blue); background: #f5f8ff; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 18px; }
.note { background: #fff7ea; border-radius: 12px; padding: 10px 12px; color: #8a5a00; font-size: 14px; }
.tabs { display: flex; gap: 8px; margin: 22px 0 12px; }
.tabs button { border: 0; background: #fff; border-radius: 999px; padding: 8px 12px; font-weight: 700; }
.tabs button.on { background: var(--blue); color: #fff; }
.spec-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.spec-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.spec-table td:first-child { color: var(--muted); width: 34%; }

.cart-line { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 92px; height: 72px; object-fit: cover; border-radius: 10px; }
.money { margin-left: auto; min-width: 280px; }
.money div { display: flex; justify-content: space-between; margin: 6px 0; }
.money .total { font-size: 18px; font-weight: 800; }
.alert { background: #fff1f2; color: #9f1239; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.okbox { background: #eefbf3; color: #146c36; border-radius: 12px; padding: 12px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.steps span { background: #fff; border-radius: 99px; padding: 6px 10px; }
.steps .now { background: var(--blue); color: #fff; }

.admin { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.admin nav { display: grid; gap: 6px; align-content: start; }
.admin nav button { text-align: left; border: 0; background: #fff; border-radius: 10px; padding: 10px 12px; font-weight: 700; }
.admin nav button.on { background: var(--blue); color: #fff; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px; }
.kpi b { display: block; font-size: 26px; }

.chat-dock { position: fixed; right: 16px; bottom: 18px; z-index: 45; display: grid; gap: 8px; justify-items: end; }
.bubble { width: 52px; height: 52px; border-radius: 50%; border: 0; color: #fff; display: grid; place-items: center; box-shadow: 0 10px 20px rgba(0,0,0,.16); font-weight: 800; }
.bubble.chat { background: var(--navy); }
.bubble.zalo { background: #0068ff; font-size: 12px; }
.bubble.phone { background: #22a45a; }
.chat-box { width: min(360px, calc(100vw - 32px)); background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.18); overflow: hidden; }
.chat-box header { background: var(--blue-deep); color: #fff; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.chat-log { height: 280px; overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; background: #f6f8fc; }
.msg { max-width: 85%; padding: 8px 10px; border-radius: 12px; font-size: 14px; }
.msg.khách { background: #fff; justify-self: end; }
.msg.tu-van, .msg.tu { background: #e7efff; }
.msg.he-thong { background: #fff7ea; font-size: 13px; }
.chat-box form { display: flex; gap: 8px; padding: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #10203a; color: #fff; padding: 12px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: .2s ease; z-index: 70; font-weight: 600;
}
.toast.show { opacity: 1; }
.footer { background: var(--navy); color: #d5deea; padding: 28px 0; margin-top: 10px; }
.footer .logo { color: #fff; }
.footer .logo-img { height: 42px; }
.footer a { color: #fff; font-weight: 600; }
.footer-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }

@media (max-width: 980px) {
  .nav { display: none; }
  .nav.open { display: flex; flex-direction: column; position: absolute; top: 74px; left: 0; right: 0; margin: 0; background: #1a56f5; padding: 10px 16px 14px; z-index: 6; }
  .menu-toggle { display: grid; }
  .layout, .pdp, .grid-2, .grid-3, .admin, .kpis { grid-template-columns: 1fr; }
  .money { min-width: 0; width: 100%; }
  .gallery img { height: 240px; min-height: 0; }
  .logo small { display: none; }
  .steps { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .wrap { width: min(var(--wrap), calc(100% - 24px)); }
  .header-bar { height: 62px; gap: 8px; }
  .logo { min-width: 0; flex: 1; gap: 8px; }
  .logo-badge { width: 38px; height: 38px; font-size: 13px; }
  .logo strong { font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; }
  .header-actions { gap: 6px; flex-shrink: 0; }
  .header-actions .icon-btn, .header-actions .cart-link { width: 36px; height: 36px; }
  .header-actions .btn-red { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .nav.open { top: 62px; }
  .page { padding-bottom: 96px; }
  .cart-line { grid-template-columns: 72px 1fr; }
  .cart-line img { width: 72px; height: 56px; }
  .cart-line > b { grid-column: 2; }
  .footer-row { flex-direction: column; align-items: flex-start; }
  .chat-dock { right: 8px; bottom: 10px; gap: 6px; }
  .bubble { width: 44px; height: 44px; }
  .spec-table td:first-child { width: 42%; }
  h1 { font-size: 26px; }
}
