/* Be Vietnam Pro tự host (không tải từ Google nữa) — đủ 5 weight 400/500/600/700/800, 2 subset vietnamese + latin. */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-vietnamese-400.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-vietnamese-500.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-vietnamese-600.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-vietnamese-700.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-vietnamese-800.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/be-vietnam-pro-latin-800.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Tông XANH CHUYÊN NGHIỆP: xanh lá emerald làm chủ đạo + xanh dương làm điểm nhấn. */
  --amber: #0e7c66;        /* brand chính (emerald) — giữ tên biến cũ để không phải sửa mọi rule */
  --amber-dark: #0a5c4c;
  --amber-soft: #e3f3ef;
  --teal: #1766a6;         /* xanh dương — mã lô, số điện thoại, liên kết */
  --teal-soft: #e7f0f8;
  --green: #2e7d4f;        /* chip tiêu chí */
  --red: #c0492c;
  --bg: #eef2f4;
  --card: #ffffff;
  --panel: #f6f9fa;
  --border: #e0e7ea;
  --text: #1e2a2e;
  --muted: #66757c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 45, 55, 0.06), 0 1px 3px rgba(20, 45, 55, 0.05);
  --shadow-md: 0 4px 14px rgba(20, 45, 55, 0.10);
  --shadow-lg: 0 12px 34px rgba(20, 45, 55, 0.18);
  --font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --amber: #22a184;
    --amber-dark: #1a7d67;
    --amber-soft: #133029;
    --teal: #59a7e0;
    --teal-soft: #14283a;
    --bg: #13181b;
    --card: #1c2327;
    --panel: #182024;
    --border: #2c363b;
    --text: #eef3f4;
    --muted: #9aa8ae;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

/* QUAN TRỌNG: [hidden] phải thắng mọi display:flex của tác giả. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  padding-top: env(safe-area-inset-top, 0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ------------------------------ TOPBAR ------------------------------ */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 15px 22px;
  /* Chỉ dùng biến màu thương hiệu -> mỗi app (xanh/tím/xanh dương) tự đồng nhất, không lẫn màu. */
  background: linear-gradient(120deg, var(--amber) 0%, var(--amber-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo {
  width: 46px; height: 46px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.brand-logo img { width: 34px; height: 34px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title {
  font-size: 1.2rem; font-weight: 800; letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}
.brand-sub { font-size: 0.79rem; opacity: 0.92; font-weight: 500; }
.sync-box { display: flex; align-items: center; gap: 10px; }
.sync-info { font-size: 0.78rem; opacity: 0.92; text-align: right; }

main { max-width: 1160px; margin: 0 auto; padding: 20px 16px 72px; }

/* --------------------------- SEARCH (hero) --------------------------- */
.search-bar { position: relative; margin-bottom: 4px; }
.search-bar input {
  width: 100%;
  padding: 16px 18px 16px 48px;
  font-size: 1.04rem;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--card)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a9499' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.5' y2='16.5'/></svg>")
    no-repeat 16px center;
  color: var(--text);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.18s, border-color 0.18s;
}
.search-bar input::placeholder { color: var(--muted); opacity: 0.85; }
.search-bar input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(14, 124, 102, 0.16), var(--shadow-md);
}

/* Gợi ý khi gõ (autocomplete) */
.suggest-box {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 30;
}
.suggest-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover, .suggest-item.active { background: var(--amber-soft); }
.suggest-item .s-ico { font-size: 1rem; }
.suggest-item .s-label { font-weight: 600; color: var(--text); }
.suggest-item .s-type { margin-left: auto; font-size: 0.76rem; color: var(--muted); white-space: nowrap; }

mark { background: #ffe08a; color: #23303a; padding: 0 2px; border-radius: 3px; font-weight: 700; }

/* Khối gợi ý khi 0 kết quả */
.empty-state {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  margin: 8px 0;
  box-shadow: var(--shadow-sm);
}
.empty-title { font-size: 1.08rem; font-weight: 700; color: var(--text); }
.empty-sub { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.empty-hints { margin-top: 10px; text-align: left; display: inline-block; }
.empty-hints p { font-weight: 600; margin: 0 0 4px; font-size: 0.88rem; color: var(--text); }
.empty-hints ul { margin: 0; padding-left: 18px; font-size: 0.84rem; color: var(--muted); }
.empty-hints li { margin: 2px 0; }
.badge-explain { background: #f0f4f8; color: #456; font-weight: 500; font-size: 0.7rem; max-width: 340px; }
@media (prefers-color-scheme: dark) { .badge-explain { background: #2a2e34; color: #b0c4d8; } .empty-hints p { color: #ddd; } }

.card-addr { font-size: 0.86rem; color: var(--muted); margin: 2px 0 4px; }
.addr-map-link { color: var(--teal); font-weight: 600; text-decoration: none; }
.addr-map-link:hover { text-decoration: underline; }

/* Chip gợi ý tìm kiếm mẫu (Search Chips) */
.search-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.search-chip {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.search-chip:hover {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber-dark);
  box-shadow: var(--shadow-sm);
}

/* Near-match banner */
.empty-near {
  display: flex; align-items: flex-start; gap: 10px;
  background: linear-gradient(135deg, var(--amber-soft), #f0faf7);
  border: 1px solid rgba(14, 124, 102, 0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 8px 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}
.near-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
@media (prefers-color-scheme: dark) {
  .empty-near { background: linear-gradient(135deg, #133029, #1a2e28); border-color: rgba(34, 161, 132, 0.3); }
}

/* Relax hint buttons */
.relax-hint-btn {
  background: none; border: none; color: var(--teal); cursor: pointer;
  font-family: var(--font); font-size: 0.84rem; padding: 2px 0; text-align: left;
}
.relax-hint-btn:hover { text-decoration: underline; }

/* Chip nhận diện nhu cầu (khu vực/ngân sách/TIÊU CHÍ) */
.intent-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 2px; }
.intent-chip {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border: 1px solid rgba(14, 124, 102, 0.22);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ------------------------------ FILTERS (gộp 1 khối + thu gọn) ------------------------------ */
.filters {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filters-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: end;
}

.f-item { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.f-item span { padding-left: 2px; letter-spacing: 0.2px; }
.f-item input, .f-item select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.f-item input:focus, .f-item select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(14, 124, 102, 0.14);
}
.f-item input[type="number"] { width: 130px; }
.f-range-pair { display: flex; align-items: center; gap: 5px; }
.f-range-pair input[type="number"] { width: 78px; }
.f-range-pair span { color: var(--muted); font-size: 0.8rem; }

/* ------------------------------ BUTTONS ------------------------------ */
.btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: rgba(255, 255, 255, 0.20); color: #fff; text-decoration: none; display: inline-block; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.30); }
.btn-clear { background: var(--card); color: var(--text); border: 1px solid var(--border); align-self: end; }
.btn-clear:hover { border-color: var(--amber); color: var(--amber-dark); }
/* Nút "Xóa lọc" ở bộ lọc — tô đỏ nổi bật, TÁCH RIÊNG khỏi .btn-clear (class đó còn dùng chung
   cho "Sao chép"/"Bản đồ" trong thẻ sản phẩm, đổi màu ở đó sẽ ăn luôn vào các nút này). */
.btn-danger { background: var(--red); color: #fff; border: 1px solid var(--red); align-self: end; box-shadow: 0 2px 8px rgba(192, 73, 44, 0.3); }
.btn-danger:hover { background: #a53d24; border-color: #a53d24; }
.btn-primary { background: var(--amber); color: #fff; box-shadow: 0 2px 8px rgba(14, 124, 102, 0.28); }
.btn-primary:hover { background: var(--amber-dark); }
/* Nút "Gửi khách" — xanh dương nổi bật, tách khỏi các nút xanh lá. */
.btn-send { background: var(--teal); color: #fff; box-shadow: 0 2px 8px rgba(23, 102, 166, 0.28); }
.btn-send:hover { filter: brightness(1.08); }
.btn-small { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }

.result-meta { margin-top: 16px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }

/* ------------------------------ RESULTS ------------------------------ */
.results {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(14, 124, 102, 0.35);
}
/* Đầu thẻ: bleed ra sát mép bằng lề âm, nền nhạt, giá nổi bật bên phải */
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: -16px -16px 4px;
  padding: 13px 16px;
  background: linear-gradient(180deg, var(--panel), transparent);
  border-bottom: 1px solid var(--border);
}
.card-code {
  font-weight: 800; color: var(--teal); font-size: 0.82rem;
  background: var(--teal-soft);
  padding: 4px 11px; border-radius: 20px; letter-spacing: 0.3px;
}
.card-dt { font-weight: 700; color: var(--text); font-size: 0.95rem; margin-left: auto; }
.card-gia {
  font-weight: 800; color: #fff; font-size: 0.96rem;
  background: linear-gradient(135deg, var(--amber), var(--amber-dark));
  padding: 4px 11px; border-radius: 9px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(14, 124, 102, 0.28);
}
/* Thân thẻ */
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { border-radius: 7px; padding: 3px 9px; font-size: 0.72rem; font-weight: 600; }
.badge-fit { background: var(--teal-soft); color: var(--teal); }
.badge-star { background: #fbeecb; color: #9a6a12; border: 1px solid #edd28a; }
.badge-tieuchi {
  background: linear-gradient(135deg, #2e7d4f, #256b42);
  color: #fff; border: none; font-weight: 700;
  box-shadow: 0 2px 6px rgba(46, 125, 79, 0.30);
}
.badge-thieu {
  background: #f4ede0; color: #9a7b4a; border: 1px dashed #d8c39a; font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .badge-star { background: #3a3016; color: #f0cf7a; border-color: #5a4a22; }
  .badge-thieu { background: #2e2a20; color: #cdb583; border-color: #5a4a22; }
}
.badge-under { background: #e5f3ea; color: var(--green); }
.badge-over { background: #f7e7e0; color: var(--red); }
.badge-nguon { background: #ece7fb; color: #5b21b6; border: 1px solid #d6c9f5; }
@media (prefers-color-scheme: dark) {
  .badge-under { background: #1e3a2a; color: #7fd39f; }
  .badge-over { background: #3a241d; color: #e6a08a; }
  .badge-nguon { background: #2a2140; color: #c4b5fd; border-color: #43356b; }
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.72rem; }
.tag {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--muted);
  font-weight: 500;
}
.card-content {
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 5.8em;
  overflow: hidden;
  color: var(--text);
  position: relative;
}
.card-content:not(.expanded)::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1.6em;
  background: linear-gradient(transparent, var(--card));
  pointer-events: none;
}
.card-content.expanded { max-height: none; }
.card-content.expanded::after { display: none; }
.content-ma { display: block; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.card-contact {
  font-size: 0.79rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.phone-link { color: var(--teal); font-weight: 700; text-decoration: none; }
.phone-link:active { opacity: 0.7; }
.card-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 4px;
}
.card-actions a.btn { text-decoration: none; display: inline-block; }
.card-sold { opacity: 0.72; }
.card-sold .card-code::after { content: ' (đã bán)'; color: var(--red); font-weight: 600; font-size: 0.8rem; }

.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }

.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  z-index: 20;
}

.lien-he-fab {
  position: fixed;
  right: 16px; bottom: 20px;
  display: flex; align-items: center; gap: 7px;
  background: var(--green);
  color: #fff; text-decoration: none;
  font-weight: 700; font-size: 0.88rem;
  padding: 12px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 25;
  transition: transform 0.12s;
}
.lien-he-fab:hover { transform: translateY(-2px); }
.lien-he-fab span:first-child { font-size: 1.05rem; }
.lien-he-fab:active { opacity: 0.85; }

.ios-install-bar {
  position: sticky;
  top: env(safe-area-inset-top, 0);
  z-index: 15;
  display: flex; align-items: center; gap: 10px;
  background: var(--amber);
  color: #fff;
  padding: 10px 14px;
  font-size: 0.85rem; line-height: 1.4;
}
.ios-install-bar span:first-child { flex: 1; }
.ios-install-close {
  background: rgba(255, 255, 255, 0.18);
  border: none; color: #fff;
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.95rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative; z-index: 20;
}

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .sync-info { text-align: left; }
  .f-item input[type="number"] { width: 100%; }
  .f-item { flex: 1 1 45%; }
  .f-item input, .f-item select { width: 100%; }
  .btn-danger { flex: 1 1 100%; text-align: center; }
  .results { grid-template-columns: 1fr; }
  main { padding: 16px 12px 72px; }
}

/* Ảnh thật sản phẩm: dải ảnh cuộn ngang trong thẻ + xem phóng to */
.card-photos { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0; padding-bottom: 4px; scroll-snap-type: x proximity; }
.card-photos img { height: 110px; width: auto; border-radius: 8px; flex: 0 0 auto; cursor: zoom-in; scroll-snap-align: start; background: var(--card, #eee); }
.lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; }
.lightbox .lb-img { max-width: 92vw; max-height: 86vh; border-radius: 6px; }
.lightbox button { position: absolute; background: rgba(255,255,255,0.18); color: #fff; border: 0; font-size: 1.8rem; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; }
.lightbox .lb-x { top: 14px; right: 14px; font-size: 1.2rem; }
.lightbox .lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: 16px; color: #fff; font-size: 0.9rem; }

/* Thanh báo đang xem 1 lô từ link chia sẻ */
.share-bar { max-width: 1200px; margin: 8px auto; padding: 8px 14px; border-radius: 10px; background: #eef6f4; color: #0a5c4c; font-size: 0.92rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.share-bar a { font-weight: 700; color: inherit; text-decoration: none; white-space: nowrap; }

/* Thẻ Ngọc Bích tư vấn trên đầu kết quả tìm kiếm (Thắng, 2026-10-31; đổi tên 05/11/2026 theo ý anh) */
.ai-card{border:1.5px solid var(--amber,#0e7c66);background:#f0faf7;}
.nc-row{display:flex;gap:8px;flex-wrap:wrap}
.nc-row>*{flex:1;min-width:140px}

/* ==================== Chuẩn giao diện (enterprise-admin-ui, 2026-11-07) ====================
 * Phẳng, viền mảnh thay bóng đổ; bo góc tối đa 8px; một bộ biểu tượng; chữ đủ tương phản.
 * Bóng đổ chỉ còn ở lớp nổi (hộp gợi ý, hộp thoại, trợ lý chat). */
:root {
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 0 #0000;
  --shadow-md: 0 0 #0000;
  --muted: #566870;                 /* chữ phụ: đạt tương phản 4,5:1 trên nền xám nhạt */
}
.bt { vertical-align: -0.14em; flex-shrink: 0; }
.topbar { background: var(--amber); box-shadow: none; border-bottom: 1px solid var(--amber-dark); }
.card-head { background: var(--panel); }
.card-gia { background: var(--amber); border-radius: 8px; box-shadow: none; }
.badge-tieuchi { background: #2e7d4f; box-shadow: none; }
.badge-star { color: #7a520b; }
.btn-primary, .btn-send, .btn-danger { box-shadow: none; }
.empty-near { background: var(--amber-soft); }
.brand-logo { border-radius: 8px; }
#statsBtn, #qInput { border-radius: 8px; }
@media (prefers-color-scheme: dark) {
  :root { --shadow-sm: 0 0 #0000; --shadow-md: 0 0 #0000; --muted: #a7b4ba; }
  .empty-near { background: var(--amber-soft); }
}
/* Nút trên thanh đầu trang: nền tối trong suốt để chữ trắng đạt tương phản */
#khachBtn, #statsBtn, #syncBtn { background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.35); }
#khachBtn:hover, #statsBtn:hover, #syncBtn:hover { background: rgba(0, 0, 0, 0.34); }
#khachBtn, #statsBtn, #syncBtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.sync-box { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 560px) { .sync-box { width: 100%; } .sync-info { flex: 1 1 100%; } }

/* Sếp bỏ hàng nút gợi ý nhanh (2026-11-07): không cần thiết */
.search-chips { display: none !important; }

/* ==================== Điện thoại gọn + thẻ dễ đọc (2026-11-07 v2) ==================== */
/* Thẻ sản phẩm (mọi cỡ màn hình): giá và diện tích to, rõ; bớt chữ phụ */
.card-head { padding: 12px 16px; }
.card-dt { font-size: 1.12rem; font-weight: 800; }
.card-gia { font-size: 1.12rem; padding: 5px 13px; }
.card-code { font-size: 0.78rem; }
.card-contact { word-break: break-word; }
.card-contact + .card-contact { background: transparent; border: 0; padding: 0 2px; font-size: 0.76rem; }

/* Nút Bộ lọc + nút Báo hàng mới nằm cùng một hàng (chỉ có sau khi dien-thoai.js dựng) */
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 2px; }
.tool-row .chip { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 18px; padding: 7px 13px; font-family: var(--font); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.loc-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.loc-btn .loc-n { background: var(--amber); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 0.74rem; line-height: 20px; text-align: center; }
.loc-btn.mo { border-color: var(--amber); }
#menuBtn { display: none; }

@media (min-width: 701px) {
  .loc-btn { display: none; }
}
@media (max-width: 700px) {
  /* 1. Đầu trang một hàng */
  .topbar { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 8px 12px; }
  .brand { gap: 10px; flex: 1 1 auto; min-width: 0; }
  .brand-logo { width: 36px; height: 36px; border-radius: 8px; }
  .brand-text { min-width: 0; }
  .brand-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { display: none; }
  .sync-box { width: auto; flex: 0 0 auto; flex-wrap: nowrap; position: relative; gap: 6px; }
  #khachBtn { padding: 6px 12px; }
  #menuBtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; padding: 0; background: rgba(0, 0, 0, 0.22); color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 8px; cursor: pointer; }
  #menuPanel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 230px; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); }
  #menuPanel[hidden] { display: none; }
  #menuPanel .sync-info { color: var(--muted); font-size: 0.8rem; text-align: left; flex: none; }
  #menuPanel .btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border); justify-content: flex-start; }
  #menuPanel #statsBtn[hidden] { display: none; }

  /* 2. Chip gợi ý nhanh: một hàng vuốt ngang thay vì 4 hàng */
  .search-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 8px -12px 2px; padding: 0 12px 2px; }
  .search-chips::-webkit-scrollbar { display: none; }
  .search-chip { flex: 0 0 auto; }

  /* 3. Bộ lọc gấp */
  .filters.loc-dong { display: none; }
  .search-bar input { padding: 13px 14px 13px 44px; }
  .result-meta { margin-top: 10px; }
}
@media (prefers-color-scheme: dark) {
  #menuPanel { background: var(--card); }
}

