/* ==========================================================================
   Home stage — giao diện học theo webml-community/semantic-image-field:
   nền tối, cánh đồng ảnh trôi, pill tìm kiếm lớn ở giữa, và bảng điều khiển
   gọn đúng một màn hình (không phải cuộn để xem số liệu).
   ========================================================================== */

.home-stage {
  position: relative;
  /* KHÔNG khoá chiều cao: trang phải cuộn như một tài liệu bình thường,
     nếu không trên máy thật (Safari/iOS, màn thấp) phần slide bị cắt mất. */
  height: auto;
  min-height: min(660px, calc(100dvh - 190px));
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding-bottom: 4px;
  background: #11120f;
  color: #e7e8e0;
}

/* trên trang chủ, footer không được đẩy trang xuống nửa màn hình */
body.home-mode .site-footer { display: none; }

/* ------------------------------------------------------------------ field */
.stage-field {
  position: absolute;
  inset: 0 0 auto 0;
  /* chỉ phủ dải đầu của sân khấu: pill + bảng thống kê. Nếu phủ cả trang
     (dash + 4 dải slide) thì xoắn ốc bị kéo xuống dưới màn hình. */
  height: min(660px, 92vh);
  overflow: hidden;
  pointer-events: none;
  opacity: .55;
  transition: opacity 320ms ease;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 94%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 94%, transparent 100%);
}
.image-field { position: absolute; inset: 0; overflow: hidden; }

/* đang tìm: cánh đồng lên làm mặt tiền, phủ kín màn hình, bảng thống kê nhường chỗ.
   Phải fixed + cao 100vh thì xoắn ốc mới có đủ chỗ thở — trước đây chỉ 660px nên
   22 ảnh dồn vào một dải hẹp và đè lên nhau. */
.home-stage.searching .stage-field {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 3;
  opacity: 1;
  pointer-events: auto;
  -webkit-mask-image: none;
  mask-image: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 226, 190, .10), transparent 62%),
    radial-gradient(circle at 50% 45%, #14150f 0%, #101109 58%, #0a0b07 100%);
}
body.searching { overflow: hidden; }
.home-stage.searching .stage-inner { z-index: 4; }
.home-stage.searching .stage-vignette { display: none; }
.home-stage.searching .stage-vignette {
  background: radial-gradient(ellipse at 50% 48%, transparent 46%, rgba(10, 11, 9, .52) 92%);
}
.home-stage .kpi-grid, .home-stage .dash-grid { transition: opacity 240ms ease; }
.home-stage.searching .kpi-grid,
.home-stage.searching .dash-grid { opacity: 0; pointer-events: none; }
/* lớp bảng thống kê vẫn phủ kín sân khấu — khi tìm kiếm phải nhường click cho ảnh */
.home-stage.searching .stage-inner { pointer-events: none; }
.home-stage.searching .pill-wrap { pointer-events: auto; }

/* Ảnh là một node do field.js đặt transform; ở đây chỉ khai báo hình dáng và
   độ liên quan (--rel-o / --rel-b do JS ghi theo từng truy vấn). */
.ftile {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #f6f2ea;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 16px #0007;
  will-change: transform;
  opacity: var(--rel-o, .92);
  filter: blur(var(--rel-b, 0px)) saturate(.96);
  transition: opacity 620ms ease, filter 620ms ease, box-shadow 260ms ease;
}
.ftile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 260ms ease;
}
.ftile img.loaded { opacity: 1; }

/* Ô video nằm chung cánh đồng ảnh — cùng khung, thêm huy hiệu phát */
.ftile.is-video { box-shadow: inset 0 0 0 2px rgba(180, 86, 43, .55); }
.ftile-play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ftile-play svg {
  width: 26px; height: 26px; fill: #fff; padding: 9px; box-sizing: content-box;
  border-radius: 999px; background: rgba(10, 14, 20, .46);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .45));
}
.ftile-tag {
  position: absolute; left: 5px; top: 5px; pointer-events: none;
  font: 700 8.5px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .09em;
  padding: 4px 6px; border-radius: 5px;
  background: rgba(180, 86, 43, .92); color: #fff;
}
.ftile:hover, .ftile:focus-visible {
  opacity: 1;
  filter: blur(0) saturate(1);
  box-shadow: 0 16px 46px #000b;
  outline: none;
}
.stage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 38%, transparent 30%, rgba(10, 11, 9, .55) 78%),
    linear-gradient(180deg, rgba(17, 18, 15, .1) 0%, rgba(17, 18, 15, .55) 58%, #11120f 96%);
}
.stage-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ stage inner */
.stage-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px 16px;
}

.pill-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: clamp(320px, 46vw, 700px);
  max-width: 100%;
  height: clamp(54px, 4.4vw, 70px);
  padding: 0 8px 0 20px;
  border-radius: 999px;
  background: rgba(228, 232, 221, .16);
  border: 1px solid rgba(232, 236, 226, .28);
  backdrop-filter: blur(26px) saturate(.8);
  -webkit-backdrop-filter: blur(26px) saturate(.8);
  box-shadow: inset 0 1px 0 #ffffff1f, 0 10px 40px #0006;
  transition: background 220ms, border-color 220ms;
}
.pill:focus-within { background: rgba(233, 237, 226, .24); border-color: rgba(240, 244, 233, .45); }
.pill-icon { width: 22px; height: 22px; flex: none; stroke: #cfd4c8; fill: none; stroke-width: 1.6; opacity: .8; }
.pill input[type="search"], .pill input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #f2f4ec;
  font-size: clamp(15px, 1.3vw, 19px);
  letter-spacing: -.01em;
}
.pill input::placeholder { color: #c3c8bc; opacity: .72; }
.pill-go, .pill-img {
  flex: none;
  height: 40px;
  min-width: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #ecefe6;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 160ms, transform 160ms;
}
.pill-go { padding: 0 16px; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.pill-go:hover, .pill-img:hover { background: rgba(255, 255, 255, .18); }
.pill-img svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.pill-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #9a4b25, transparent);
  opacity: 0;
  transition: opacity 240ms;
}
.pill.busy .pill-progress { opacity: .9; animation: pill-sweep 1.4s ease-in-out infinite; }
@keyframes pill-sweep { 0%, 100% { transform: scaleX(.2); opacity: .3; } 50% { transform: scaleX(1); opacity: 1; } }
.pill-status {
  margin: 0;
  font-size: 12px;
  letter-spacing: .015em;
  color: #cfd4c7;
  text-align: center;
  text-shadow: 0 1px 8px #000;
  min-height: 16px;
}
.pill-status b { color: #f4e6d8; font-weight: 600; }

/* ------------------------------------------------------------------ kpi strip */
.home-stage .kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: none;
}
.home-stage .kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  overflow: hidden;
}
.home-stage .kpi-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #9aa094; }
.home-stage .kpi-value { font-size: clamp(18px, 1.7vw, 24px); font-weight: 600; line-height: 1.1; color: #f1f2ea; }
.home-stage .kpi-foot { font-size: 10px; color: #8d9387; }
.home-stage .kpi-icon { position: absolute; right: 10px; top: 8px; opacity: .16; }
.home-stage .kpi-icon svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.4; }
.home-stage .kpi-accent { background: linear-gradient(135deg, rgba(154, 75, 37, .38), rgba(154, 75, 37, .12)); border-color: rgba(214, 141, 96, .3); }

/* ------------------------------------------------------------------ dashboard */
.dash-grid {
  flex: none;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
  grid-template-rows: 172px 172px;
  gap: 8px;
}
.dash-grid .panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: none;
  overflow: hidden;
  color: #e7e8e0;
}
.dash-chart { grid-column: span 2; }
.dash-chart .panel-head, .dash-grid .panel-head { align-items: baseline; gap: 8px; margin: 0; }
.dash-grid .panel-head h2 { font-size: 12px; letter-spacing: .01em; color: #f0f1e9; }
.dash-grid .panel-head .hint { font-size: 10px; color: #8d9387; margin: 0; }
.dash-grid .chart-stat { display: flex; align-items: baseline; gap: 4px; }
.dash-grid .chart-stat strong { font-size: 18px; color: #f4e6d8; }
.dash-grid .chart-stat span { font-size: 10px; color: #8d9387; }
.dash-chart .chart-wrap { flex: 1; min-height: 0; margin: 0; background: #f8f4ee; border-radius: 8px; padding: 2px 4px; }
.dash-chart .chart-wrap canvas { width: 100%; height: 100%; display: block; }

/* categories */
.dash-cats .bars { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 2px; }
.dash-cats .bar-row { padding: 0; }
.dash-cats .bar-top { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; color: #cfd4c7; }
.dash-cats .bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-cats .bar-val { color: #8d9387; flex: none; }
.dash-cats .bar-track { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 2px; }
.dash-cats .bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #9a4b25, #d08a5c); }

/* slides: rank lists + recent/new tiles share one look */
.dash-slide .slide-track,
.home-stage .rank-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 0 2px;
  list-style: none;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.dash-slide .slide-track::-webkit-scrollbar,
.home-stage .rank-list::-webkit-scrollbar { height: 4px; }
.dash-slide .slide-track::-webkit-scrollbar-thumb,
.home-stage .rank-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

.slide-card {
  flex: 0 0 104px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
  transition: background 160ms, border-color 160ms, transform 160ms;
}
.slide-card:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); transform: translateY(-1px); }
.slide-img { display: block; height: 62px; border-radius: 6px; background: #1b1d18; overflow: hidden; }
.slide-img img { width: 100%; height: 100%; object-fit: contain; }
.slide-name {
  font-size: 10px;
  line-height: 1.25;
  color: #dfe1d8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slide-meta { font-size: 9px; color: #8d9387; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-stage .rank-list .rank-row {
  position: relative;
  flex: 0 0 104px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  cursor: pointer;
  scroll-snap-align: start;
}
.home-stage .rank-list .rank-row:hover { background: rgba(255, 255, 255, .1); }
.home-stage .rank-thumb { order: 1; width: 100%; height: 62px; object-fit: contain; border-radius: 6px; background: #1b1d18; }
.home-stage .rank-body { order: 2; }
.home-stage .rank-name { font-size: 10px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #dfe1d8; }
.home-stage .rank-meta { font-size: 9px; color: #8d9387; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-stage .rank-value { order: 3; font-size: 10px; color: #e7c7a6; }
.home-stage .rank-idx { position: absolute; z-index: 2; top: 8px; left: 8px; font-size: 9px; padding: 1px 5px; border-radius: 5px; background: rgba(10, 11, 9, .72); color: #f0e7dc; }
.home-stage .rank-empty { font-size: 11px; color: #8d9387; padding: 4px 2px; }

/* the live clock sits in the top-right of the stage */
.stage-clock {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  color: #d8dbd1;
  text-shadow: 0 1px 10px #000;
  pointer-events: none;
}
.stage-clock strong { font-size: 20px; font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.stage-clock span { font-size: 10px; color: #9aa094; letter-spacing: .08em; text-transform: uppercase; }

.stage-foot {
  position: absolute;
  z-index: 3;
  left: 22px;
  bottom: 10px;
  font-size: 10px;
  color: #7f857a;
  letter-spacing: .02em;
  pointer-events: none;
}

/* quote table: dedicated image column */
.qtable .q-img { width: 62px; padding: 3px 4px; text-align: center; }
.qtable .q-img .q-thumb { width: 46px; height: 46px; object-fit: contain; border-radius: 6px; background: #f7f4ef; display: block; margin: 0 auto; }
.qtable .q-name span { display: block; }

@media (max-height: 820px) and (min-width: 981px) {
  .home-stage .kpi-foot { display: none; }
  .home-stage .kpi { padding: 6px 10px; }
  .dash-grid { grid-template-rows: 148px 148px; }
  .dash-grid .panel { padding: 8px 10px; }
  .slide-card, .home-stage .rank-list .rank-row { flex-basis: 92px; }
  .slide-img, .home-stage .rank-thumb { height: 54px; }
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr 1fr; grid-template-rows: 176px 176px 176px; }
  .dash-chart { grid-column: span 2; }
}

@media (max-width: 760px) {
  .home-stage { min-height: 0; }
  .stage-field { height: 300px; }
  .stage-inner { padding: 14px 12px 14px; }
  .stage-clock { display: none; }
  .home-stage .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .dash-grid .panel { min-height: 160px; }
  .pill { width: 100%; }
}

/* ====================================================================
   Kết quả tìm kiếm nổi ngay trên cánh đồng ảnh — không phải mở modal,
   không phải chờ máy chủ: hiện tức thì từ dữ liệu đang có trong máy.
   ==================================================================== */
.float-results {
  position: fixed;
  z-index: 900;                      /* trên cả header, video band và modal */
  left: 50%;
  top: calc(var(--head-h, 118px) + 6px);
  width: min(760px, calc(100% - 24px));
  max-height: min(52vh, 460px);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px 14px 11px;
  border-radius: 16px;
  background: rgba(14, 15, 12, .95);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(26px) saturate(.95);
  -webkit-backdrop-filter: blur(26px) saturate(.95);
  box-shadow: 0 26px 70px #000c;
  overflow: hidden;
  animation: float-in 200ms ease-out;
}
.float-results.hidden { display: none; }

/* Kết quả tìm kiếm luôn thắng dải video trên trang chủ: ẩn hẳn band khi đang tìm,
   để slide video không đè lên lưới kết quả ảnh/video sản phẩm. */
body.searching .video-band,
body.searching #video-band,
body.searching .video-strip { display: none !important; }
body.searching .vb-rail, body.searching .vb-swipe { z-index: 1 !important; }
/* Khi cánh đồng ảnh là mặt tiền, khay kết quả co lại thành một thanh:
   kết quả chính là những tấm ảnh đang bay, không lặp lại thành lưới thẻ. */
body.searching #float-results {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 16px;
}
body.searching #float-results .float-grid { display: none; }
body.searching #float-results .float-chips { display: none; }
body.searching #float-results .float-head {
  display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 0; border: 0;
}
body.searching #float-results #float-title { display: none; }
body.searching #float-results #float-sub { margin: 0; font-size: 12.5px; white-space: nowrap; }
body.searching #float-results .float-foot { margin-left: auto; padding: 0; border: 0; }
body.searching #float-results #float-note { display: none; }
@keyframes float-in {
  from { opacity: 0; transform: translateY(-9px); }
  to { opacity: 1; transform: translateY(0); }
}
.float-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.float-head h3 { margin: 0; font-size: 13px; color: #f1f2ea; font-weight: 600; }
.float-head p { margin: 0; font-size: 11px; color: #9aa094; }
.float-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
  min-height: 0;
}
.float-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms, transform 140ms;
}
.float-card:hover { background: rgba(255, 255, 255, .11); transform: translateY(-1px); }
.float-card img {
  width: 100%;
  height: 84px;
  object-fit: contain;
  background: #f7f3ec;
  border-radius: 6px;
  padding: 4px;
  box-sizing: border-box;
}
.float-name {
  font-size: 10.5px;
  line-height: 1.25;
  color: #e4e6dc;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.float-price { font-size: 11px; color: #f0c9a6; font-weight: 600; }
.float-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 8px; }
.float-more { border: 0; background: #d08a5c; color: #20140d; font-weight: 600; font-size: 12px; padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.float-close { border: 0; background: rgba(255, 255, 255, .1); color: #e7e8e0; width: 28px; height: 28px; border-radius: 999px; cursor: pointer; font-size: 15px; line-height: 1; }

.float-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 0; }
.float-chips button {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  color: #dfe2d7;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
}
.float-chips button:hover { background: rgba(255, 255, 255, .12); }
.float-chips button.on { background: #d08a5c; border-color: #d08a5c; color: #20140d; font-weight: 600; }

/* ====================================================================
   Dải slide dưới bảng thống kê: vừa xem · mới nhất · quan tâm · yêu thích
   ==================================================================== */
.slide-band {
  position: relative;
  z-index: 3;
  scroll-margin-top: calc(var(--head-h, 118px) + 8px);
  background: #0e0f0c;
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding: 20px 22px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #e7e8e0;
}

/* mũi chỉ "cuộn xuống" — để không ai nghĩ trang hết nội dung ở màn hình đầu */
.stage-scroll {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #b9bfb2;
  text-decoration: none;
}
.stage-scroll svg { width: 16px; height: 16px; stroke: currentColor; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: .65; } 50% { transform: translateY(4px); opacity: 1; } }
.band-row { display: flex; flex-direction: column; gap: 8px; }
.band-head { display: flex; align-items: baseline; gap: 10px; }
.band-head h2 { margin: 0; font-size: 14px; color: #f1f2ea; font-weight: 600; letter-spacing: .01em; }
.band-head p { margin: 0; font-size: 11px; color: #8d9387; }
.band-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.band-track::-webkit-scrollbar { height: 6px; }
.band-track::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 4px; }
.band-card {
  flex: 0 0 158px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.band-card:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); transform: translateY(-2px); }
.band-card img {
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: #f7f3ec;
  border-radius: 7px;
  padding: 5px;
  box-sizing: border-box;
}
.band-name {
  font-size: 11px;
  line-height: 1.3;
  color: #e2e4da;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 28px;
}
.band-meta { font-size: 10px; color: #8d9387; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-price { font-size: 11.5px; color: #f0c9a6; font-weight: 600; }
.band-empty { font-size: 12px; color: #8d9387; padding: 8px 2px; }

@media (max-width: 760px) {
  .float-results { top: calc(var(--head-h, 96px) + 4px); left: 8px; right: 8px; width: auto; transform: none; max-height: 76vh; }
  .float-results { animation: float-in-m 200ms ease-out; }
  @keyframes float-in-m { from { opacity: 0; } to { opacity: 1; } }
  .float-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .slide-band { padding: 18px 12px 30px; }
  .band-card { flex-basis: 132px; }
  .band-card img { height: 82px; }
}

/* ====================================================================
   Lớp trên cùng: modal chi tiết sản phẩm, giỏ hàng, báo giá phải nổi
   TRÊN thanh lọc / khay kết quả (#float-results z 300). Trước đây thanh
   lọc nằm trên nên nó đè lên modal.
   ==================================================================== */
.modal-root { z-index: 400; }
.drawer-scrim { z-index: 380; }
.cart-drawer { z-index: 390; }
.qmodal { z-index: 410; }
.clip-progress { z-index: 405; }
.toast { z-index: 450; }
.fatal { z-index: 460; }

/* Slide chỉ thuộc trang chủ: vào một danh mục / danh sách sản phẩm thì danh
   sách lên đầu, không có dải slide chiếm chỗ phía trên. */
body:not(.home-mode) .slide-band { display: none; }

/* ====================================================================
   Logo VA STUDIO trong header
   ==================================================================== */
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  box-shadow: 0 6px 16px rgba(24, 18, 12, .28), 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.brand-text strong { letter-spacing: .12em; }

/* ====================================================================
   Video kênh Malloca Kitchenware
   ==================================================================== */
.chip-video { border-color: #e2cdb5; }
.chip-video.active { background: #2b2622; color: #f4e7d6; border-color: #2b2622; }
.chip-video .chip-count { background: rgba(192, 138, 82, .18); }

.video-strip { margin: 4px 0 22px; }
.video-strip:empty { display: none; }
.video-strip-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.video-strip-head h3 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; color: #3a2c20;
}
.video-strip-more { margin-left: auto; font-size: 12.5px; color: #9a6a3f; text-decoration: none; }
.video-strip-more:hover { color: #7a3f14; }
.video-track { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }

.vcard {
  flex: 0 0 208px; width: 208px; display: flex; flex-direction: column; gap: 6px;
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.vthumb {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden; background: #241f1b;
  box-shadow: 0 8px 20px rgba(36, 24, 12, .16);
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vplay {
  position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(20, 16, 12, .62); backdrop-filter: blur(2px);
  display: grid; place-items: center; transition: transform 160ms ease, background 160ms ease;
}
.vplay svg { width: 18px; height: 18px; fill: #fdf6ec; margin-left: 2px; }
.vcard:hover .vplay { transform: scale(1.08); background: rgba(192, 92, 40, .82); }

/* --- nhãn + thẻ video nằm trong lưới kết quả ---------------------------- */
.grid-label {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 2px 0 4px; padding: 0 2px;
}
.grid-label-key {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  color: #fff; background: #b4562b; border-radius: 999px; padding: 5px 11px;
}
.grid-label-text { font-size: 13px; color: #7b6a58; }
.grid-label-more {
  margin-left: auto; border: 0; background: none; padding: 4px 0;
  color: #9a6a3f; font-size: 12.5px; cursor: pointer;
}
.grid-label-more:hover { color: #7a3f14; text-decoration: underline; }

.product-card.video-card { cursor: pointer; }
.product-card.video-card .card-media { position: relative; }
.product-card.video-card .card-media .vplay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  inset: auto; margin: 0; width: 46px; height: 46px;
  background: rgba(16, 20, 26, .58); opacity: .96;
}
.product-card.video-card:hover .card-media .vplay {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(180, 86, 43, .9);
}
.product-card.video-card .card-media .vplay svg { fill: #fdf6ec; }
.product-card.video-card .badge-video { background: #1b2a38; color: #eaf3fb; }
.product-card.video-card.is-short .card-media img { object-fit: cover; }
.vname {
  font-size: 12.5px; line-height: 1.4; color: #33271d; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vdate { font-size: 11px; color: #9a8a7b; }

.video-grid {
  display: grid; gap: 22px 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.video-grid .vcard { flex: none; width: auto; }
.video-grid .vname { font-size: 13.5px; }

/* --- modal xem video ------------------------------------------------- */
.vmodal { position: fixed; inset: 0; z-index: 470; display: grid; place-items: center; padding: 24px; }
.vmodal.hidden { display: none; }
body.vmodal-open { overflow: hidden; }
.vbackdrop { position: absolute; inset: 0; background: rgba(18, 14, 10, .74); backdrop-filter: blur(6px); }
.vshell {
  position: relative; width: min(1000px, 94vw); max-height: 92vh; overflow: auto;
  background: #14110e; border-radius: 18px; padding: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.vclose {
  position: absolute; top: 10px; right: 12px; z-index: 2; width: 34px; height: 34px;
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.vclose:hover { background: rgba(255, 255, 255, .22); }
.vframe { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.vframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vmeta { padding: 14px 6px 4px; color: #f3ece3; }
.vkicker {
  margin: 0 0 4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: #c79a6a;
}
.vmeta h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.35; font-weight: 600; }
.vsub { margin: 0 0 12px; font-size: 12px; color: #9d9184; }
.vactions { display: flex; flex-wrap: wrap; gap: 8px; }
.vbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08); color: #f3ece3; font: inherit; font-size: 12.5px;
  text-decoration: none; cursor: pointer;
}
.vbtn:hover { background: rgba(255, 255, 255, .16); }
.vbtn-ghost { background: none; color: #c79a6a; border-color: rgba(199, 154, 106, .5); }

/* --- khối video trong chi tiết sản phẩm ------------------------------ */
.pd-video { margin: 18px 0 6px; padding: 14px; border: 1px solid #eadfce; border-radius: 14px; background: #fffaf3; }
.pd-video-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pd-video-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: #3a2c20; }
.pd-video-badge {
  margin-left: auto; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: #8a4b12; background: #fde8cf; border-radius: 6px; padding: 3px 8px;
}
.pd-video-channel { margin-left: auto; font-size: 12px; color: #9a6a3f; text-decoration: none; }
.pd-video-body { display: flex; gap: 14px; align-items: center; }
.pd-video-play {
  position: relative; flex: 0 0 196px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9;
}
.pd-video-play img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-video-play .vplay { width: 34px; height: 34px; }
.pd-video-meta { display: flex; flex-direction: column; gap: 6px; }
.pd-video-meta strong { font-size: 13px; line-height: 1.4; color: #33271d; }
.pd-video-meta span { font-size: 11.5px; color: #9a8a7b; }
.pd-video-meta .btn { align-self: flex-start; margin-top: 2px; }
.pd-video.is-quiet { background: #fbf7f1; }
.pd-video .hint { margin: 0; font-size: 12px; color: #9a8a7b; }

/* --- shorts: thẻ dọc + trình xem toàn màn hình --------------------- */
.vcard.is-short .vthumb { aspect-ratio: 9 / 16; }
.vbadge-short {
  position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 7px;
  border-radius: 999px; background: rgba(192, 92, 40, .92); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
}
.video-grid .is-short { flex-direction: column; }

.vmodal.is-short { padding: 0; background: #05070a; }
.vmodal.is-short .vbackdrop { background: #05070a; backdrop-filter: none; }
.vmodal.is-short .vshell {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: 100vw; max-height: none;
  border-radius: 0; padding: 0; overflow: hidden; background: #000;
  display: flex; flex-direction: column; box-shadow: none;
}
.vmodal.is-short .vframe {
  flex: 1 1 auto; aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0;
}
.vmodal.is-short .vframe iframe { width: 100%; height: 100%; }
.vmodal.is-short .vmeta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 46px 16px 18px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .86)); pointer-events: none;
}
.vmodal.is-short .vmeta > * { pointer-events: auto; }
.vmodal.is-short .vkicker { color: #e0b98a; margin-bottom: 2px; }
.vmodal.is-short .vmeta h2 {
  color: #fff; font-size: 14.5px; line-height: 1.35; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vmodal.is-short .vsub { color: rgba(255, 255, 255, .62); margin-bottom: 10px; }
.vmodal.is-short .vclose { top: 14px; right: 14px; background: rgba(0, 0, 0, .5); }
.vmodal.is-short .vbtn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); }

.cart-btn.add-btn { background: #fffdf9; color: #b4661f; border: 1px solid #e8dcc8; }
.cart-btn.add-btn:hover { background: #f7ece0; }
.cart-btn.add-btn svg { width: 20px; height: 20px; }

/* --- thêm sản phẩm bằng URL ---------------------------------------- */
.amodal { position: fixed; inset: 0; z-index: 480; display: grid; place-items: center; padding: 20px; }
.amodal.hidden { display: none; }
.abackdrop { position: absolute; inset: 0; background: rgba(18, 14, 10, .68); backdrop-filter: blur(6px); }
.ashell {
  position: relative; width: min(720px, 96vw); max-height: 92vh; overflow: auto;
  background: #fffdf9; border-radius: 18px; padding: 22px 22px 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.ashell h2 { margin: 0 0 4px; font-size: 19px; color: #2b1f14; }
.ashell .ahint { margin: 0 0 16px; font-size: 12.5px; color: #8b7a6a; line-height: 1.5; }
.aclose {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: #f1e9de; color: #5c4a38; font-size: 20px; line-height: 1; cursor: pointer;
}
.arow { display: flex; gap: 8px; margin: 10px 0; }
.arow input { flex: 1 1 auto; min-width: 0; }
.ashell input, .ashell textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #e4d8c6;
  background: #fff; font: inherit; font-size: 13.5px; color: #2b1f14;
}
.ashell textarea { min-height: 74px; resize: vertical; line-height: 1.5; }
.ashell label { display: block; margin: 12px 0 5px; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: #9a866f; font-weight: 600; }
.abtn {
  flex: 0 0 auto; padding: 10px 16px; border-radius: 10px; border: 1px solid #e4d8c6;
  background: #fff; color: #4a3826; font: inherit; font-size: 13px; cursor: pointer;
}
.abtn:hover { background: #fbf3e8; }
.abtn.primary { background: #b4661f; border-color: #b4661f; color: #fff; font-weight: 600; }
.abtn.primary:hover { background: #9c5619; }
.abtn:disabled { opacity: .55; cursor: default; }
.aresults { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; max-height: 260px; overflow: auto; }
.aresult {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid #eee3d4; border-radius: 12px; background: #fff;
}
.aresult-main { flex: 1 1 auto; min-width: 0; }
.aresult b { display: block; font-size: 13px; font-weight: 600; color: #2b1f14; line-height: 1.4; }
.aresult small { display: block; font-size: 11.5px; color: #9a866f; word-break: break-all; margin-top: 2px; }
.aresult p { margin: 4px 0 0; font-size: 12px; color: #7b6957; line-height: 1.45; }
.aerr { margin: 10px 0 0; font-size: 12.5px; color: #b4402c; min-height: 16px; }
.anote { margin: 12px 0 0; font-size: 11.5px; color: #9a866f; line-height: 1.5; }
.athumb-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.athumb-row img { width: 74px; height: 74px; object-fit: cover; border-radius: 9px; border: 1px solid #e4d8c6; }

@media (max-width: 760px) {
  .ashell { padding: 18px 16px 22px; }
  .arow { flex-wrap: wrap; }
  .arow .abtn { flex: 1 1 100%; }
}

@media (max-width: 760px) {
  .vmodal { padding: 10px; }
  .vshell { width: 100%; max-height: 94vh; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
  .vcard { flex-basis: 168px; width: 168px; }
  .pd-video-body { flex-direction: column; align-items: stretch; }
  .pd-video-play { flex: 0 0 auto; width: 100%; }
  .brand-logo { width: 38px; height: 38px; }
}

/* video sản phẩm gắn tay + bộ chọn video YouTube trong form thêm */
.pd-video-frame { position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden;
  background: #0b0f0d; margin-top: 10px; }
.pd-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ayt { margin-top: 14px; padding: 12px; border: 1px solid #ece3d4; border-radius: 12px; background: #fcfaf6; }
.ayt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ayt-head b { font-size: 13px; color: #2b2320; }
.ayt-head small { font-size: 11px; color: #8b8175; }
.ayt-list { display: grid; gap: 8px; margin-top: 8px; max-height: 240px; overflow: auto; }
.ayt-card { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid #ece3d4;
  border-radius: 10px; background: #fff; }
.ayt-card img { width: 76px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.ayt-card > div { flex: 1 1 auto; min-width: 0; }
.ayt-card b { display: block; font-size: 12px; line-height: 1.3; color: #2b2320;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ayt-card small { display: block; font-size: 11px; color: #8b8175;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ayt-card.is-picked { border-color: #4b9b6e; background: #f0faf4; }
.ayt-picked:not(:empty) { margin-top: 8px; }

/* ====================================================================
   Bảng thống kê: “Được xem nhiều” thành slide, các dải slide nằm ngay dưới
   ==================================================================== */
.home-stage .dash-grid--top { grid-template-rows: 158px; }
.home-stage .dash-grid--bottom { grid-template-rows: 172px; }
.dash-grid .panel-wide { grid-column: 1 / -1; padding-bottom: 4px; }
.band-track--panel { padding: 0 0 4px; }
.band-track--panel .band-card { flex: 0 0 132px; padding: 6px; }
.band-track--panel .band-card img { height: 78px; }
.band-track--panel .band-name { font-size: 10.5px; -webkit-line-clamp: 2; }
.slide-band--dash {
  background: transparent;
  border-top: 0;
  padding: 12px 2px 18px;
  gap: 12px;
  z-index: 1;
}
.slide-band--dash .band-head h2 { font-size: 13px; }
.slide-band--dash .band-card { flex-basis: 148px; }
.slide-band--dash .band-card img { height: 88px; }
.video-grid-body { display: contents; }
.video-more-wrap { grid-column: 1 / -1; display: flex; justify-content: center; padding: 18px 0 8px; }
@media (max-width: 760px) {
  .home-stage .dash-grid--top, .home-stage .dash-grid--bottom { grid-template-rows: auto; }
  .band-track--panel .band-card { flex-basis: 118px; }
}


/* ---------------------------- thẻ video trong lưới kết quả
   stage.css nạp SAU styles.css nên luật nổi bật phải nằm ở đây, nếu không
   nút phát 46px nền tối cũ sẽ đè mất. */
.product-card.video-card {
  border-color: #e6d3bd;
  box-shadow: 0 1px 0 rgba(35, 25, 16, .04);
}
.product-card.video-card .card-media {
  background: #0c1218;
  padding: 0;
}
.product-card.video-card .card-media img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}
.product-card.video-card .card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 12, 17, 0) 42%, rgba(8, 12, 17, .5) 100%);
  pointer-events: none;
}
.product-card.video-card .card-media .vplay {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  margin: 0;
  background: rgba(192, 92, 40, .95);
  box-shadow: 0 10px 24px rgba(8, 12, 17, .35), 0 0 0 3px rgba(255, 255, 255, .22);
  backdrop-filter: none;
  opacity: 1;
  transition: transform .25s ease, background .25s ease;
}
.product-card.video-card:hover .card-media .vplay {
  transform: translate(-50%, -50%) scale(1.07);
  background: #c05c28;
}
.product-card.video-card .card-media .vplay svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  margin-left: 2px;
}
.product-card.video-card .badge-video {
  background: #c05c28;
  color: #fff;
  font-weight: 700;
  letter-spacing: .07em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 6px;
}
.product-card.video-card .badge-video svg {
  width: 9px;
  height: 9px;
  fill: #fff;
}


/* Nút phát và nhãn phải nằm TRÊN lớp gradient của khung ảnh — trước đây ::after
   vẽ sau nên phủ tối đúng cái nút phát, video trông xỉn như ảnh thường. */
.product-card.video-card .card-media .vplay { z-index: 3; }
.product-card.video-card .card-media .card-badges { z-index: 4; }

/* Feed video: tiêu đề + mô tả + sản phẩm gợi ý tự ẩn sau 5 giây, bấm vào
   khung video để hiện lại. */
.vslide-meta { transition: opacity .38s ease, transform .38s ease; }
.vslide.is-meta-hidden .vslide-meta {
  opacity: 0;
  transform: translateY(26px);
  pointer-events: none;
}
.vslide-tapcatch { display: none; }
.vslide.is-meta-hidden .vslide-tapcatch {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
