/* =============================================================
 *  STONK MARKET OBSERVATORY — DESIGN SYSTEM "PREMIUM PASTEL SAAS"
 *  Lavender #6E4AE8 · Pastel Pink #D84C8E · Stonk Theme Matching
 * ============================================================= */

:root,
.mi-wrap,
.mi-modal-overlay,
.mi-modal-box {
  --mi-bg:           var(--bg, #F8F7FC);
  --mi-surface:      var(--surface, #FFFFFF);
  --mi-surface2:     var(--surface-2, #FCFBFF);
  --mi-surface3:     var(--p50, #F7F4FF);
  --mi-border:       var(--line, #EAE6F3);
  --mi-border-light: #F4F1FA;
  --mi-border-strong:var(--line-strong, #D8D2E5);

  --mi-text:         var(--text, #251C46);
  --mi-text2:        #4A3F6B;
  --mi-muted:        var(--muted, #6B7280);
  --mi-placeholder:  var(--text-light, #9CA3AF);

  /* Modern AI Neon & Pastel Palette */
  --mi-primary:      #7C3AED;       /* Electric Violet / Stonk Purple */
  --mi-primary-h:    #6D28D9;
  --mi-primary-bg:   #F5F3FF;       /* Pastel Lilac */
  --mi-primary-neon: #A855F7;       /* Neon Violet */

  --mi-emerald:      #059669;       /* Vivid Emerald */
  --mi-emerald-bg:   #ECFDF5;       /* Pastel Mint */
  --mi-emerald-neon: #10B981;

  --mi-cyan:         #0891B2;       /* Electric Cyan */
  --mi-cyan-bg:      #ECFEFF;       /* Pastel Ice */
  --mi-cyan-neon:    #06B6D4;

  --mi-rose:         #E11D48;       /* Vivid Rose / Pink */
  --mi-rose-bg:      #FFF1F2;       /* Pastel Pink */
  --mi-rose-neon:    #F43F5E;

  --mi-orange:       #EA580C;       /* Vivid Orange */
  --mi-orange-bg:    #FFF7ED;       /* Pastel Peach */
  --mi-orange-neon:  #FB923C;

  --mi-purple:       #9333EA;       /* Deep Purple */
  --mi-purple-bg:    #FAF5FF;       /* Pastel Lavender */
  --mi-purple-neon:  #C084FC;

  --mi-gold:         #D97706;       /* Warm Amber Gold */
  --mi-gold-bg:      #FFFBEB;       /* Pastel Gold */
  --mi-gold-neon:    #F59E0B;

  --mi-radius-lg:    var(--radius-modal, 16px);
  --mi-radius:       var(--radius-card, 12px);
  --mi-radius-sm:    var(--radius-card-sm, 10px);
  --mi-radius-xs:    var(--radius-input, 8px);

  --mi-shadow-sm:    0 2px 8px rgba(124, 58, 237, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --mi-shadow:       0 4px 20px -2px rgba(124, 58, 237, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --mi-shadow-lg:    0 20px 48px -6px rgba(124, 58, 237, 0.16), 0 8px 16px -4px rgba(0, 0, 0, 0.06);

  font-family: "TikTok Sans Variable", "TikTok Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--mi-text);
  -webkit-font-smoothing: antialiased;
}

.mi-wrap {
  position: relative;
  background: var(--mi-surface);
  border-radius: var(--mi-radius-lg);
  border: 1px solid var(--mi-border);
  box-shadow: var(--mi-shadow-sm);
  min-height: 560px;
  display: flex;
  flex-direction: column;
}
.mi-wrap *, .mi-wrap *::before, .mi-wrap *::after { box-sizing: border-box; }
.mi-wrap button { font-family: inherit; cursor: pointer; }
.mi-wrap select, .mi-wrap input { font-family: inherit; }
.mi-wrap svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ── Top Header Unified ─────────────────────────────────────── */
.mi-header-unified {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--mi-border);
  background: var(--mi-surface);
  min-height: 52px;
}
.mi-header-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mi-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--p600, #6E4AE8), var(--p500, #8263F2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(110, 74, 232, 0.28);
  flex-shrink: 0;
}
.mi-header-icon svg { width: 16px; height: 16px; stroke-width: 2.2; }
.mi-header-top-row { display: flex; align-items: center; gap: 8px; }
.mi-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--mi-text);
  margin: 0;
  letter-spacing: -0.1px;
  white-space: nowrap;
}
.mi-badge-cosmic-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--mi-emerald-bg);
  border: 1px solid rgba(47, 175, 120, 0.3);
  color: var(--mi-emerald);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}
.mi-pulsar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mi-emerald);
}
.mi-subtitle { display: none; }
.mi-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Inline Primary Tabs ───────────────────────────────────── */
.mi-tabs-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--mi-surface2, #f8fafc);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--mi-border);
}
.mi-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mi-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.mi-tab-btn:hover { color: var(--mi-primary); background: rgba(124, 58, 237, 0.08); }
.mi-tab-btn.active {
  color: var(--mi-primary, #7c3aed);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.mi-tab-btn svg { width: 14px; height: 14px; }

/* ── Market Intelligence 2-COLUMN LAYOUT (Sidebar + Table) ─────────────── */
.mi-market-layout {
  display: flex;
  flex: 1;
  min-height: 480px;
  background: var(--mi-surface);
}

/* ── Market Intelligence LEFT FILTER SIDEBAR ───────────────────────────── */
.mi-market-sidebar {
  width: 240px;
  min-width: 240px;
  border-right: 1px solid var(--mi-border);
  background: #ffffff;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.mi-market-sidebar.mi-sidebar-hidden {
  display: none !important;
}
@media (max-width: 900px) {
  .mi-market-sidebar { display: none; }
}
.mi-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 10px 8px;
  margin: -6px -8px 0 -8px;
  border-radius: var(--mi-radius-sm, 8px) var(--mi-radius-sm, 8px) 0 0;
  border-bottom: 1px solid var(--mi-border-light);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.mi-sidebar-head:hover {
  background: rgba(124, 58, 237, 0.05);
}
.mi-sidebar-head:hover .mi-sidebar-title {
  color: var(--mi-primary, #7c3aed);
}
.mi-sidebar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: .02em;
  transition: color 0.15s ease;
}
.mi-sidebar-reset-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--mi-primary);
  cursor: pointer;
  padding: 2px 4px;
}
.mi-sidebar-reset-btn:hover { text-decoration: underline; }
.mi-sidebar-collapse-btn {
  background: var(--mi-surface2);
  border: 1px solid var(--mi-border);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mi-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.mi-sidebar-collapse-btn:hover {
  background: #e2e8f0;
  color: var(--mi-text);
}
.mi-top-bar-left-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.mi-filter-toggle-btn,
.mi-filter-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--mi-radius-sm, 8px);
  background: var(--mi-surface, #ffffff);
  border: 1px solid var(--mi-border, #eae6f3);
  font-size: 12px;
  font-weight: 800;
  color: var(--mi-text2, #4a3f6b);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.mi-filter-toggle-btn:hover,
.mi-filter-expand-btn:hover {
  background: var(--mi-primary-bg, #f5f3ff);
  color: var(--mi-primary, #7c3aed);
  border-color: var(--mi-primary, #7c3aed);
  transform: translateY(-1px);
}
.mi-filter-toggle-btn.active {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  border-color: #7c3aed;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
}
.mi-filter-toggle-btn.active svg {
  stroke: #ffffff;
}

.mi-filter-block { display: flex; flex-direction: column; gap: 6px; }
.mi-filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--mi-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.mi-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--mi-radius-sm);
  background: var(--mi-primary-bg);
  border: 1px solid #bfdbfe;
  color: var(--mi-primary);
  font-size: 12px;
  font-weight: 700;
}
.mi-market-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--mi-radius-sm);
  border: 1px solid var(--mi-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--mi-text);
  background: #ffffff;
  outline: none;
  cursor: pointer;
}
.mi-market-select:focus { border-color: var(--mi-primary); }

.mi-side-pills {
  display: flex;
  background: var(--mi-surface2);
  padding: 2px;
  border-radius: var(--mi-radius-sm);
  border: 1px solid var(--mi-border);
}
.mi-side-pill {
  flex: 1;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--mi-muted);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.mi-side-pill.active {
  background: #ffffff;
  color: var(--mi-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.mi-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mi-text2);
  cursor: pointer;
}
.mi-check-label input { width: 14px; height: 14px; accent-color: var(--mi-primary); cursor: pointer; }

/* ── Market Intelligence FULL & RIGHT CONTENT ───────────────────── */
.mi-market-main,
.mi-market-main-full {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* ── Top Bar (Search + Sort + Active Filter) ─────────────────── */
.mi-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--mi-border);
  background: #ffffff;
  min-height: 48px;
}
.mi-top-bar-left-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.mi-top-select-sm {
  height: 32px;
  padding: 0 20px 0 10px;
  border: 1px solid var(--mi-border, #eae6f3);
  border-radius: var(--mi-radius-sm, 8px);
  font-size: 12px;
  font-weight: 700;
  color: var(--mi-text2, #4a3f6b);
  background: #ffffff;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  flex-shrink: 0;
  max-width: 170px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}
.mi-top-select-sm:focus,
.mi-top-select-sm:hover {
  border-color: var(--mi-primary, #7c3aed);
  background-color: var(--mi-primary-bg, #f5f3ff);
}
.mi-top-cat-select {
  max-width: 200px;
}

.mi-top-bar-search {
  flex: 1;
  min-width: 140px;
  max-width: 460px;
  position: relative;
  display: flex;
  align-items: center;
}
.mi-top-bar-search .mi-search-icon {
  position: absolute;
  left: 9px;
  color: var(--mi-placeholder);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.mi-top-bar-search .mi-search-icon svg { width: 13px; height: 13px; }
.mi-top-search-input {
  width: 100%;
  height: 32px;
  padding: 0 28px 0 28px;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius-sm, 8px);
  font-size: 12px;
  color: var(--mi-text);
  background: #ffffff;
  outline: none;
}
.mi-top-search-input:focus {
  border-color: var(--mi-primary);
  box-shadow: 0 0 0 2px var(--mi-primary-bg);
}
.mi-search-clear {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--mi-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
}
.mi-search-clear:hover { color: var(--mi-text); }

.mi-top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mi-chip-active-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--mi-radius-sm, 8px);
  background: var(--mi-primary-bg, #f5f3ff);
  color: var(--mi-primary, #7c3aed);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid #ddd6fe;
  height: 32px;
  white-space: nowrap;
}
.mi-sort-box {
  position: relative;
  display: flex;
  align-items: center;
}
.mi-sort-icon {
  position: absolute;
  left: 8px;
  color: var(--mi-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.mi-sort-icon svg { width: 13px; height: 13px; }
.mi-sort-select {
  height: 32px;
  padding: 0 22px 0 26px;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius-sm, 8px);
  font-size: 12px;
  font-weight: 700;
  color: var(--mi-text);
  background: #ffffff;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.mi-sort-select:focus { border-color: var(--mi-primary); }

/* ── 2-Row Horizontal Filter Panel ─────────────────────────────── */
.mi-horizontal-filter-bar {
  background: #faf9fd;
  border-bottom: 1px solid var(--mi-border);
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: miSlideDown 0.18s ease-out;
}
@keyframes miSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mi-filter-grid-row-1 {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mi-filter-col {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mi-filter-col-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--mi-muted, #64748b);
  white-space: nowrap;
}
.mi-filter-col-label svg { width: 12px; height: 12px; }
.mi-market-select-sm {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--mi-border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mi-text);
  background: #ffffff;
  outline: none;
  cursor: pointer;
}
.mi-market-select-sm:focus { border-color: var(--mi-primary); }

.mi-filter-grid-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed rgba(226, 232, 240, 0.9);
}
.mi-filter-checks-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.mi-filter-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mi-filter-bar-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--mi-primary, #7c3aed);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
}
.mi-filter-bar-reset-btn:hover { background: rgba(124, 58, 237, 0.08); text-decoration: underline; }
.mi-filter-bar-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--mi-border);
  font-size: 11px;
  font-weight: 700;
  color: var(--mi-muted);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.mi-filter-bar-close-btn:hover {
  background: #f1f5f9;
  color: var(--mi-text);
}

/* ── STICKY HORIZONTAL SCROLL TABLE (Market Intelligence STANDARD) ─────── */
.mi-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  width: 100%;
  background: #ffffff;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
  -webkit-overflow-scrolling: touch;
}
.mi-table-wrap::-webkit-scrollbar {
  height: 9px;
}
.mi-table-wrap::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.mi-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  border: 2px solid #f1f5f9;
}
.mi-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.mi-wrap .mi-table {
  width: 100%;
  table-layout: auto !important;
  border-collapse: separate !important;
  border-spacing: 0;
  font-size: 13px;
  min-width: 1100px;
}
.mi-wrap .mi-table thead tr {
  background: var(--surface-2, #FCFBFF);
}
.mi-wrap .mi-table th {
  padding: 12px 14px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  color: var(--mi-muted) !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  border: none !important;
  border-bottom: 1px solid var(--mi-border) !important;
  background: var(--surface-2, #FCFBFF) !important;
  text-align: left;
}

/* Sau khi bỏ STT, cột đầu là nội dung chính: không ghim/ép còn 54px. */
.mi-wrap .mi-table th:first-child,
.mi-wrap .mi-table td:first-child {
  position: static !important;
  left: auto !important;
  z-index: auto !important;
  width: auto !important;
  min-width: 260px !important;
  max-width: none !important;
  text-align: left !important;
  background: var(--mi-surface) !important;
  border-right: none !important;
  padding: 12px 14px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
}
.mi-wrap .mi-table thead th:first-child {
  background: var(--surface-2, #FCFBFF) !important;
  z-index: auto !important;
  white-space: nowrap !important;
}

.mi-wrap .mi-category-table { min-width: 1280px !important; }
.mi-wrap .mi-product-table { min-width: 1320px !important; }
.mi-wrap .mi-shop-table { min-width: 1250px !important; }
.mi-wrap .mi-video-table { min-width: 1380px !important; }
.mi-wrap .mi-category-table th:first-child,
.mi-wrap .mi-category-table td:first-child { min-width: 290px !important; width: 290px !important; }
.mi-wrap .mi-product-table th:first-child,
.mi-wrap .mi-product-table td:first-child { min-width: 330px !important; width: 330px !important; }
.mi-wrap .mi-shop-table th:first-child,
.mi-wrap .mi-shop-table td:first-child { min-width: 310px !important; width: 310px !important; }
.mi-wrap .mi-video-table th:first-child,
.mi-wrap .mi-video-table td:first-child { min-width: 350px !important; width: 350px !important; }

#stonkAutoTip,
#stonkGlobalTip {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.mi-wrap .mi-table td {
  padding: 12px 14px !important;
  border: none !important;
  border-bottom: 1px solid var(--mi-border-light) !important;
  vertical-align: middle !important;
  color: var(--mi-text) !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
.mi-wrap .mi-table tbody tr.mi-row-link {
  cursor: pointer;
  transition: background 0.12s ease;
}
.mi-wrap .mi-table tbody tr.mi-row-link:hover td {
  background: var(--p50, #F7F4FF) !important;
}

.mi-th-r, .mi-td-r { text-align: right !important; }
.mi-th-c, .mi-td-c { text-align: center !important; }
.mi-th-l, .mi-td-l { text-align: left !important; }

/* ── Rank Numbers (1, 2, 3...) ──────────────────────────────── */
.mi-wrap .mi-rank {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 50% !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  color: var(--mi-muted) !important;
  background: var(--surface-2, #FCFBFF) !important;
  border: 1px solid var(--mi-border) !important;
  line-height: 1 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}
.mi-wrap .mi-rank-1 {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A) !important;
  color: #92400E !important;
  border: 1px solid #FCD34D !important;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25) !important;
}
.mi-wrap .mi-rank-2 {
  background: linear-gradient(135deg, #F1F5F9, #E2E8F0) !important;
  color: #334155 !important;
  border: 1px solid #CBD5E1 !important;
}
.mi-wrap .mi-rank-3 {
  background: linear-gradient(135deg, #FFEDD5, #FED7AA) !important;
  color: #9A3412 !important;
  border: 1px solid #FDBA74 !important;
}

/* ── Product Table Specialized Elements (Market Intelligence Full Columns) ── */
.mi-prod-price-range {
  font-size: 11.5px;
  font-weight: 700;
  color: #DC2626;
  margin-top: 2px;
  display: block;
}
.mi-growth-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
}
.mi-growth-pos {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}
.mi-growth-neg {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}
.mi-growth-neutral {
  background: #F3F4F6;
  color: #4B5563;
  border: 1px solid #E5E7EB;
}

.mi-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  color: #D97706;
  background: #FFFBEB;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid #FDE68A;
}
.mi-rating-badge svg {
  width: 12px;
  height: 12px;
  fill: #F59E0B;
  stroke: #F59E0B;
}

.mi-video-strip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mi-video-thumb-box {
  position: relative;
  width: 38px;
  height: 48px;
  border-radius: 5px;
  overflow: hidden;
  background: #090414;
  border: 1px solid var(--mi-border);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mi-video-thumb-box:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  z-index: 5;
}
.mi-video-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mi-video-thumb-box .mi-video-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  color: #FFFFFF;
}
.mi-video-thumb-box .mi-video-play-icon svg {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}


/* ── PRODUCT CELL (WIDE & Market Intelligence FORMAT) ───────────────────── */
.mi-prod-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: normal; /* Allow product title to wrap cleanly */
  max-width: 440px;
  min-width: 280px;
}
.mi-prod-cell-img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--mi-border);
  flex-shrink: 0;
}
.mi-prod-cell-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mi-prod-cell-placeholder svg { width: 24px; height: 24px; }
.mi-product-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 122px;
}
.mi-product-strip-item {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  cursor: pointer;
}
.mi-product-strip-img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--mi-border);
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.mi-product-strip-item:hover .mi-product-strip-img {
  transform: scale(1.08);
  border-color: var(--primary, #7C3AED);
}

/* ── Market Intelligence PRODUCT HOVER PREVIEW CARD ───────────────────── */
/* ── Market Intelligence PRODUCT HOVER PREVIEW CARD ───────────────────── */
.mi-prod-hover-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: #FFFFFF;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 16px 36px -4px rgba(24, 15, 54, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.1);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.mi-prod-hover-popover::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #FFFFFF transparent;
}
.mi-product-strip-item:hover .mi-prod-hover-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(2px);
}
.mi-popover-thumb {
  width: 100%;
  height: 140px;
  border-radius: 6px;
  overflow: hidden;
  background: #F4F3F8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mi-popover-thumb img,
.mi-popover-thumb .mi-prod-cell-img,
.mi-popover-thumb .mi-popover-cover-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  display: block !important;
}
.mi-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: #1E1B2E;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  text-align: left;
}
.mi-popover-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px dashed #EDE8F5;
}
.mi-popover-price {
  font-size: 12.5px;
  font-weight: 800;
  color: #DC2626;
}
.mi-popover-link {
  font-size: 11.5px;
  font-weight: 700;
  color: #2563EB;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.mi-popover-link:hover {
  text-decoration: underline;
  color: #1D4ED8;
}

.mi-prod-cell-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}
.mi-prod-name {
  font-weight: 600;
  font-size: 13px;
  color: #0F172A;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.mi-prod-price-range {
  font-size: 12px;
  font-weight: 700;
  color: #E11D48;
  margin-top: 2px;
  display: block;
}
.mi-tag-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #4F46E5;
  background: #EEF2FF;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #E0E7FF;
  width: fit-content;
  margin-top: 2px;
}

/* ── SHOP CELL (AVATAR + NAME + INLINE MALL/THƯƠNG HIỆU TAG) ── */
.mi-shop-row-box {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: normal;
  max-width: 380px;
  min-width: 260px;
}
.mi-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--mi-border);
  flex-shrink: 0;
  background: #ffffff;
}
.mi-stonk-fallback-logo {
  object-fit: contain !important;
  background: #f8fafc !important;
  padding: 4px !important;
  box-sizing: border-box !important;
  border: 1px solid #e2e8f0 !important;
}
.mi-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.mi-shop-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mi-shop-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mi-shop-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--mi-text);
}
.mi-shop-sub-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mi-creator-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mi-creator-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 42px; }
.mi-creator-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.mi-creator-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mi-text); font-weight: 800; }
.mi-creator-handle { display: inline-flex; align-items: center; gap: 4px; color: var(--mi-primary); font-size: 11px; text-decoration: none; }
.mi-creator-handle:hover { text-decoration: underline; }
.mi-creator-handle svg { width: 10px; height: 10px; }
.mi-creator-meta .mi-tag-cat { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-sub-tag-brand {
  font-size: 10px;
  font-weight: 800;
  color: var(--mi-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.mi-sub-tag-normal {
  font-size: 10px;
  font-weight: 700;
  color: var(--mi-muted);
  text-transform: uppercase;
}
.mi-badge-sub-brand {
  font-size: 9.5px;
  font-weight: 800;
  color: #7c3aed;
  background: var(--mi-purple-bg);
  border: 1px solid rgba(124, 58, 237, 0.25);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.mi-tag-share { font-size: 11px; color: var(--mi-muted); }

/* ── CATEGORY CELL ──────────────────────────────────────────── */
.mi-cat-name-box {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 4px 9px;
  white-space: normal;
  max-width: 340px;
  min-width: 180px;
}
.mi-category-icon {
  display: inline-grid;
  place-items: center;
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 10%, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.mi-category-icon svg { width: 18px; height: 18px; }
.mi-category-icon--beauty { color: #db2777; }
.mi-category-icon--fashion { color: #7c3aed; }
.mi-category-icon--food { color: #ea580c; }
.mi-category-icon--home { color: #0891b2; }
.mi-category-icon--electronics { color: #2563eb; }
.mi-category-icon--health { color: #059669; }
.mi-category-icon--baby { color: #d946ef; }
.mi-category-icon--sports { color: #16a34a; }
.mi-category-icon--pet { color: #ca8a04; }
.mi-category-icon--vehicle { color: #475569; }
.mi-category-icon--books { color: #4f46e5; }
.mi-category-icon--jewelry { color: #c026d3; }
.mi-category-icon--general { color: #7c3aed; }
.mi-cat-name-text {
  font-weight: 700;
  font-size: 13px;
  color: var(--mi-text);
  line-height: 1.35;
}
.mi-inline-tags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── Chips & Metrics ────────────────────────────────────────── */
.mi-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}
.mi-chip svg { width: 10px; height: 10px; }
.mi-chip-live   { background: var(--mi-rose-bg); color: var(--mi-rose); border: 1px solid rgba(220, 38, 38, 0.2); }
.mi-chip-video  { background: var(--mi-purple-bg); color: var(--mi-purple); border: 1px solid rgba(124, 58, 237, 0.2); }
.mi-chip-comm   { background: var(--mi-gold-bg); color: var(--mi-gold); border: 1px solid rgba(217, 119, 6, 0.25); font-weight: 800; }
.mi-chip-cat    { background: var(--mi-primary-bg); color: var(--mi-primary); border: 1px solid #bfdbfe; font-size: 11px; padding: 2px 8px; }
.mi-chip-id     { background: var(--mi-surface2); color: var(--mi-muted); border: 1px solid var(--mi-border); font-size: 11px; padding: 2px 8px; font-family: monospace; }

.mi-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.mi-badge svg { width: 11px; height: 11px; }
.mi-badge-up   { background: var(--mi-emerald-bg); color: var(--mi-emerald); border: 1px solid rgba(5, 150, 105, 0.25); }
.mi-badge-dn   { background: var(--mi-rose-bg); color: var(--mi-rose); border: 1px solid rgba(220, 38, 38, 0.25); }
.mi-badge-flat { background: var(--mi-surface2); color: var(--mi-muted); }

.mi-fw          { font-weight: 800; }
.mi-clr-emerald { color: var(--mi-emerald); }
.mi-clr-cyan    { color: var(--mi-cyan); }
.mi-clr-rose    { color: var(--mi-rose); }
.mi-clr-purple  { color: var(--mi-purple); }
.mi-clr-teal    { color: #0d9488; }
.mi-clr-gold    { color: var(--mi-gold); }
.mi-clr-muted   { color: var(--mi-muted); }
.mi-tag-count   { font-weight: 800; color: var(--mi-text); }

/* ── Hero Card & Details ────────────────────────────────────── */
.mi-det-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 20px;
  flex-wrap: wrap;
}
.mi-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mi-muted); }
.mi-bc-link { color: var(--mi-primary); cursor: pointer; font-weight: 700; }
.mi-bc-link:hover { text-decoration: underline; }
.mi-bc-sep svg { width: 12px; height: 12px; }
.mi-bc-cur { color: var(--mi-text); font-weight: 800; }

.mi-hero-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 50%, #faf5ff 100%);
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 20px 16px;
  position: relative;
  overflow: hidden;
}
.mi-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #059669, #7c3aed);
}
.mi-hero-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.mi-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.mi-hero-icon svg { width: 24px; height: 24px; stroke-width: 2.2; }
.mi-hero-label { font-size: 11px; font-weight: 800; color: var(--mi-muted); letter-spacing: .04em; }
.mi-hero-name { font-size: 20px; font-weight: 800; color: var(--mi-text); margin: 2px 0 6px; }
.mi-hero-rev-row { display: flex; align-items: center; gap: 10px; }
.mi-hero-rev { font-size: 24px; font-weight: 900; letter-spacing: -0.5px; }
.mi-hero-spark-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.mi-hero-spark-title { font-size: 10.5px; font-weight: 800; color: var(--mi-muted); letter-spacing: .04em; }

/* ── Segmented Control Pill Bar for Time Filter ────────────── */
.mi-quick-date-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--mi-surface2, #f8f7fc);
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--mi-border, #eae6f3);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mi-quick-date-bar::-webkit-scrollbar { display: none; }
.mi-quick-date-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--mi-text, #251c46);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  white-space: nowrap;
}
.mi-date-pill {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mi-muted, #64748b);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.mi-date-pill:hover {
  background: #ede9fe;
  color: var(--mi-primary, #7c3aed);
}
.mi-date-pill.active {
  background: var(--mi-primary, #7c3aed);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

/* ── Clean 3-Tier KPI Cards (No Text Smashing) ──────────────── */
.mi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.mi-kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
@media (min-width: 900px) {
  .mi-kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.mi-kpi-card {
  background: #ffffff;
  border: 1px solid var(--mi-border, #eae6f3);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.mi-kpi-card:hover {
  border-color: rgba(124, 58, 237, 0.25);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.06);
}

.mi-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--mi-primary-bg, #f5f3ff);
  color: var(--mi-primary, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mi-kpi-icon svg { width: 18px; height: 18px; }

.mi-kpi-icon.mi-clr-emerald, .mi-kpi-card.mi-clr-emerald .mi-kpi-icon { background: var(--mi-emerald-bg, #ecfdf5); color: var(--mi-emerald, #059669); }
.mi-kpi-icon.mi-clr-cyan,    .mi-kpi-card.mi-clr-cyan .mi-kpi-icon    { background: var(--mi-cyan-bg, #ecfeff); color: var(--mi-cyan, #0891b2); }
.mi-kpi-icon.mi-clr-rose,    .mi-kpi-card.mi-clr-rose .mi-kpi-icon    { background: var(--mi-rose-bg, #fff1f2); color: var(--mi-rose, #e11d48); }
.mi-kpi-icon.mi-clr-purple,  .mi-kpi-card.mi-clr-purple .mi-kpi-icon  { background: var(--mi-purple-bg, #faf5ff); color: var(--mi-purple, #9333ea); }
.mi-kpi-icon.mi-clr-teal,    .mi-kpi-card.mi-clr-teal .mi-kpi-icon    { background: #f0fdfa; color: #0d9488; }
.mi-kpi-icon.mi-clr-gold,    .mi-kpi-card.mi-clr-gold .mi-kpi-icon    { background: var(--mi-gold-bg, #fffbeb); color: var(--mi-gold, #d97706); }
.mi-kpi-icon.mi-clr-orange,  .mi-kpi-card.mi-clr-orange .mi-kpi-icon  { background: var(--mi-orange-bg, #fff7ed); color: var(--mi-orange, #ea580c); }

.mi-kpi-meta,
.mi-kpi-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mi-kpi-label {
  font-size: 11px;
  color: var(--mi-muted, #64748b);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.3;
  margin: 0;
}
.mi-kpi-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--mi-text, #1e293b);
  line-height: 1.25;
  margin: 2px 0 1px;
  letter-spacing: -0.2px;
}
.mi-kpi-sub {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.3;
  margin: 0;
}

.mi-metric-explorer {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius);
  background: #fff;
  box-shadow: var(--mi-shadow-sm);
}
.mi-metric-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.mi-metric-head > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.mi-metric-head strong { color: var(--mi-text); font-size: 13px; }
.mi-metric-head span { color: var(--mi-muted); font-size: 10.5px; }
.mi-metric-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.mi-metric-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mi-metric-legend i { width: 14px; height: 3px; border-radius: 2px; }
.mi-metric-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.mi-metric-options { display: flex; flex-direction: column; gap: 5px; }
.mi-metric-option {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 31px; padding: 6px 9px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--mi-text2);
  font-size: 11px; font-weight: 700; text-align: left;
}
.mi-metric-option:hover { background: var(--mi-surface2); }
.mi-metric-option.active { background: #eff8ff; border-color: #a8d8ff; color: #0369a1; }
.mi-metric-option > span { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.mi-chart-stage { position: relative; min-width: 0; min-height: 250px; }
.mi-trend-chart { display: block; width: 100%; height: 250px; overflow: visible; }
.mi-chart-grid { stroke: #dbe4ee; stroke-width: 1; stroke-dasharray: 4 5; }
.mi-chart-axis-label { fill: #8491a3; font: 9px Arial, sans-serif; }
.mi-chart-hit { cursor: crosshair; pointer-events: all; }
.mi-chart-hover-line { stroke: #0191f8; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.mi-chart-hover-line.visible { opacity: .8; }
.mi-chart-tooltip {
  position: absolute; z-index: 3; top: 8px; transform: translateX(-50%); display: none; min-width: 170px;
  padding: 9px 11px; border-radius: 8px; background: rgba(15, 23, 42, .94); color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .2); pointer-events: none;
}
.mi-chart-tooltip.visible { display: flex; flex-direction: column; gap: 5px; }
.mi-chart-tooltip strong { font-size: 11px; }
.mi-chart-tooltip span { display: flex; align-items: center; gap: 5px; font-size: 10.5px; white-space: nowrap; }
.mi-chart-tooltip i { width: 7px; height: 7px; border-radius: 50%; }
.mi-chart-tooltip b { margin-left: auto; padding-left: 12px; }
.mi-chart-empty { min-height: 160px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--mi-muted); font-size: 12px; }

.mi-sub-tabs-bar { border-bottom: 2px solid var(--mi-border); margin: 0 20px 14px; }
.mi-sub-tabs { display: flex; gap: 8px; }
.mi-sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mi-muted);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
}
.mi-sub-tab.active {
  color: var(--mi-primary);
  border-bottom-color: var(--mi-primary);
}
.mi-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--mi-primary-bg);
  color: var(--mi-primary);
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 800;
  margin-left: 4px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.mi-pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--mi-border-light);
  background: #ffffff;
  flex-wrap: wrap;
}
.mi-page-meta-bar { text-align: center; font-size: 12px; color: var(--mi-muted); padding: 12px 0; }
.mi-page-meta { font-size: 12px; color: var(--mi-muted); font-family: monospace; }
.mi-pagination { display: flex; align-items: center; gap: 4px; }
.mi-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--mi-radius-sm);
  border: 1px solid var(--mi-border);
  background: #ffffff;
  color: var(--mi-text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}
.mi-page-btn:hover:not(:disabled):not(.active) { background: var(--mi-surface2); color: var(--mi-primary); }
.mi-page-btn.active {
  background: var(--mi-primary);
  color: #ffffff;
  border-color: var(--mi-primary);
}
.mi-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.mi-page-dot { padding: 0 4px; color: var(--mi-muted); align-self: center; }

/* ── Buttons ─────────────────────────────────────────────────── */
.mi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--mi-radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.mi-btn-sm { padding: 6px 12px; font-size: 11.5px; }
.mi-btn-primary { background: var(--mi-primary); color: #ffffff; }
.mi-btn-primary:hover { background: var(--mi-primary-h); }
.mi-btn-ghost { background: #ffffff; color: var(--mi-text); border-color: var(--mi-border); }
.mi-btn-ghost:hover { background: var(--mi-surface2); }

/* ── State Views ────────────────────────────────────────────── */
.mi-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 20px;
  color: var(--mi-primary);
  font-size: 13px;
  font-weight: 700;
}
.mi-radar-orbit {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mi-radar-core { width: 10px; height: 10px; border-radius: 50%; background: var(--mi-primary); }
.mi-radar-ring {
  position: absolute;
  inset: 0;
  border: 2px dashed var(--mi-emerald);
  border-radius: 50%;
  animation: mi-radar-spin 3s linear infinite;
}
@keyframes mi-radar-spin { to { transform: rotate(360deg); } }
.mi-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 56px 20px;
  color: var(--mi-muted);
  font-size: 13px;
}
.mi-err {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: var(--mi-rose);
  background: var(--mi-rose-bg);
  border-radius: var(--mi-radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ── SOLID WHITE MODALS ─────────────────────────────────────── */
.mi-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(6px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100000 !important;
  padding: 16px !important;
}
.mi-modal-overlay.mi-modal-stacked {
  z-index: 100005 !important;
  background: rgba(15, 23, 42, 0.78) !important;
}
.mi-modal-box {
  background: #ffffff !important;
  border-radius: var(--mi-radius-lg) !important;
  width: 100% !important;
  max-width: var(--mi-modal-max-width, 620px) !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: var(--mi-shadow-lg) !important;
  overflow: hidden !important;
  border: 1px solid var(--mi-border) !important;
  color: var(--mi-text) !important;
}
.mi-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--mi-border);
  background: var(--mi-surface2);
}
.mi-modal-title-row { display: flex; align-items: center; gap: 8px; }
.mi-modal-title { font-size: 16px; font-weight: 800; margin: 0; color: var(--mi-text); }
.mi-modal-close-btn {
  background: #ffffff;
  border: 1px solid var(--mi-border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mi-muted);
}
.mi-modal-body { flex: 1; overflow-y: auto; padding: 20px; background: #ffffff; }

/* ── Modal Contents ─────────────────────────────────────────── */
.mi-modal-prod-hdr {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--mi-border-light);
}
.mi-modal-prod-thumb {
  width: 88px;
  height: 88px;
  border-radius: var(--mi-radius);
  object-fit: cover;
  border: 1px solid var(--mi-border);
  flex-shrink: 0;
}
.mi-thumb-placeholder { display: flex; align-items: center; justify-content: center; }
.mi-thumb-placeholder svg { width: 32px; height: 32px; }
.mi-modal-prod-meta { flex: 1; min-width: 0; }
.mi-modal-tags-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.mi-modal-prod-title { font-size: 15px; font-weight: 800; line-height: 1.4; margin: 0 0 8px; }
.mi-modal-seller-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--mi-surface2);
  border: 1px solid var(--mi-border);
  cursor: pointer;
}
.mi-seller-avatar-sm { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.mi-av-xs { width: 20px; height: 20px; font-size: 9px; }
.mi-seller-name-link { font-size: 11.5px; font-weight: 800; color: var(--mi-text); }
.mi-seller-open-icon { color: var(--mi-primary); display: flex; }

.mi-modal-shop-hdr {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--mi-border-light);
}
.mi-avatar-lg { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--mi-border); flex-shrink: 0; }
.mi-av-lg { width: 60px; height: 60px; font-size: 22px; }
.mi-modal-shop-meta { flex: 1; min-width: 0; }
.mi-modal-shop-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.mi-modal-shop-sub { display: flex; gap: 8px; align-items: center; font-size: 11.5px; }
.mi-tag-growth { padding: 2px 7px; border-radius: 4px; background: var(--mi-emerald-bg); border: 1px solid rgba(5, 150, 105, 0.25); color: var(--mi-emerald); font-weight: 800; }

.mi-modal-section { margin-top: 18px; }
.mi-modal-section-hdr { margin-bottom: 10px; }
.mi-modal-section-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--mi-muted); text-transform: uppercase; }
.mi-modal-chart-box { background: var(--mi-surface2); border: 1px solid var(--mi-border); border-radius: var(--mi-radius); padding: 12px 14px; }

.mi-related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 540px) { .mi-related-grid { grid-template-columns: repeat(3, 1fr); } }
.mi-related-card {
  background: #ffffff;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.mi-related-card:hover { border-color: var(--mi-primary); box-shadow: var(--mi-shadow-sm); }
.mi-rel-img { width: 100%; height: 76px; border-radius: var(--mi-radius-xs); object-fit: cover; border: 1px solid var(--mi-border-light); }
.mi-rel-placeholder { display: flex; align-items: center; justify-content: center; }
.mi-rel-placeholder svg { width: 22px; height: 22px; }
.mi-rel-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.mi-rel-name { font-size: 11.5px; font-weight: 700; color: var(--mi-text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.mi-rel-bottom { display: flex; flex-direction: column; }
.mi-rel-rev { font-size: 12px; font-weight: 900; }
.mi-rel-sale { font-size: 10px; color: var(--mi-muted); font-family: monospace; }

/* ── Settings Form ───────────────────────────────────────────── */
.mi-form { display: flex; flex-direction: column; gap: 14px; }
.mi-form-group { display: flex; flex-direction: column; gap: 5px; }
.mi-form-label { font-size: 12.5px; font-weight: 800; color: var(--mi-text2); }
.mi-form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--mi-border); border-radius: var(--mi-radius-sm); font-size: 13px; outline: none; }
.mi-form-input:focus { border-color: var(--mi-primary); box-shadow: 0 0 0 2px var(--mi-primary-bg); }
.mi-form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.mi-form-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.mi-form-check input { width: 15px; height: 15px; accent-color: var(--mi-primary); cursor: pointer; }
.mi-form-note { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--mi-muted); background: var(--mi-surface2); border: 1px solid var(--mi-border); border-radius: var(--mi-radius-sm); padding: 9px 12px; }
.mi-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }

/* ── Market Intelligence KOC CRAWLER DASHBOARD STYLES ───────────────────── */
.mi-crawler-panel { display: flex; flex-direction: column; gap: 16px; }
.mi-crawler-hero {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mi-crawler-hero-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .mi-crawler-hero-main { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .mi-metric-explorer { margin: 0 10px 14px; padding: 12px; }
  .mi-metric-head { flex-direction: column; }
  .mi-metric-legend { justify-content: flex-start; }
  .mi-metric-layout { grid-template-columns: 1fr; }
  .mi-metric-options { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .mi-metric-option { width: auto; min-width: max-content; }
  .mi-chart-stage, .mi-trend-chart { min-height: 220px; height: 220px; }
}
.mi-crawler-hero-stat { display: flex; flex-direction: column; gap: 4px; }
.mi-crawler-stat-label { font-size: 11px; font-weight: 800; color: var(--mi-muted); text-transform: uppercase; letter-spacing: .02em; }
.mi-crawler-stat-val { font-size: 16px; font-weight: 900; }
.mi-crawler-pct { font-size: 13px; font-weight: 700; color: var(--mi-muted); }

.mi-crawler-progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--mi-border-light);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.mi-crawler-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.mi-crawler-state {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px 16px;
  padding: 9px 12px;
  border: 1px solid var(--mi-border);
  border-radius: 8px;
  background: #fff;
  font-size: 11.5px;
}
.mi-crawler-state strong { font-size: 12px; }
.mi-crawler-state span { color: var(--mi-muted); }
.mi-crawler-state-running { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.mi-crawler-state-warning { border-color: #fdba74; background: #fff7ed; color: #c2410c; }
.mi-crawler-state-writing { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }

.mi-crawler-actions-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mi-btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: var(--mi-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.mi-btn-danger:hover { background: #fecaca; }

.mi-crawler-status-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.mi-crawler-status-pill.running {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.mi-crawler-status-pill.idle {
  background: var(--mi-surface2);
  color: var(--mi-muted);
  border: 1px solid var(--mi-border);
}
.mi-crawler-status-pill.warning { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.mi-crawler-status-pill.writing { background: #f5f3ff; color: #6d28d9; border: 1px solid #c4b5fd; }

.mi-crawler-config { padding: 0; overflow: hidden; }
.mi-crawler-config-summary {
  position: relative;
  margin: 0;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px;
}
.mi-crawler-config-summary::-webkit-details-marker { display: none; }
.mi-crawler-config-summary::after {
  content: "Mở";
  margin-left: auto;
  padding: 4px 28px 4px 10px;
  border-radius: 6px;
  background: var(--mi-surface-2, #f1f5f9);
  border: 1px solid var(--mi-border, #e2e8f0);
  color: var(--mi-primary, #7c3aed);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  background-image: var(--stonk-chevron-down-image);
  background-position: right 9px center;
  background-size: 12px 12px;
  background-repeat: no-repeat;
}
.mi-crawler-config[open] .mi-crawler-config-summary::after {
  content: "Thu gọn";
  background: #f5f3ff;
  background-image: var(--stonk-chevron-up-image);
  background-position: right 9px center;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  border-color: #ddd6fe;
}
.mi-crawler-config-brief { color: var(--mi-muted); font-size: 11px; font-weight: 600; line-height: 1.3; }
.mi-crawler-config .mi-form-grid-3 { padding: 0 14px 14px; }

.mi-form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) {
  .mi-form-grid-3 { grid-template-columns: 1fr; }
}
.mi-form-hint { font-size: 10.5px; color: var(--mi-muted); }

.mi-account-add-box {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mi-account-add-box input { flex: 1; min-width: 160px; }

.mi-account-table { min-width: 920px; }
.mi-account-table th:first-child,
.mi-account-table td:first-child {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  padding-left: 14px;
  padding-right: 14px;
  text-align: left;
}
.mi-account-table th:nth-child(2),
.mi-account-table td:nth-child(2) {
  position: static;
  width: 86px;
  min-width: 86px;
  text-align: center;
  box-shadow: none;
  border-right: 1px solid var(--mi-border-light);
}
.mi-account-name {
  display: block;
  overflow: hidden;
  color: var(--mi-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mi-account-error {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--mi-rose);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mi-login-feedback { min-height: 18px; font-size: 12px; font-weight: 700; }
.mi-login-feedback.error { color: #b91c1c; }
.mi-login-feedback.success { color: #047857; }

.mi-btn-icon-danger {
  background: transparent;
  border: none;
  color: var(--mi-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
}
.mi-btn-icon-danger:hover { background: #fee2e2; color: #dc2626; }

.mi-logs-box {
  max-height: 160px;
  overflow-y: auto;
  background: var(--mi-surface2);
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: monospace;
  font-size: 11px;
}
.mi-log-line { display: flex; gap: 8px; align-items: center; }
.mi-log-time { color: var(--mi-muted); }
.mi-log-page { font-weight: 700; color: var(--mi-primary); }

/* ── ACCOUNT TOGGLE SWITCH & PILL TABS ── */
.mi-pill-tabs {
  display: inline-flex;
  background: var(--mi-surface2);
  border: 1px solid var(--mi-border);
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 10px;
}
.mi-pill-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mi-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.mi-pill-btn.active {
  background: #ffffff;
  color: var(--mi-primary);
  box-shadow: var(--mi-shadow-sm);
}
.mi-bulk-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mi-bulk-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius-sm);
  font-size: 12.5px;
  font-family: monospace;
  outline: none;
  resize: vertical;
  line-height: 1.4;
  background: #ffffff;
}
.mi-bulk-textarea:focus {
  border-color: var(--mi-primary);
  box-shadow: 0 0 0 2px var(--mi-primary-bg);
}

/* Switch UI */
.mi-switch-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.mi-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.mi-switch-slider {
  position: relative;
  width: 34px;
  height: 18px;
  background-color: #cbd5e1;
  border-radius: 99px;
  transition: .2s;
  display: inline-block;
}
.mi-switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.mi-switch-input:checked + .mi-switch-slider {
  background-color: #10b981;
}
.mi-switch-input:checked + .mi-switch-slider:before {
  transform: translateX(16px);
}
.mi-switch-input:disabled + .mi-switch-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Product / Shop / Category results: bảng đầy đủ ở desktop, thẻ KPI dễ đọc ở màn hình nhỏ. */
.mi-result-summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  color: var(--mi-muted);
  font-size: 12px;
  border-bottom: 1px solid var(--mi-border-light);
  background: #ffffff;
}
.mi-result-summary strong { color: var(--mi-text); font-size: 12.5px; }
.mi-product-mobile-results,
.mi-shop-mobile-results,
.mi-cat-mobile-results { display: none; }

.mi-card-list,
.mi-product-card-list {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
}
.mi-data-card,
.mi-product-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--mi-border);
  border-radius: var(--mi-radius, 10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.15s ease;
}
.mi-data-card:hover,
.mi-product-card:hover {
  border-color: var(--mi-primary);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
}
.mi-card-head,
.mi-product-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.mi-card-head > .mi-category-icon {
  grid-row: auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
}
.mi-card-head > .mi-category-icon svg { width: 21px; height: 21px; }
.mi-card-head-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.mi-card-title,
.mi-product-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--mi-text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mi-product-card-head p { margin: 2px 0 0; color: var(--mi-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-card-sub-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mi-card-kpis,
.mi-product-card-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.mi-card-kpis span,
.mi-product-card-kpis span {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  background: var(--mi-surface2, #f8fafc);
  border-radius: 6px;
}
.mi-card-kpis small,
.mi-product-card-kpis small {
  color: var(--mi-muted);
  font-size: 10px;
  font-weight: 600;
}
.mi-card-kpis b,
.mi-product-card-kpis b {
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.mi-card-strip-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fbfaff;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--mi-border-light, #f1f5f9);
}
.mi-card-strip-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--mi-muted);
  text-transform: uppercase;
}
.mi-card-foot,
.mi-product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--mi-primary, #7c3aed);
  font-size: 11px;
  font-weight: 700;
  border-top: 1px solid var(--mi-border-light, #f1f5f9);
  padding-top: 8px;
}
.mi-source-note { margin: 7px 0 0; color: var(--mi-muted); font-size: 10.5px; }
.mi-state-action { display: flex; justify-content: center; padding: 0 0 24px; }

.mi-account-range-edit { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.mi-account-range-edit input { width: 68px; min-width: 0; padding: 4px 5px; border: 1px solid var(--mi-border); border-radius: 5px; font-size: 10.5px; }
.mi-account-range-edit button { border: 1px solid var(--mi-border); background: #fff; border-radius: 5px; padding: 4px 7px; font-size: 10px; font-weight: 700; }
.mi-range-input { max-width: 145px; }

@media (max-width: 768px) {
  .mi-header-unified {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .mi-header-brand {
    justify-content: space-between;
    width: 100%;
  }
  .mi-tabs-inline {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mi-tabs-inline::-webkit-scrollbar { display: none; }
  .mi-tab-btn {
    flex: 1 0 auto;
    text-align: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .mi-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .mi-top-bar-left-controls {
    width: 100%;
  }
  .mi-top-bar-search {
    max-width: none;
  }
  .mi-top-bar-right {
    width: 100%;
    justify-content: space-between;
  }
  .mi-sort-box {
    flex: 1;
  }
  .mi-sort-select {
    width: 100%;
  }

  .mi-shop-desktop-results,
  .mi-cat-desktop-results,
  .mi-product-desktop-results {
    display: none !important;
  }
  .mi-shop-mobile-results,
  .mi-cat-mobile-results,
  .mi-product-mobile-results {
    display: block !important;
  }

  .mi-horizontal-filter-bar {
    padding: 8px 12px;
  }
  .mi-filter-grid-row-1,
  .mi-filter-grid-row-2 {
    gap: 8px;
  }
  .mi-market-select-sm {
    width: 100%;
  }
  .mi-filter-col {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .mi-modal-overlay { padding: 0 !important; align-items: stretch !important; }
  .mi-modal-box { max-height: 100dvh !important; height: 100dvh; border-radius: 0 !important; }
  .mi-modal-body { padding: 14px !important; }
  .mi-modal-prod-hdr { gap: 10px; }
  .mi-modal-prod-thumb { width: 68px; height: 68px; }
  .mi-modal-prod-title { font-size: 14px; }
  .mi-kpi-grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .mi-product-metric-explorer { margin-left: 0; margin-right: 0; }
  .mi-account-add-box { align-items: stretch; }
  .mi-account-add-box input, .mi-range-input { min-width: 100%; max-width: none; }
  .mi-account-range-edit { flex-wrap: wrap; }
  .mi-crawler-state { grid-template-columns: 1fr; }
  .mi-crawler-config-summary { align-items: flex-start; flex-direction: column; }
  .mi-crawler-config-summary::after { position: absolute; right: 14px; }
  .mi-account-table th:first-child,
  .mi-account-table td:first-child { width: 180px; min-width: 180px; max-width: 180px; }
}

.mi-badge-off {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.mi-badge-on {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

/* Crawler dùng cùng hệ màu tím của STONK và ưu tiên hiển thị trọn trong một viewport. */
.mi-crawler-panel {
  --mi-primary: var(--brand, #6d4aff);
  --mi-primary-h: var(--brand-strong, #5b36d6);
  --mi-primary-bg: var(--brand-soft, #f1edff);
  gap: 8px;
  padding: 10px 14px !important;
}
.mi-crawler-panel > .mi-modal-section { margin-top: 0; }
.mi-crawler-panel .mi-crawler-hero {
  gap: 8px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--brand, #6d4aff) 4%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--brand, #6d4aff) 20%, var(--line, #e5e7eb));
}
.mi-crawler-panel .mi-crawler-hero-main { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mi-crawler-panel .mi-crawler-hero-stat { gap: 2px; min-width: 0; }
.mi-crawler-panel .mi-crawler-stat-label { font-size: 9.5px; }
.mi-crawler-panel .mi-crawler-stat-val { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.mi-crawler-panel .mi-crawler-pct { font-size: 10.5px; }
.mi-crawler-panel .mi-crawler-progress-bar-wrap { height: 6px; background: color-mix(in srgb, var(--brand, #6d4aff) 10%, var(--surface-2, #f6f4ff)); }
.mi-crawler-panel .mi-crawler-progress-bar { background: linear-gradient(90deg, var(--brand, #6d4aff), var(--pink, #ec4899)); }
.mi-crawler-panel .mi-crawler-state {
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  gap: 8px 12px;
  padding: 7px 10px;
  border-color: color-mix(in srgb, var(--brand, #6d4aff) 24%, var(--line, #e5e7eb));
  background: var(--brand-soft, #f1edff);
  color: var(--brand-strong, #5b36d6);
}
.mi-crawler-panel .mi-crawler-state span { overflow: hidden; color: var(--muted, #6b7280); text-overflow: ellipsis; white-space: nowrap; }
.mi-crawler-panel .mi-crawler-actions-bar { gap: 7px; }
.mi-crawler-panel .mi-crawler-actions-bar .mi-btn,
.mi-crawler-panel .mi-btn-danger { min-height: 32px; padding: 6px 11px; }
.mi-crawler-panel .mi-crawler-status-pill,
.mi-crawler-panel .mi-crawler-status-pill.running,
.mi-crawler-panel .mi-crawler-status-pill.warning,
.mi-crawler-panel .mi-crawler-status-pill.writing {
  background: var(--brand-soft, #f1edff);
  color: var(--brand-strong, #5b36d6);
  border: 1px solid color-mix(in srgb, var(--brand, #6d4aff) 28%, var(--line, #e5e7eb));
}
.mi-crawler-panel .mi-clr-emerald,
.mi-crawler-panel .mi-clr-cyan,
.mi-crawler-panel .mi-clr-gold,
.mi-crawler-panel .mi-clr-purple,
.mi-crawler-panel .mi-clr-teal { color: var(--brand-strong, #5b36d6) !important; }
.mi-crawler-panel .mi-crawler-config {
  border: 1px solid var(--line, var(--mi-border));
  border-radius: 8px;
  background: var(--surface, #fff);
}
.mi-crawler-panel .mi-crawler-config-summary { align-items: center; margin-bottom: 0; padding: 7px 10px; }
.mi-crawler-panel .mi-auto-allocation-note { padding: 7px 9px; border-radius: 7px; background: var(--brand-soft, #f1edff); }
.mi-crawler-panel .mi-account-manager-section { min-height: 0; }
.mi-crawler-panel .mi-account-manager-section > .mi-modal-section-hdr { margin-bottom: 5px; }
.mi-crawler-panel .mi-account-add-box { flex-wrap: nowrap; gap: 7px; }
.mi-crawler-panel .mi-account-add-box .mi-form-input { min-width: 120px; min-height: 34px; padding: 6px 9px; }
.mi-crawler-panel .mi-account-table-wrap { margin-top: 6px !important; }
.mi-crawler-panel .mi-account-table { min-width: 830px; table-layout: fixed; }
.mi-crawler-panel .mi-account-table th:first-child,
.mi-crawler-panel .mi-account-table td:first-child { width: 190px; min-width: 190px; max-width: 190px; }
.mi-crawler-panel .mi-account-table th:nth-child(2),
.mi-crawler-panel .mi-account-table td:nth-child(2) { width: 72px; min-width: 72px; }
.mi-crawler-panel .mi-account-table th:nth-child(3),
.mi-crawler-panel .mi-account-table td:nth-child(3) { width: 112px; }
.mi-crawler-panel .mi-account-table th:nth-child(4),
.mi-crawler-panel .mi-account-table td:nth-child(4) { width: 194px; }
.mi-crawler-panel .mi-account-table th:nth-child(5),
.mi-crawler-panel .mi-account-table td:nth-child(5) { width: 105px; }
.mi-crawler-panel .mi-account-table th:nth-child(6),
.mi-crawler-panel .mi-account-table td:nth-child(6) { width: 150px !important; }
.mi-crawler-panel .mi-account-table td:nth-child(6) .mi-btn { max-width: 100%; padding-inline: 8px; font-size: 10.5px; }
.mi-crawler-panel .mi-account-table th,
.mi-crawler-panel .mi-account-table td { padding-top: 7px !important; padding-bottom: 7px !important; }
.mi-account-checkpoint { display: block; color: var(--brand-strong, #5b36d6); font-size: 11px; }
.mi-account-auto-note { display: block; margin-top: 2px; color: var(--muted, #6b7280); font-size: 9.5px; white-space: normal; }
.mi-crawler-logs-section { min-height: 0; }
.mi-crawler-logs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.mi-crawler-panel .mi-logs-box { max-height: 120px; min-height: 58px; border-color: var(--line, var(--mi-border)); background: var(--surface-2, #f8f7ff); }
.mi-log-empty { display: grid; min-height: 42px; place-items: center; color: var(--muted, #6b7280); font-family: inherit; }
.mi-crawler-panel .mi-switch-input:checked + .mi-switch-slider,
.mi-crawler-panel .mi-badge-on { background: var(--brand, #6d4aff); }
.mi-crawler-panel .mi-badge-on { color: #fff; border-color: var(--brand, #6d4aff); }
.mi-crawler-panel .mi-pulsar-dot { background: var(--brand, #6d4aff); box-shadow: 0 0 0 3px var(--brand-soft, #f1edff); }

#stonkAppRoot main.workspace:has(#kocMiningView.active) {
  display: block !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100% !important;
}
#stonkAppRoot #kocMiningView.active {
  display: block !important;
  height: auto !important;
  min-height: auto !important;
  overflow-y: visible !important;
  padding-bottom: 80px !important;
}
#stonkAppRoot #kocMiningViewMount {
  width: 100% !important;
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
}
#kocMiningViewMount > .mi-crawler-panel { height: 100%; }
#stonkAppRoot #kocMiningViewMount > .mi-crawler-panel {
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
  padding-bottom: 40px !important;
}
#stonkAppRoot #kocMiningViewMount .mi-account-table-wrap {
  max-height: 400px !important;
  overflow: auto !important;
}
#stonkAppRoot #kocMiningViewMount .mi-crawler-logs-section {
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
  margin-top: 14px !important;
}
#stonkAppRoot #kocMiningViewMount .mi-logs-box {
  min-height: 220px !important;
  max-height: 400px !important;
  overflow: auto !important;
}

@media (max-width: 900px) {
  .mi-crawler-panel .mi-crawler-hero-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mi-crawler-panel .mi-account-add-box { align-items: stretch; flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
 *  SEARCH AUTOCOMPLETE & MULTI-SCOPE POPUP
 * ══════════════════════════════════════════════════════════════ */
.mi-top-bar-search { position: relative; }
.mi-search-suggestions-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(720px, 92vw);
  max-height: 480px;
  background: #ffffff;
  border: 1px solid var(--mi-border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 1050;
  overflow-y: auto;
  padding: 12px;
  animation: miFadeDown 0.15s ease-out;
}
@keyframes miFadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.mi-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.mi-suggest-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mi-suggest-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--mi-muted, #64748b);
  letter-spacing: 0.5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--mi-border-light, #f1f5f9);
}
.mi-suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
  background: transparent;
}
.mi-suggest-item:hover {
  background: var(--mi-surface2, #f8fafc);
  transform: translateX(2px);
}
.mi-suggest-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}
.mi-suggest-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}
.mi-suggest-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.mi-suggest-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--mi-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mi-suggest-sub {
  font-size: 11px;
  color: var(--mi-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mi-suggest-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--mi-muted, #64748b);
}
.mi-suggest-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--mi-border-light, #f1f5f9);
}
.mi-suggest-view-all-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--mi-surface2, #f8fafc);
  color: var(--mi-primary, #6366f1);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--mi-border, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.mi-suggest-view-all-btn:hover {
  background: var(--mi-primary, #6366f1);
  color: #ffffff;
  border-color: var(--mi-primary, #6366f1);
}
span.highlight, .highlight {
  background: #fef08a;
  color: #854d0e;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}

/* ── 5-Tab Modal Subviews ───────────────────────────────────── */
.mi-modal-subtabs-bar {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--mi-border-light, #f1f5f9);
  margin-bottom: 16px;
  overflow-x: auto;
}
.mi-modal-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mi-muted, #64748b);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.mi-modal-subtab:hover {
  color: var(--mi-primary, #6366f1);
}
.mi-modal-subtab.active {
  color: var(--mi-primary, #6366f1);
  border-bottom-color: var(--mi-primary, #6366f1);
}
.mi-live-cell-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mi-live-thumb-img {
  width: 54px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  background: #0f172a;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.mi-live-info-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mi-live-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--mi-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.mi-live-sub {
  font-size: 11px;
  color: var(--mi-muted, #64748b);
}
.mi-video-desc-line {
  font-size: 12px;
  font-weight: 600;
  color: var(--mi-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}
.mi-video-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════
 *  MOBILE RESPONSIVE RULES (≤ 768px)
 * ══════════════════════════════════════════════════════════════ */
  #viewMarketIntelligence {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: visible !important;
    padding-bottom: calc(var(--bottom-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 36px) !important;
  }

  .mi-wrap {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: visible !important;
  }

  /* ── Mobile Header ─────────────────────────────────────────── */
  .mi-header {
    padding: 12px 14px 8px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .mi-header-brand {
    align-items: center !important;
    gap: 10px !important;
  }
  .mi-header-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
  }
  .mi-header-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
  .mi-header-top-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .mi-title {
    font-size: 14.5px !important;
    line-height: 1.3 !important;
  }
  .mi-badge-cosmic-live {
    font-size: 10px !important;
    padding: 2px 8px !important;
  }
  .mi-subtitle {
    display: none !important;
  }

  /* Header action buttons scroll horizontally */
  .mi-header-actions {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    padding-bottom: 4px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 6px !important;
    width: 100% !important;
    margin-bottom: 4px !important;
  }
  .mi-header-actions::-webkit-scrollbar {
    display: none !important;
  }
  .mi-header-actions .mi-btn {
    font-size: 11.5px !important;
    padding: 6px 12px !important;
    height: 32px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
  }

  /* ── Mobile Tabs ───────────────────────────────────────────── */
  .mi-tabs {
    padding: 0 8px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 4px !important;
    border-bottom: 1px solid var(--mi-border) !important;
  }
  .mi-tabs::-webkit-scrollbar {
    display: none !important;
  }
  .mi-tab-btn {
    padding: 10px 12px !important;
    font-size: 12.5px !important;
    flex-shrink: 0 !important;
    gap: 6px !important;
  }
  .mi-tab-btn svg {
    width: 15px !important;
    height: 15px !important;
  }

  /* ── Mobile Top Bar Controls ───────────────────────────────── */
  .mi-top-bar {
    padding: 10px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .mi-top-bar-left-controls {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
    align-items: center !important;
  }
  .mi-filter-expand-btn {
    padding: 7px 10px !important;
    font-size: 12px !important;
    height: 36px !important;
  }
  .mi-top-bar-search {
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
  }
  .mi-top-search-input {
    width: 100% !important;
    height: 36px !important;
    font-size: 13px !important;
    padding: 6px 28px 6px 30px !important;
  }
  .mi-top-bar-right {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .mi-chip-active-time {
    font-size: 11px !important;
    padding: 6px 8px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .mi-top-bar-right select,
  .mi-market-select {
    flex: 1 !important;
    min-width: 0 !important;
    height: 36px !important;
    font-size: 12px !important;
  }

  /* ── Mobile 2-Column Layout to Stacked ─────────────────────── */
  .mi-market-layout {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: visible !important;
  }
  .mi-market-sidebar {
    width: 100% !important;
    min-width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--mi-border) !important;
    padding: 12px 14px !important;
  }
  .mi-market-sidebar.mi-sidebar-hidden {
    display: none !important;
  }
  .mi-market-main {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: visible !important;
  }

  /* ── Mobile Smooth Table Swiping & Sticky Pinned Columns ───── */
  .mi-tbl-wrap,
  .mi-table-wrap,
  div[style*="overflow-x: auto"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    scrollbar-width: thin !important;
  }
  table.mi-table {
    min-width: 680px !important;
    font-size: 12px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  table.mi-table th,
  table.mi-table td {
    padding: 9px 10px !important;
    white-space: nowrap !important;
  }

  /* Giữ nguyên cột thông tin để vuốt ngang mượt mà không bị mất số liệu */
  .mi-hide-md {
    display: table-cell !important;
  }
  .mi-hide-lg {
    display: table-cell !important;
  }

  /* ── Mobile KPIs & Grids ───────────────────────────────────── */
  .mi-kpi-grid,
  .mi-kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .mi-kpi-card {
    padding: 10px 12px !important;
  }
  .mi-kpi-val {
    font-size: 15px !important;
  }

  /* ── Mobile Modals ─────────────────────────────────────────── */
  .mi-modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 88vh !important;
    padding: 16px 14px !important;
  }
  .mi-form-grid-2 {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════════
 *  STONK AI VIDEO INTELLIGENCE RADAR (CREATIVE GRID & KPI HERO)
 * ══════════════════════════════════════════════════════════════ */
.mi-video-radar-hero {
  background: linear-gradient(135deg, #1e1035 0%, #0d061a 100%);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 12px 14px 16px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
  color: #ffffff;
}
.mi-video-radar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.mi-video-radar-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mi-video-radar-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}
.mi-video-radar-heading {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mi-video-radar-sub {
  font-size: 12px;
  color: #a5b4fc;
  margin-top: 2px;
}
.mi-video-mode-switcher {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  gap: 3px;
}
.mi-mode-btn {
  background: transparent;
  border: none;
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.mi-mode-btn:hover {
  color: #fff;
}
.mi-mode-btn.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}
.mi-video-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.mi-video-kpi-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
}
.mi-video-kpi-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.mi-video-kpi-value {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-top: 3px;
}

/* ── Stonk Video Cards Grid ─────────────────────────────────── */
.mi-video-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 0 14px 16px;
}
@media (max-width: 640px) {
  .mi-video-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 10px 14px;
  }
}
.mi-stonk-video-card {
  background: var(--mi-surface, #ffffff);
  border: 1px solid var(--mi-border, #eae6f3);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.mi-stonk-video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.12);
  border-color: #c4b5fd;
}
.mi-video-poster-area {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #090414;
  overflow: hidden;
  cursor: pointer;
}
.mi-video-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.mi-stonk-video-card:hover .mi-video-poster-img {
  transform: scale(1.04);
}
.mi-video-poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}
.mi-video-top-badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.mi-video-rank-pill {
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.mi-video-rank-pill.top-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}
.mi-video-rank-pill.top-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}
.mi-video-rank-pill.top-3 {
  background: linear-gradient(135deg, #d97706, #b45309);
}
.mi-video-tag-group {
  display: flex;
  gap: 4px;
}
.mi-video-play-btn-large {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  opacity: 0.9;
}
.mi-stonk-video-card:hover .mi-video-play-btn-large {
  transform: translate(-50%, -50%) scale(1.08);
  background: #7c3aed;
  opacity: 1;
}
.mi-video-bottom-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: #fff;
}
.mi-video-duration-pill {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.mi-video-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.mi-video-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--mi-text, #251c46);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.mi-video-card-title:hover {
  color: var(--mi-primary, #7c3aed);
}
.mi-video-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  gap: 6px;
}
.mi-video-author-link {
  color: var(--mi-muted, #64748b);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mi-video-author-link:hover {
  color: var(--mi-primary, #7c3aed);
}
.mi-video-metric-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--mi-surface-2, #f8fafc);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--mi-border, #eae6f3);
}
.mi-metric-cell {
  display: flex;
  flex-direction: column;
}
.mi-metric-cell-label {
  font-size: 10.5px;
  color: var(--mi-muted, #64748b);
  font-weight: 500;
}
.mi-metric-cell-val {
  font-size: 13.5px;
  font-weight: 800;
  margin-top: 1px;
}
.mi-video-card-footer {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}
.mi-video-card-btn {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
}
.mi-video-card-btn-primary {
  background: var(--mi-primary, #7c3aed);
  color: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
}
.mi-video-card-btn-primary:hover {
  background: var(--mi-primary-h, #6d28d9);
}
.mi-video-card-btn-secondary {
  background: var(--mi-surface-2, #f1f5f9);
  color: var(--mi-text, #334155);
  border: 1px solid var(--mi-border, #e2e8f0);
}
.mi-video-card-btn-secondary:hover {
  background: #e2e8f0;
}

/* ── Mobile Scroll Hint Badge ───────────────────────────────── */
.mi-table-scroll-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mi-muted, #64748b);
  padding: 6px 12px;
  background: var(--mi-surface-2, #f8fafc);
  border-bottom: 1px solid var(--mi-border, #eae6f3);
}
@media (max-width: 768px) {
  .mi-table-scroll-hint {
    display: flex;
  }
}

/* ── Checkpoint & Control Center Badges ─────────────────────── */
.mi-badge-emerald {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0 !important;
  font-weight: 700;
}
.mi-badge-warn {
  background: #fffbeb !important;
  color: #d97706 !important;
  border: 1px solid #fde68a !important;
  font-weight: 700;
}
.mi-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
}
.mi-rating-badge svg {
  color: #f59e0b;
}

/* ── Market Intelligence DEEP MODAL LAYOUT (Sidebar + Main Content) ────── */
.mi-deep-modal-wrap {
  display: flex;
  min-height: 540px;
  background: #fff;
  border-radius: 0 0 12px 12px;
  margin: -16px -20px -20px -20px;
}
.mi-deep-modal-nav {
  width: 170px;
  min-width: 170px;
  background: #f8fafc;
  border-right: 1px solid var(--mi-border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.mi-deep-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}
.mi-deep-nav-btn:hover {
  background: #ede9fe;
  color: var(--mi-primary);
}
.mi-deep-nav-btn.active {
  background: #ede9fe;
  color: var(--mi-primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--mi-primary);
}
.mi-deep-nav-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.mi-deep-modal-content {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
  max-height: 80vh;
  background: #ffffff;
}

/* ── SALES STRATEGY FORMULA BAR ────────────────────────────── */
.mi-strategy-box {
  background: #f8fafc;
  border: 1px solid var(--mi-border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.mi-strategy-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.mi-strategy-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.mi-strategy-pills {
  display: flex;
  gap: 6px;
}
.mi-strategy-pill {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--mi-border);
  background: #fff;
  cursor: pointer;
}
.mi-strategy-pill.active {
  background: var(--mi-primary);
  color: #fff;
  border-color: var(--mi-primary);
}
.mi-strategy-formula {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mi-strategy-bar {
  display: flex;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
  width: 100%;
  margin-bottom: 10px;
}
.mi-strat-seg {
  height: 100%;
  transition: width 0.3s ease;
}
.mi-seg-blue { background: #0284c7; }
.mi-seg-green { background: #10b981; }
.mi-seg-purple { background: #8b5cf6; }
.mi-seg-amber { background: #f59e0b; }
.mi-strategy-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11.5px;
  color: #475569;
}
.mi-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mi-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* ── PRODUCT ATTRIBUTES GRID ────────────────────────────────── */
.mi-attrs-card {
  background: #f8fafc;
  border: 1px solid var(--mi-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.mi-attrs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px 20px;
  font-size: 12px;
  color: #334155;
  margin-top: 10px;
}
.mi-attr-row {
  display: flex;
  gap: 8px;
}
.mi-attr-label {
  color: #64748b;
  min-width: 100px;
  font-weight: 500;
}
.mi-attr-val {
  color: #0f172a;
  font-weight: 600;
  flex: 1;
}
.mi-tag-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.mi-tag-pill {
  padding: 4px 10px;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ── PRODUCT GALLERY THUMBNAILS ─────────────────────────────── */
.mi-gallery-thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.mi-gallery-thumb-item {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1.5px solid var(--mi-border);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.mi-gallery-thumb-item:hover, .mi-gallery-thumb-item.active {
  border-color: var(--mi-primary);
  transform: scale(1.05);
}
.mi-gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── HOVER POPOVER CARD ─────────────────────────────────────── */
.mi-popover-preview {
  position: absolute;
  z-index: 100010;
  background: #fff;
  border: 1px solid var(--mi-border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.15);
  width: 240px;
  pointer-events: none;
}
.mi-popover-preview img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}
.mi-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  margin-bottom: 4px;
}
.mi-popover-price {
  font-size: 13px;
  font-weight: 700;
  color: #059669;
}

/* ── VIDEO & ADS EXPLORER STYLES ────────────────────────────── */
.mi-table tr[data-vid] td {
  padding: 12px 14px !important;
  vertical-align: middle !important;
}

.mi-video-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 440px;
}
.mi-video-thumb-wrap {
  position: relative;
  width: 54px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.mi-video-thumb-wrap:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 14px rgba(124,58,237,0.25);
}
.mi-video-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mi-video-duration-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  backdrop-filter: blur(2px);
  pointer-events: none;
  line-height: 1.2;
}
.mi-video-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.mi-video-thumb-wrap:hover .mi-video-play-overlay {
  opacity: 1;
}
.mi-video-play-overlay svg {
  width: 22px;
  height: 22px;
  fill: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.mi-video-info-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.mi-video-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--mi-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  word-break: break-word;
}
.mi-video-title:hover {
  color: var(--mi-primary);
  text-decoration: underline;
}
.mi-video-tags-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 1px;
}
.mi-video-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid;
  white-space: nowrap;
  letter-spacing: 0.15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.mi-video-cat-badge svg {
  flex-shrink: 0;
}
.mi-badge-ad {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.12);
  letter-spacing: 0.2px;
}
.mi-badge-ai {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #d8b4fe;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.12);
  letter-spacing: 0.2px;
}
.mi-badge-roas {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.12);
}
.mi-badge-viral {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.12);
}
.mi-badge-ad svg,
.mi-badge-ai svg,
.mi-badge-roas svg,
.mi-badge-viral svg {
  flex-shrink: 0;
}
.mi-th-sorted {
  color: var(--mi-primary, #7c3aed) !important;
  background: rgba(124, 58, 237, 0.04) !important;
}
.mi-video-author-line {
  display: flex;
  align-items: center;
  margin-top: 3px;
}
.mi-video-author {
  font-size: 11.5px;
  color: var(--mi-muted, #64748b);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
.mi-video-author:hover {
  color: var(--mi-primary, #7c3aed);
  text-decoration: underline;
}
.mi-video-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.mi-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--mi-border);
  background: #ffffff;
  color: var(--mi-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.mi-icon-btn:hover {
  background: var(--mi-primary-bg, #f5f3ff);
  color: var(--mi-primary);
  border-color: var(--mi-primary);
  transform: translateY(-1px);
}
.mi-icon-btn.active-star {
  color: #f59e0b;
  border-color: #fde68a;
  background: #fffbeb;
}

@media (max-width: 640px) {
  .mi-video-modal-split {
    flex-direction: column !important;
    max-height: none !important;
  }
  .mi-video-modal-split #miVideoPlayerContainer {
    width: 100% !important;
    max-height: 280px !important;
  }
}

/* ── COMPACT VIDEO MODAL DIALOG (NO WHITE MARGINS) ───────────── */
.mi-video-modal-dialog {
  max-width: 390px !important;
  width: 95vw !important;
  border-radius: 16px !important;
  margin: auto !important;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--mi-border, #eae6f3) !important;
  overflow: hidden !important;
}
.mi-video-modal-dialog .mi-modal-body {
  padding: 12px 14px 14px !important;
  overflow-y: hidden !important;
}
.mi-video-modal-dialog .mi-modal-head {
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--mi-border-light, #f4f1fa) !important;
  background: var(--mi-surface2, #fcfbff) !important;
}

/* ── HOVER VIDEO MINI PLAYER POPOVER ────────────────────────── */
.mi-hover-video-popover {
  position: absolute;
  z-index: 100020;
  width: 205px;
  background: #0d0718;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
  pointer-events: auto;
  animation: miPopFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  transform-origin: top left;
}
@keyframes miPopFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.mi-hover-video-wrap {
  display: flex;
  flex-direction: column;
  color: #ffffff;
}
.mi-hover-video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.mi-hover-video-title {
  color: #c4b5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.mi-hover-sound-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.mi-hover-sound-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}
.mi-hover-video-player-box {
  position: relative;
  width: 205px;
  height: 315px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mi-hover-video-player-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.mi-hover-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 7, 24, 0.7);
  z-index: 2;
  color: #c4b5fd;
}
.mi-hover-video-foot {
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.5);
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 6.0.39 — bộ lọc gọn: desktop một hàng, mobile không tràn nút tìm kiếm. */
.mi-list-summary-kpis {
  margin: 10px 18px 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 901px) {
  .mi-top-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px 12px;
  }
  .mi-top-bar-left-controls { gap: 6px; }
  .mi-top-cat-select { width: 180px; max-width: 180px; }
  .mi-top-bar-search { max-width: none; min-width: 180px; }
  .mi-top-bar-right { gap: 6px; }
  .mi-horizontal-filter-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 14px;
    padding: 6px 12px;
  }
  .mi-filter-grid-row-1,
  .mi-filter-grid-row-2 {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 0;
    border: 0;
  }
  .mi-filter-grid-row-2 { justify-content: flex-end; }
  .mi-filter-checks-wrap { flex-wrap: nowrap; gap: 10px; }
  .mi-filter-col { flex-direction: row; width: auto; }
  .mi-market-select-sm { width: 92px; }
}

@media (max-width: 760px) {
  .mi-top-bar { padding: 7px 8px !important; gap: 6px !important; }
  .mi-top-bar-left-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 38px !important;
    gap: 6px !important;
    min-width: 0 !important;
  }
  .mi-top-bar-left-controls > .mi-top-select-sm {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  .mi-top-bar-search {
    grid-column: 3 !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
  }
  .mi-top-search-input {
    width: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
    color: transparent !important;
    cursor: pointer;
  }
  .mi-top-search-input::placeholder { color: transparent !important; }
  .mi-top-bar-search .mi-search-icon { left: 12px !important; z-index: 1; }
  .mi-top-bar-search:focus-within {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: none !important;
  }
  .mi-top-bar-search:focus-within .mi-top-search-input {
    width: 100% !important;
    color: var(--mi-text) !important;
    padding: 6px 28px 6px 30px !important;
  }
  .mi-top-bar-search:focus-within .mi-top-search-input::placeholder { color: var(--mi-placeholder) !important; }
  .mi-list-summary-kpis {
    margin: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }
  .mi-list-summary-kpis .mi-kpi-card { min-height: 72px; padding: 8px; }
  .mi-horizontal-filter-bar { padding: 7px 8px; gap: 6px; }
  .mi-filter-grid-row-1 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .mi-filter-grid-row-1 .mi-filter-col { width: 100%; gap: 3px; }
  .mi-filter-grid-row-2 { gap: 6px; }
}
