:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0b4ea2;
  --brand-2: #e30613;
  --brand-soft: #e8f0fb;
  --ok: #0f9d58;
  --ok-soft: #e6f6ee;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --bad: #c62828;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1420; --card: #162131; --ink: #e6edf7; --muted: #94a3b8; --line: #263449;
    --brand: #5b9bff; --brand-soft: #1b2b44; --ok-soft: #12352a; --warn-soft: #3a2a10;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1420; --card: #162131; --ink: #e6edf7; --muted: #94a3b8; --line: #263449;
  --brand: #5b9bff; --brand-soft: #1b2b44; --ok-soft: #12352a; --warn-soft: #3a2a10;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-size: 14px; margin: 6px 0; }

.logo { font-weight: 800; letter-spacing: .5px; color: var(--brand); font-size: 26px; }
.logo span { color: var(--brand-2); }
.logo.sm { font-size: 18px; white-space: nowrap; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 16px; font-weight: 600; cursor: pointer; min-height: 46px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 18px;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, var(--brand-soft), var(--bg) 60%); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px;
  padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 20px; margin: 10px 0 4px; }
.login-card form { margin-top: 18px; display: grid; gap: 12px; }
.login-card input { width: 100%; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 18px; text-align: center; text-transform: uppercase; background: var(--bg); }
.login-card input:focus { outline: none; border-color: var(--brand); }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--card); box-shadow: var(--shadow); }
.top-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; max-width: 1280px; margin: 0 auto; }
.cust { flex: 1; min-width: 0; text-align: right; }
.cust-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-code { font-size: 12px; color: var(--muted); }
.cust-stock { font-size: 11.5px; color: var(--ok); font-weight: 600; }
.search-row { display: flex; gap: 8px; padding: 4px 16px 8px; max-width: 1280px; margin: 0 auto; }
.search-row input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); font-size: 16px; }
.search-row input:focus { outline: none; border-color: var(--brand); }
.search-row select { padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); }
.filters { background: var(--card); border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 16px 4px; max-width: 1280px; margin: 0 auto; }
.chips:last-child { padding-bottom: 12px; }
.subchips { padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 6px; }
@media (max-width: 600px) {
  .chips { gap: 6px; }
  .chip { padding: 6px 10px; font-size: 13px; }
}
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); padding: 7px 13px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip small { color: var(--muted); font-weight: 500; margin-left: 3px; }
.chip { --bc: var(--brand); }
.chip[style] { border-color: color-mix(in srgb, var(--bc) 45%, var(--line)); color: var(--bc); }
.chip.on { background: var(--bc); border-color: var(--bc); color: #fff; }
.chip.on small { color: rgba(255,255,255,.8); }

main { max-width: 1280px; margin: 0 auto; padding: 12px 16px 120px; }
.info-bar { font-size: 13px; color: var(--muted); margin: 2px 0 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.info-bar b { color: var(--ink); }
.reorder { border: 0; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 4px 12px;
  font-weight: 600; cursor: pointer; font-size: 13px; }

/* Lưới dòng sản phẩm */
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1120px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { --bc: var(--brand); background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--bc) 55%, transparent);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--bc) 14%, transparent); transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--bc); }
.card.in-cart { border-color: var(--bc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc) 22%, transparent), 0 4px 16px color-mix(in srgb, var(--bc) 20%, transparent); }
.chead { display: flex; gap: 12px; padding: 12px; border-top: 5px solid var(--bc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 13%, var(--card)), var(--card)); }
.card .vlist { border-top-color: color-mix(in srgb, var(--bc) 25%, var(--line)); }
.card .vrow.on { background: color-mix(in srgb, var(--bc) 10%, var(--card)); }
.card .stepper { border-color: var(--bc); }
.card .stepper button { background: color-mix(in srgb, var(--bc) 12%, var(--card)); color: var(--bc); }
.card .add-btn { background: var(--bc); }
.card .pack-btn { border-color: var(--bc); color: var(--bc); }
.card .more { color: var(--bc); }
.card .price { color: color-mix(in srgb, var(--bc) 80%, #000); }
.card .pic { border-color: color-mix(in srgb, var(--bc) 30%, var(--line)); }
.pic { position: relative; flex: none; width: 116px; height: 132px; border-radius: 12px; background: #fff;
  overflow: hidden; cursor: zoom-in; border: 1px solid var(--line); }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; transition: transform .2s; }
.pic:hover img { transform: scale(1.04); }
.pic::after { content: "⤢"; position: absolute; right: 5px; bottom: 4px; font-size: 13px; color: #64748b;
  background: rgba(255,255,255,.9); border-radius: 6px; padding: 0 4px; line-height: 1.4; }
.pic .ph, .vthumb .ph, .line .ph { color: #fff; font-weight: 800; display: grid; place-items: center; text-align: center; }
.pic .ph { width: 100%; height: 100%; font-size: 15px; padding: 8px; line-height: 1.15; }
.ctitle { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.brand { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.name { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; }
.price { font-size: 15px; font-weight: 800; color: var(--brand-2); }
.meta { font-size: 12.5px; color: var(--muted); }
.picked { color: var(--brand); }

.vlist { border-top: 1px solid var(--line); }
.vlist.collapsed .vrow:nth-child(n+6) { display: none; }
.vrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px;
  border-bottom: 1px solid var(--line); }
.vrow:last-child { border-bottom: 0; }
.vrow.on { background: var(--brand-soft); }
.vrow.dis { opacity: .55; }
.vthumb { position: relative; width: 44px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; cursor: zoom-in; }
.vthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.vthumb .ph { width: 100%; height: 100%; font-size: 11px; }
.vinfo { min-width: 0; }
.vname { font-weight: 700; font-size: 14px; line-height: 1.25; }
.vmeta { font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; margin-top: 2px; }
.vprice { font-weight: 700; }
.vcode { font-size: 11.5px; color: var(--muted); margin-top: 1px; line-height: 1.35; }
.vcode b { color: var(--ink); font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.out { background: #fde8e8; color: var(--bad); }
.vbuy { display: grid; gap: 5px; justify-items: stretch; width: 128px; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--brand); border-radius: 12px; overflow: hidden; height: 40px; background: var(--card); }
.stepper.off { border-color: var(--line); }
.card .stepper:not(.has):not(.off) { border-color: color-mix(in srgb, var(--bc) 45%, var(--line)); }
.stepper input::placeholder { color: var(--muted); font-weight: 500; }
.stepper button { width: 38px; height: 100%; border: 0; background: var(--brand-soft); color: var(--brand); font-size: 22px; font-weight: 700; cursor: pointer; flex: none; }
.stepper button:disabled { color: var(--muted); cursor: not-allowed; }
.stepper input { flex: 1; min-width: 0; width: 100%; border: 0; text-align: center; font-size: 17px; font-weight: 800; background: transparent; }
.stepper input:focus { outline: none; background: var(--brand-soft); }
.add-btn { height: 40px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; font-size: 14.5px; }
.pack-btn { border: 1px dashed var(--brand); background: transparent; color: var(--brand); border-radius: 9px; font-size: 12px; font-weight: 600; padding: 4px; cursor: pointer; }
.over { font-size: 11.5px; color: var(--warn); font-weight: 600; margin-top: 2px; }
.more { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--brand); font-weight: 700; padding: 10px; cursor: pointer; }

.cgroup { margin-top: 8px; }
.cgroup-h { font-size: 12.5px; font-weight: 800; color: var(--brand); padding: 6px 0 0; }

.empty { text-align: center; padding: 50px 0; color: var(--muted); }

/* Thanh giỏ hàng (gọn) */
.cart-fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom));
  width: calc(100% - 32px); max-width: 400px; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 8px; border: 0; border-radius: 999px; background: var(--brand); color: #fff; cursor: pointer;
  box-shadow: 0 6px 18px rgba(11, 78, 162, .30); text-align: left; transition: background .2s, box-shadow .2s; }
.cart-fab.empty-cart { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(15,23,42,.10); }
.cart-ico { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.18); flex: none; }
.cart-fab.empty-cart .cart-ico { background: var(--brand-soft); color: var(--brand); }
.cart-ico b { position: absolute; top: -4px; right: -6px; background: var(--brand-2); color: #fff; font-size: 10.5px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.cart-fab.empty-cart .cart-ico b { display: none; }
.cart-sum { flex: 1; display: grid; line-height: 1.2; min-width: 0; }
.cart-sum small { opacity: .85; font-size: 11.5px; }
.cart-sum strong { font-size: 15.5px; }
.cart-go { font-weight: 700; font-size: 13.5px; white-space: nowrap; background: #fff; color: var(--brand);
  padding: 8px 14px; border-radius: 999px; }
.cart-fab.empty-cart .cart-go { background: var(--bg); color: var(--muted); }
.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: translateX(-50%) scale(1.04); } }

/* Sheets */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.sheet-body { position: relative; width: 100%; max-width: 720px; max-height: 92vh; background: var(--card);
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .22s ease-out; }
.sheet-body.narrow { max-width: 440px; }
@media (min-width: 760px) { .sheet { align-items: center; } .sheet-body { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 19px; }
.sheet-scroll { overflow-y: auto; padding: 8px 16px 12px; flex: 1; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .primary { flex: 1; }

.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line img, .line .ph { width: 56px; height: 64px; object-fit: contain; padding: 2px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.line .ph { display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; border: 0; }
.line .ln { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.line .lm { font-size: 12px; color: var(--muted); }
.line .lr { text-align: right; display: grid; gap: 4px; justify-items: end; }
.line .lr b { font-size: 14px; }
.line .stepper { height: 34px; width: 116px; }
.line .ph { width: 56px; height: 56px; border-radius: 10px; font-size: 11px; }
.line .stepper button { width: 34px; font-size: 18px; }
.line .stepper input { font-size: 15px; }

.totals { margin: 14px 0; background: var(--bg); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; gap: 10px; }
.totals .neg { color: var(--ok); }
.totals .grand { font-size: 18px; font-weight: 800; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
.totals .grand span:last-child { color: var(--brand-2); }

.promo { border: 1.5px solid #f3c4dc; background: #fff7fb; border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 13.5px; }
.promo .bar { height: 7px; background: #f6dbe8; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.promo .bar i { display: block; height: 100%; background: #d6287f; }
:root[data-theme="dark"] .promo { background: #2a1823; border-color: #5a2a44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .promo { background: #2a1823; border-color: #5a2a44; } }

.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.field input, .field textarea { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg);
  font-size: 15px; color: var(--ink); font-weight: 400; resize: vertical; }

.done { text-align: center; padding: 28px 22px; }
.done-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 34px;
  display: grid; place-items: center; margin: 0 auto 8px; font-weight: 800; }
.done h2 { margin: 6px 0; }
.done-actions { display: grid; gap: 10px; margin-top: 18px; }

/* Xem ảnh lớn */
.zoom { position: fixed; inset: 0; z-index: 60; background: rgba(10, 18, 32, .78); display: grid; place-items: center; padding: 16px; }
.zbox { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); background: var(--card); border-radius: 18px;
  display: flex; flex-direction: column; overflow: hidden; animation: up .2s ease-out; }
.zimg { position: relative; background: #fff; height: min(60vh, 560px); flex: none; }
.zimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.zclose { position: absolute; right: 10px; top: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(15,23,42,.65); color: #fff; font-size: 17px; cursor: pointer; }
.znav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(15,23,42,.55); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.znav.prev { left: 10px; }
.znav.next { right: 10px; }
.zcap { padding: 10px 16px; display: grid; gap: 2px; font-size: 14px; }
.zthumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 14px; flex: none; }
.zthumbs button { flex: none; position: relative; width: 52px; height: 60px; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; padding: 0; cursor: pointer; overflow: hidden; }
.zthumbs button.on { border-color: var(--brand); }
.zthumbs img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.hover-prev { position: fixed; z-index: 55; width: 300px; height: 360px; background: #fff; border-radius: 16px; pointer-events: none;
  box-shadow: 0 12px 40px rgba(15,23,42,.28); border: 1px solid #e2e8f0; display: flex; flex-direction: column; overflow: hidden; }
.hover-prev img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 12px; }
.hover-prev div { padding: 6px 12px 10px; font-weight: 700; font-size: 13px; color: #14213d; text-align: center; }

/* Nhóm nhỏ & tiêu đề nhóm */
.chip.sub { font-size: 13px; padding: 5px 11px; border-style: dashed; }
.chip.sub.on { border-style: solid; background: color-mix(in srgb, var(--bc) 14%, var(--card)); color: var(--bc); border-color: var(--bc); }
.chip.sub.on small { color: var(--bc); }
.sec { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 12px 0 -2px; font-size: 16px; font-weight: 800; }
.sec:first-child { margin-top: 0; }
.sec span { flex: none; width: 6px; height: 20px; border-radius: 3px; }
.sec b { color: var(--muted); font-weight: 600; }
.sec small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 700; }


.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 70; background: #14213d; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.done .thanks { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 4px 0 0; }
.done .warn-msg { display: block; margin-top: 8px; color: var(--warn); font-size: 14px; }

/* Hàng nhãn: luôn đúng 2 dòng (đọc trái → phải), các ô bằng nhau; --n = số ô mỗi dòng (app.js đặt) */
#brandChips { display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: 8px; }
#brandChips .chip { width: 100%; text-align: center; padding: 8px 6px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  /* Điện thoại: vẫn 2 dòng, vuốt ngang để xem thêm nhãn */
  #brandChips { grid-template-columns: repeat(var(--n, 7), max-content); overflow-x: auto; scrollbar-width: none; padding-bottom: 10px;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  #brandChips::-webkit-scrollbar { display: none; }
  #brandChips .chip { padding: 7px 12px; }
}

.search-row .reorder { flex: none; border: 1.5px solid var(--line); background: var(--bg); color: var(--brand); border-radius: 12px;
  padding: 0 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.search-row .reorder:hover { border-color: var(--brand); }
main { padding-top: 14px; }

/* Mã SAP · barcode: chữ nhỏ, nhạt, nằm trên tên (chủ yếu cho kế toán) */
.vcode { font-size: 10.5px; color: var(--muted); opacity: .8; letter-spacing: .2px; margin: 0 0 1px; word-break: break-all; }
.line .codes { font-size: 10.5px; opacity: .8; }


/* Giá nằm bên phải, ngay trên ô số lượng; mô tả (mã, tồn) bên trái */
.vbuy .vprice { text-align: right; font-weight: 800; font-size: 14.5px; color: color-mix(in srgb, var(--bc, var(--brand)) 80%, #000); line-height: 1.1; }
.vbuy .vprice small { font-size: 11px; font-weight: 500; color: var(--muted); }
.vmeta { margin-top: 3px; }
.vmeta .pack { font-size: 11.5px; color: var(--muted); }

/* Nút lên đầu trang */
.to-top { position: fixed; right: 16px; bottom: 78px; z-index: 31;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--brand);
  box-shadow: 0 6px 18px rgba(15,23,42,.18); display: grid; place-items: center; cursor: pointer; animation: up .2s ease-out; }
.to-top:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
/* màn rộng: thanh giỏ hàng (tối đa 400px, ở giữa) không chạm góc phải -> hạ nút xuống góc */
@media (min-width: 580px) { .to-top { bottom: 16px; right: 20px; } }

/* Logo Phú Thái + tên web */
.brandmark { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.brandmark img { height: 34px; width: auto; display: block; }
.brandmark span { font-weight: 800; font-size: 16px; color: var(--brand); white-space: nowrap; padding-left: 10px; border-left: 1.5px solid var(--line); }
.brandmark.big { flex-direction: column; gap: 6px; }
.brandmark.big img { height: 56px; }
.brandmark.big span { font-size: 15px; border-left: 0; padding-left: 0; color: var(--muted); font-weight: 700; letter-spacing: .3px; }
@media (max-width: 600px) {
  .brandmark img { height: 26px; }
  .brandmark span { font-size: 13px; padding-left: 8px; }
}
@media (max-width: 400px) { .top-row .brandmark span { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brandmark img { background: #fff; border-radius: 8px; padding: 3px 6px; } }

/* Ô nhãn luôn tô màu thương hiệu; ô đang chọn có vòng sáng + dấu ✓ */
#brandChips .chip { background: var(--bc); border-color: var(--bc); color: #fff; font-weight: 700;
  transition: transform .12s, box-shadow .12s, filter .12s; }
#brandChips .chip small { color: rgba(255,255,255,.85); }
#brandChips .chip:hover { filter: brightness(1.08); }
#brandChips .chip.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--bc); transform: translateY(-1px); }
#brandChips .chip.on::before { content: "✓ "; }
#brandChips:has(.chip.on:not([data-brand=""])) .chip:not(.on) { filter: saturate(.75) brightness(1.05); }

/* Màn hình đặt hàng thành công */
.done { padding: 0 0 22px; overflow: hidden; border-radius: 20px; }
.done-hero { height: 96px; background: linear-gradient(120deg, #0b4ea2 0%, #2f7fd1 45%, #e30613 100%); position: relative; margin-bottom: 44px; }
.done-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.25), transparent 40%),
  radial-gradient(circle at 85% 70%, rgba(255,255,255,.18), transparent 35%); }
.done .done-ico { position: absolute; left: 50%; bottom: -38px; transform: translateX(-50%); width: 76px; height: 76px; margin: 0; z-index: 1;
  border-radius: 50%; background: #fff; color: #0f9d58; font-size: 40px; font-weight: 900; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(11, 78, 162, .28), 0 0 0 6px rgba(255,255,255,.6); animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: translateX(-50%) scale(.4); opacity: 0; } }
.done h2 { color: #0b4ea2; font-size: 22px; margin: 4px 22px 14px; }
.done-info { display: grid; grid-template-columns: 1fr auto 1.2fr; gap: 0; margin: 0 22px; background: var(--bg); border-radius: 14px;
  border: 1px solid var(--line); overflow: hidden; }
.done-info div { padding: 10px 8px; display: grid; gap: 2px; }
.done-info div + div { border-left: 1px solid var(--line); }
.done-info small { font-size: 11.5px; color: var(--muted); }
.done-info b { font-size: 14px; word-break: break-all; }
.done-info .money { color: #e30613; font-size: 15.5px; }
.done .thanks { margin: 14px 22px 0; font-size: 14.5px; }
.done .done-actions { margin: 18px 22px 0; }
.done .done-actions .primary { background: linear-gradient(120deg, #0b4ea2, #2f7fd1 60%, #e30613); border: 0; box-shadow: 0 6px 16px rgba(11,78,162,.25); }
.done .warn-msg { margin: 12px 22px 0; }
.done.fail .done-hero { background: linear-gradient(120deg, #b45309, #f59e0b); }
.done.fail .done-ico { color: #b45309; }
.done.fail h2 { color: #b45309; }
@media (max-width: 400px) { .done-info { grid-template-columns: 1fr 1fr; } .done-info div:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); } }

/* Đầu trang: logo trên, chữ "Đặt hàng Rohto" dưới – to, đậm, nổi 3D nhẹ */
.top-row .brandmark { flex-direction: column; align-items: flex-start; gap: 0; }
.top-row .brandmark img { height: 44px; margin: -4px 0 -4px -6px; }  /* ảnh logo có lề trắng sẵn */
.top-row .brandmark span { border-left: 0; padding-left: 2px; font-size: 24px; font-weight: 900; letter-spacing: .2px; line-height: 1.2;
  color: #0b4ea2; text-shadow: 0 1px 0 #b9cfee, 0 2px 0 #8fb0dd, 0 3px 4px rgba(11, 78, 162, .22); }
@supports (-webkit-background-clip: text) {
  .top-row .brandmark span { background: linear-gradient(180deg, #2f7fd1 0%, #0b4ea2 60%); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; text-shadow: none;
    filter: drop-shadow(0 1px 0 #c3d6f1) drop-shadow(0 1.5px 0 #94b4df) drop-shadow(0 3px 3px rgba(11, 78, 162, .22)); }
}
@media (max-width: 600px) {
  .top-row .brandmark img { height: 34px; margin: -3px 0 -3px -5px; }
  .top-row .brandmark span { font-size: 19px; }
}
@media (max-width: 400px) { .top-row .brandmark span { display: block; font-size: 17px; } }

/* Tông pastel nhẹ, sang hơn (ghi đè các khối màu phía trên) */
#brandChips .chip { background: color-mix(in srgb, var(--bc) 13%, #fff); border: 1px solid color-mix(in srgb, var(--bc) 28%, #fff);
  color: color-mix(in srgb, var(--bc) 85%, #000); font-weight: 700; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
#brandChips .chip small { color: color-mix(in srgb, var(--bc) 55%, #fff); font-weight: 600; }
#brandChips .chip:hover { filter: none; background: color-mix(in srgb, var(--bc) 20%, #fff); }
#brandChips .chip.on { background: color-mix(in srgb, var(--bc) 26%, #fff); border-color: color-mix(in srgb, var(--bc) 60%, #fff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bc) 18%, transparent), 0 2px 6px color-mix(in srgb, var(--bc) 18%, transparent); transform: none; }
#brandChips:has(.chip.on:not([data-brand=""])) .chip:not(.on) { filter: none; opacity: .88; }

.card { border: 1px solid color-mix(in srgb, var(--bc) 22%, var(--line));
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 6px 18px color-mix(in srgb, var(--bc) 7%, transparent); }
.card:hover { border-color: color-mix(in srgb, var(--bc) 40%, var(--line)); }
.card.in-cart { border-color: color-mix(in srgb, var(--bc) 55%, #fff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bc) 14%, transparent), 0 6px 18px color-mix(in srgb, var(--bc) 12%, transparent); }
.chead { border-top: 3px solid color-mix(in srgb, var(--bc) 55%, #fff);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 6%, var(--card)), var(--card)); }
.card .add-btn { background: color-mix(in srgb, var(--bc) 85%, #fff); }
.card .stepper { border-color: color-mix(in srgb, var(--bc) 35%, var(--line)); }
.card .stepper button { background: color-mix(in srgb, var(--bc) 8%, var(--card)); }
.card .vrow.on { background: color-mix(in srgb, var(--bc) 6%, var(--card)); }
.sec span { background: color-mix(in srgb, var(--bc, var(--brand)) 60%, #fff) !important; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #brandChips .chip {
  background: color-mix(in srgb, var(--bc) 22%, var(--card)); border-color: color-mix(in srgb, var(--bc) 40%, var(--card));
  color: color-mix(in srgb, var(--bc) 45%, #fff); } }

/* Mức màu trung gian: nền ~70% màu nhãn pha trắng, chữ trắng; ô đang chọn đủ màu + viền sáng */
#brandChips .chip { background: color-mix(in srgb, var(--bc) 72%, #fff); border-color: color-mix(in srgb, var(--bc) 72%, #fff);
  color: #fff; text-shadow: 0 1px 1px color-mix(in srgb, var(--bc) 60%, #000); box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
#brandChips .chip small { color: rgba(255, 255, 255, .88); }
#brandChips .chip:hover { background: color-mix(in srgb, var(--bc) 85%, #fff); }
#brandChips .chip.on { background: var(--bc); border-color: var(--bc);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px color-mix(in srgb, var(--bc) 55%, #fff), 0 3px 8px color-mix(in srgb, var(--bc) 30%, transparent); }
#brandChips:has(.chip.on:not([data-brand=""])) .chip:not(.on) { opacity: 1; }

.card { border-color: color-mix(in srgb, var(--bc) 38%, var(--line)); }
.chead { border-top: 4px solid color-mix(in srgb, var(--bc) 78%, #fff);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 10%, var(--card)), var(--card)); }
.card.in-cart { border-color: color-mix(in srgb, var(--bc) 75%, #fff); }
.sec span { background: color-mix(in srgb, var(--bc, var(--brand)) 80%, #fff) !important; }
