/* ==========================================================================
   TOPDEAL DESIGN SYSTEM — CLEAN LIGHT THEME (DESKTOP OPTIMIZED)
   ========================================================================== */

:root {
  /* Kích thước & Khung lưới */
  --max-w: 1480px;
  --sidebar-w: 280px;
  --header-h: 64px;
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-sm: 8px;

  /* Bảng màu Sáng Độc Quyền (Clean Light Theme) */
  --bg: #f4f6fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-hover: #f1f4f9;

  /* Viền & Phân tách */
  --border: #e6e9f0;
  --border-hover: #cbd2e0;
  --border-focus: #ff5722;

  /* Văn bản & Tương phản (WCAG AA) */
  --text-main: #111827;
  --text-muted: #4b5563;
  --text-subtle: #8a94a6;

  /* Màu thương hiệu & Trạng thái Deal */
  --shopee-orange: #ee4d2d;
  --shopee-pink: #f53d2d;
  --grad-primary: linear-gradient(135deg, #ff5722 0%, #ee2a7b 100%);
  --grad-subtle: linear-gradient(135deg, rgba(255, 87, 34, 0.08) 0%, rgba(238, 42, 123, 0.08) 100%);
  --price-color: #ee4d2d;
  
  --deal-green: #059669;
  --deal-green-bg: #ecfdf5;
  --deal-green-border: #a7f3d0;
  --warn: #d97706;
  --warn-bg: #fffbeb;

  /* Đổ bóng trên nền sáng */
  --shadow-sm: 0 2px 6px rgba(17, 24, 39, 0.04);
  --shadow-card: 0 4px 14px -3px rgba(17, 24, 39, 0.06), 0 2px 4px -2px rgba(17, 24, 39, 0.03);
  --shadow-hover: 0 16px 32px -8px rgba(238, 77, 45, 0.16), 0 4px 12px -2px rgba(17, 24, 39, 0.04);
  --shadow-modal: 0 25px 60px -15px rgba(17, 24, 39, 0.25);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

/* Base styles */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Be Vietnam Pro', Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
.container { width: min(var(--max-w), 100% - 48px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.03);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 4px 12px -2px rgba(238, 42, 123, 0.4);
}
.brand-name b {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--deal-green-bg);
  color: var(--deal-green);
  border: 1px solid var(--deal-green-border);
  text-transform: uppercase;
}

/* Search bar */
.search-wrap {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-ico {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 42px;
  padding: 0 74px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  outline: none;
  font-size: 14px;
  transition: all 0.2s var(--ease);
}
.search input:focus {
  background: #ffffff;
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.14);
}
.search input::placeholder { color: var(--text-subtle); }
.q-clear {
  position: absolute;
  right: 38px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 0;
  cursor: pointer;
  font-size: 11px;
  color: #475569;
  transition: background 0.15s;
}
.q-clear:hover { background: #cbd5e1; }
.search kbd {
  position: absolute;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  padding: 1px 6px;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: #ffffff;
  transition: all 0.2s;
}
.header-link:hover {
  color: var(--shopee-orange);
  border-color: var(--border-hover);
  background: var(--surface-subtle);
}

/* ==========================================================================
   COMPACT HERO (2 CỘT)
   ========================================================================== */
.hero-pc {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 32px;
  align-items: center;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.hero-left h1 {
  margin: 0;
  font-size: clamp(24px, 2.5vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--text-main);
}
.hero-left h1 em {
  font-style: normal;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 10px 0 16px;
  color: var(--text-muted);
  font-size: 14px;
  max-width: 620px;
}
.stats-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.stat-pill b { color: var(--text-main); font-weight: 700; }
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--deal-green);
  box-shadow: 0 0 0 0 var(--deal-green);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Spotlight Card (Hero Right) */
.spotlight-card {
  display: flex;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.spotlight-card:hover {
  transform: translateY(-2px);
  border-color: var(--shopee-orange);
  box-shadow: var(--shadow-hover);
}
.spotlight-media {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-subtle);
  flex-shrink: 0;
}
.spotlight-media img { width: 100%; height: 100%; object-fit: cover; }
.spotlight-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.spotlight-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--grad-primary);
  color: #fff;
}
.spotlight-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spotlight-prices { display: flex; align-items: baseline; gap: 8px; }
.spotlight-price { font-size: 18px; font-weight: 800; color: var(--price-color); }
.spotlight-old { font-size: 12px; color: var(--text-subtle); text-decoration: line-through; }
.spotlight-hint { font-size: 11px; color: var(--deal-green); font-weight: 600; }

/* ==========================================================================
   LAYOUT 2 CỘT CHUẨN DESKTOP
   ========================================================================== */
.layout-2col {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-bottom: 60px;
}

/* ==========================================================================
   SIDEBAR BỘ LỌC
   ========================================================================== */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding: 6px 4px 20px 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

/* Filter Box */
.filter-box {
  background: var(--bg-sidebar);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.filter-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.btn-clear-cat {
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--shopee-orange);
  cursor: pointer;
  padding: 0;
}
.btn-clear-cat:hover { text-decoration: underline; }

/* Reset all button */
.btn-reset-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  border-radius: var(--radius-btn);
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  transition: all 0.2s;
}
.btn-reset-filters:hover { background: #fecaca; }

/* Tree view danh mục 3 cấp */
.cat-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tree-node-1, .tree-node-2, .tree-node-3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-main);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.tree-node-1:hover { background: var(--surface-hover); }
.tree-node-1.active {
  background: var(--grad-subtle);
  color: var(--shopee-orange);
  font-weight: 700;
}
.tree-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tree-arrow {
  display: inline-block;
  font-size: 9px;
  color: var(--text-subtle);
  transition: transform 0.2s;
}
.tree-node-1.open .tree-arrow { transform: rotate(90deg); color: var(--shopee-orange); }
.tree-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-count {
  font-size: 11px;
  color: var(--text-subtle);
  background: var(--surface-subtle);
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.tree-sub-list {
  padding-left: 14px;
  margin: 2px 0 6px;
  border-left: 2px dashed #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tree-node-2 { font-size: 12.5px; color: var(--text-muted); }
.tree-node-2:hover { background: var(--surface-hover); color: var(--text-main); }
.tree-node-2.active {
  background: rgba(255, 87, 34, 0.1);
  color: var(--shopee-orange);
  font-weight: 700;
}
.tree-leaf-list {
  padding-left: 12px;
  margin: 1px 0 4px;
  border-left: 2px dotted #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tree-node-3 { font-size: 12px; color: var(--text-subtle); }
.tree-node-3:hover { background: var(--surface-hover); color: var(--text-main); }
.tree-node-3.active { color: var(--shopee-orange); font-weight: 700; }

/* Filter options (Checkboxes) */
.filter-options { display: flex; flex-direction: column; gap: 8px; }
.filter-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}
.filter-check input { display: none; }
.check-box {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.filter-check input:checked + .check-box {
  background: var(--shopee-orange);
  border-color: var(--shopee-orange);
}
.filter-check input:checked + .check-box::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.check-label { flex: 1; }
.check-count {
  font-size: 11px;
  color: var(--text-subtle);
  background: var(--surface-subtle);
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Filter chips */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filter {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.chip-filter:hover { background: var(--surface-hover); color: var(--text-main); }
.chip-filter.active {
  background: var(--grad-primary);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 10px -2px rgba(238, 42, 123, 0.35);
}

/* ==========================================================================
   MAIN CONTENT AREA & GRID
   ========================================================================== */
.main-content { min-width: 0; }

/* Grid toolbar */
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius-card);
  background: #ffffff;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.result-count {
  font-size: 13.5px;
  color: var(--text-muted);
}
.result-count b { color: var(--text-main); font-weight: 700; }
.active-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff1ee;
  border: 1px solid #ffd4cc;
  color: var(--shopee-orange);
  font-size: 11.5px;
  font-weight: 600;
}
.active-tag button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
  font-size: 11px;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-label {
  font-size: 13px;
  color: var(--text-muted);
}
.select-sort {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}
.select-sort:focus { border-color: var(--shopee-orange); }

/* Grid Sản Phẩm (4 Cột Chuẩn 1080p, 5 Cột trên Ultra-wide) */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (min-width: 1680px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

/* Card Sản Phẩm PC Pro */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: #ffd4cc;
  box-shadow: var(--shadow-hover);
}
.card.stale { opacity: 0.65; }

/* Media & Badges */
.card-media {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-subtle);
  overflow: hidden;
  cursor: pointer;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.card:hover .card-media img { transform: scale(1.05); }

/* Badges trên ảnh */
.badge-discount {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 10px -2px rgba(238, 42, 123, 0.4);
}
.badge-platform {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.badge-platform.shopee { color: var(--shopee-orange); }
.badge-platform.tiktok { color: #111827; }

/* Body */
.card-body {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 8px;
  flex: 1;
}
.card-cat {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
  cursor: pointer;
}
.card-title:hover { color: var(--shopee-orange); }

/* Khối giá & Mini Sparkline */
.card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-price-main {
  display: flex;
  flex-direction: column;
}
.card-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--price-color);
  letter-spacing: -0.01em;
}
.card-price-old {
  font-size: 12px;
  color: var(--text-subtle);
  text-decoration: line-through;
}
.card-sparkline {
  width: 58px;
  height: 22px;
  flex-shrink: 0;
}
.card-sparkline svg { width: 100%; height: 100%; display: block; }

/* Tag đáy 30 ngày */
.card-low30 {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--deal-green-bg);
  border: 1px solid var(--deal-green-border);
  color: var(--deal-green);
  font-size: 11px;
  font-weight: 700;
  align-self: flex-start;
}

/* Meta rating + sold */
.card-meta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.card-star { color: #f59e0b; font-weight: 700; }

/* Freshness indicator */
.card-fresh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: auto;
}
.card-fresh::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--deal-green);
}
.card-fresh.mid::before { background: var(--text-subtle); }
.card-fresh.old { color: var(--warn); }
.card-fresh.old::before { background: var(--warn); }

/* Dual Action Button Bar */
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
  margin-top: 6px;
}
.btn-card-chart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-card-chart:hover {
  background: var(--surface-subtle);
  border-color: var(--border-hover);
  color: var(--shopee-orange);
}
.btn-card-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  border-radius: var(--radius-btn);
  background: var(--grad-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px -2px rgba(238, 42, 123, 0.35);
  transition: filter 0.2s, transform 0.2s;
}
.btn-card-buy:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ==========================================================================
   PAGINATION / CHUNKED LAZY LOAD
   ========================================================================== */
.pagination-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 0 20px;
}
.progress-bar {
  width: 240px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 999px;
  transition: width 0.3s;
}
.progress-text {
  font-size: 13px;
  color: var(--text-muted);
}
.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 28px;
  border-radius: 999px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.btn-load-more:hover {
  border-color: var(--shopee-orange);
  color: var(--shopee-orange);
  background: #fff8f6;
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */
.btn-back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px -4px rgba(17, 24, 39, 0.18);
  color: var(--text-main);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.25s var(--ease);
  z-index: 30;
}
.btn-back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.btn-back-to-top:hover {
  background: var(--shopee-orange);
  color: #fff;
  border-color: var(--shopee-orange);
}

/* ==========================================================================
   MODAL CHI TIẾT & BIỂU ĐỒ TƯƠNG TÁC
   ========================================================================== */
dialog.modal {
  width: min(980px, 100% - 32px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-modal);
  overflow: auto;
}
dialog.modal[open] { animation: modal-pop 0.3s var(--ease); }
dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.m-wrap {
  display: grid;
  grid-template-columns: 440px 1fr;
}
.m-gallery {
  padding: 24px;
  background: var(--surface-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-main-img {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
}
.m-main-img img { width: 100%; height: 100%; object-fit: cover; }
.m-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.m-thumbs button {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: #ffffff;
  opacity: 0.6;
  flex-shrink: 0;
  transition: all 0.2s;
}
.m-thumbs button[aria-current='true'] {
  border-color: var(--shopee-orange);
  opacity: 1;
}
.m-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.m-info {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.m-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s;
}
.m-close:hover { background: var(--surface-subtle); color: var(--text-main); }

.m-breadcrumb {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
}
.m-breadcrumb span { color: var(--shopee-orange); }
.m-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
  padding-right: 36px;
  color: var(--text-main);
}
.m-price-box {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.m-price-now {
  font-size: 28px;
  font-weight: 800;
  color: var(--price-color);
}
.m-price-before {
  font-size: 14px;
  color: var(--text-subtle);
  text-decoration: line-through;
}
.m-badge-off {
  font-size: 13px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--grad-primary);
  color: #fff;
}
.m-savings {
  font-size: 12px;
  font-weight: 600;
  color: var(--deal-green);
}
.m-meta {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.m-note {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff8f6;
  border-left: 3px solid var(--shopee-orange);
  font-size: 13px;
  color: var(--text-muted);
}
.m-note b { color: var(--text-main); display: block; margin-bottom: 3px; }

/* Interactive SVG Chart */
.chart-box {
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.chart-header b { color: var(--text-main); }
.chart-svg-wrap {
  position: relative;
  width: 100%;
  height: 120px;
}
.chart-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-tooltip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: none;
}
.chart-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* Modal Actions */
.m-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
}
.m-btn-buy {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-btn);
  background: var(--grad-primary);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px -4px rgba(238, 42, 123, 0.4);
  transition: all 0.2s;
}
.m-btn-buy:hover { filter: brightness(1.08); transform: translateY(-1px); }
.m-btn-share {
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.m-btn-share:hover { background: var(--surface-subtle); color: var(--text-main); }
.m-disclaimer {
  font-size: 11.5px;
  color: var(--text-subtle);
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: #1e293b;
  color: #ffffff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 100;
  animation: toast-in 0.25s var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px dashed var(--border);
}
.empty-ico { font-size: 48px; margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 6px; font-size: 18px; color: var(--text-main); }
.empty-state p { margin: 0 0 16px; color: var(--text-muted); font-size: 13.5px; }
.empty-state button {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--shopee-orange);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

/* Skeletons */
.sk-card {
  border-radius: var(--radius-card);
  background: #ffffff;
  border: 1px solid var(--border);
  overflow: hidden;
  padding-bottom: 14px;
}
.sk-img {
  aspect-ratio: 1;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line {
  height: 14px;
  margin: 12px 14px 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line.half { width: 50%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: #ffffff;
  padding: 28px 0;
  color: var(--text-subtle);
  font-size: 12.5px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 800px;
}
.footer-brand { font-weight: 700; color: var(--text-main); }
.footer-right a { color: var(--text-muted); font-weight: 600; }
.footer-right a:hover { color: var(--shopee-orange); }

/* ==========================================================================
   ADMIN DASHBOARD PROFESSIONAL STYLES
   ========================================================================== */
.admin-container {
  padding-top: 24px;
  padding-bottom: 60px;
}
.admin-header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

/* ==========================================================================
   ADMIN DASHBOARD (SAAS POLISH V2)
   ========================================================================== */

/* 4 Thẻ KPI Dashboard (SVG Icon Pastel Trong Suốt) */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.kpi-card {
  padding: 18px 20px;
  border-radius: var(--radius-card);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-hover);
}
.kpi-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.kpi-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.kpi-icon-box.orange {
  background: rgba(255, 87, 34, 0.1);
  color: #ff5722;
}
.kpi-icon-box.green {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.kpi-icon-box.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}
.kpi-icon-box.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: -0.01em;
}
.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.kpi-value.safe { color: #059669; }
.kpi-value.warn { color: #d97706; }
.kpi-value.highlight {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Toolbar & Lọc Đa Chiều */
.admin-toolbar-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bộ Lọc Nhanh 1-Chạm (Quick Preset Filter Chips) */
.quick-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.qchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.qchip:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-main);
}
.qchip.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}
.qchip-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  font-size: 11px;
  font-weight: 700;
}
.qchip.active .qchip-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.qchip.weak {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.qchip.weak:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.qchip.weak.active {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}
.qchip-badge.weak {
  background: #fca5a5;
  color: #7f1d1d;
}
.qchip.weak.active .qchip-badge.weak {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.admin-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-box-admin {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 260px;
}
.search-box-admin input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 38px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.2s;
}
.search-box-admin input:focus {
  background: #ffffff;
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}
.search-box-admin .search-ico {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
}
.search-box-admin .q-clear {
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.search-box-admin .q-clear:hover { background: #cbd5e1; color: #0f172a; }

/* Custom Sleek Dropdowns với SVG Chevron */
.admin-select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  padding: 0 30px 0 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-select:focus {
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-refresh:hover {
  background: var(--surface-subtle);
  border-color: var(--border-hover);
  color: var(--shopee-orange);
}
.btn-refresh.loading .btn-refresh-ico {
  animation: spin 0.8s linear infinite;
}

/* Bulk Actions Bar Chuẩn SaaS & Power Operations */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 13px;
  animation: modal-pop 0.2s var(--ease);
  flex-wrap: wrap;
}
.bulk-info-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bulk-count b { color: #1e3a8a; }
.btn-select-all-filtered {
  border: 0;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-select-all-filtered:hover {
  background: #bfdbfe;
}
.bulk-actions-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: #1d4ed8;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm:hover { background: #dbeafe; }
.btn-warn {
  background: #fef3c7;
  border-color: #fde68a;
  color: #b45309;
}
.btn-warn:hover { background: #fde68a; }
.btn-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
  font-weight: 700;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #64748b;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); color: #0f172a; }

/* Bảng Dữ Liệu Thông Minh */
.admin-table-wrap {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  position: relative;
  max-height: calc(100vh - 240px);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.admin-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  box-shadow: 0 1px 0 var(--border);
}
.admin-table th {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  user-select: none;
  white-space: nowrap;
}
.admin-table th.sortable { cursor: pointer; }
.admin-table th.sortable:hover { color: var(--shopee-orange); }
.sort-ico { font-size: 11px; margin-left: 2px; opacity: 0.6; }

.admin-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table tbody tr.selected-row { background: #f0fdf4 !important; }
.admin-table tbody tr.hidden-row { opacity: 0.55; }
.admin-table td {
  padding: 10px 14px;
  vertical-align: middle;
}

/* Các cell con trong bảng */
.table-img-wrap {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.table-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* Cột Tiêu đề & Shop (Text 2 dòng - No raw input) */
.table-title-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
}
.table-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.table-title-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.btn-quick-edit-title {
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s;
  opacity: 0.5;
}
tr:hover .btn-quick-edit-title { opacity: 1; }
.btn-quick-edit-title:hover {
  background: #fff1ee;
  color: var(--shopee-orange);
}

.table-shop-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-subtle);
  flex-wrap: wrap;
}
.table-platform-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.table-platform-tag.shopee { background: #fff1ee; color: var(--shopee-orange); }
.table-platform-tag.tiktok { background: #0f172a; color: #ffffff; }
.table-shop-name {
  color: var(--text-muted);
  font-weight: 600;
}
.table-id {
  font-family: monospace;
  color: #94a3b8;
}

/* Cột Đã bán & Đánh giá (Rating & Sold) */
.table-social-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 125px;
}
.table-rating-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.star-score {
  color: #d97706;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.star-score.weak {
  color: #b91c1c;
  background: #fee2e2;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.star-score.none {
  color: #94a3b8;
  font-weight: 500;
  font-size: 11px;
}
.star-count {
  color: #94a3b8;
  font-size: 11px;
}
.badge-sold {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  align-self: flex-start;
  background: #f1f5f9;
  color: #475569;
}
.badge-sold.hot {
  background: #fff1ee;
  color: #ff5722;
  font-weight: 700;
  border: 1px solid #ffd4cc;
}
.badge-sold.good {
  background: #ecfdf5;
  color: #059669;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}
.badge-sold.low {
  color: #94a3b8;
  background: transparent;
  padding: 0;
  font-size: 11px;
}

/* Cột Danh mục 3 cấp (Hierarchical Tree View) */
.table-cat-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}
.cat-pill-level1 {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 11.5px;
  font-weight: 700;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-sub-branch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: #64748b;
}
.cat-tree-arrow {
  color: #94a3b8;
  font-weight: 700;
  user-select: none;
}
.cat-branch-text {
  font-weight: 500;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 155px;
}
.btn-edit-cat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-edit-cat:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* Cột Giá & Ưu đãi */
.table-price-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.table-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--price-color);
}
.table-price-old {
  font-size: 11px;
  color: var(--text-subtle);
  text-decoration: line-through;
}
.table-discount-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--grad-primary);
  color: #fff;
  align-self: flex-start;
}

/* Cột Hoa hồng */
.badge-comm {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  white-space: nowrap;
}
.badge-comm.low {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.badge-comm-none {
  font-size: 12px;
  color: #94a3b8;
}

/* Cột Hạn giá (Freshness) */
.badge-freshness {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.badge-freshness.fresh {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.badge-freshness.stale-7 {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-freshness.stale-14 {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Cột Thao tác (Action Buttons) */
.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.btn-table-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-table-action:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
  color: var(--text-main);
}
.btn-table-action.act-visible {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.btn-table-action.act-visible:hover {
  background: #d1fae5;
}
.btn-table-action.act-hidden {
  color: #94a3b8;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.btn-table-action.act-hidden:hover {
  background: #e2e8f0;
  color: #475569;
}
.btn-table-action.act-link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}
.btn-table-action.act-del:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Phân Trang Admin */
.admin-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px 0;
  flex-wrap: wrap;
  gap: 16px;
}
.admin-page-info {
  font-size: 13px;
  color: var(--text-muted);
}
.admin-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.admin-page-size select {
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.admin-pager {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pager-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}
.pager-btn:hover:not(:disabled) {
  border-color: var(--shopee-orange);
  color: var(--shopee-orange);
}
.pager-btn.active {
  background: var(--grad-primary);
  color: #ffffff;
  border-color: transparent;
}
.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pager-dots {
  padding: 0 4px;
  color: var(--text-subtle);
}

/* Modals Quản Trị */
.cat-edit-modal,
.title-edit-modal,
.token-modal,
.bulk-del-modal {
  width: min(540px, 100% - 32px);
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
}
.cat-edit-wrap {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cat-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-edit-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}
.cat-edit-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-edit-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cat-edit-inputs label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.cat-edit-inputs input {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
}
.cat-edit-inputs input:focus {
  background: #ffffff;
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}
.admin-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  resize: vertical;
  transition: all 0.2s;
}
.admin-textarea:focus {
  background: #ffffff;
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}
.bulk-del-warning-box {
  padding: 14px 16px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 13.5px;
  line-height: 1.5;
}
.btn-confirm-delete {
  background: #dc2626;
  color: #ffffff;
  border: 0;
  font-weight: 700;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.2s;
}
.btn-confirm-delete:hover {
  background: #b91c1c;
}
.cat-edit-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
  .layout-2col { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .hero-pc { grid-template-columns: 1fr; gap: 20px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .container { width: min(100% - 24px, 100%); }
  .header-inner { gap: 12px; }
  .brand-tag { display: none; }
  .brand-name { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px; gap: 6px; }
  .card-price { font-size: 16px; }
  .card-actions { grid-template-columns: 1fr; }
  .m-wrap { grid-template-columns: 1fr; }
  .m-gallery { border-right: 0; border-bottom: 1px solid var(--border); padding: 16px; }
  .m-info { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
