/* =========================================================================
   DESIGN SYSTEM — Email Marketing (synced with progress-dashboard)
   Font: Outfit (loaded via <link> in index.html)
   ========================================================================= */
:root {
  --font-family:       'Outfit', sans-serif;
  
  --bg-base:           #07110f;
  --bg-gradient:
    linear-gradient(132deg, rgba(31, 93, 78, 0.34) 0%, transparent 31%),
    linear-gradient(224deg, rgba(93, 55, 26, 0.28) 3%, transparent 37%),
    linear-gradient(315deg, rgba(40, 28, 66, 0.26) 0%, transparent 36%),
    linear-gradient(180deg, #07110f 0%, #0a1613 46%, #050909 100%);
  --bg-secondary:      rgba(9, 22, 19, 0.72);
  --bg-surface:        rgba(15, 32, 28, 0.56);
  --bg-surface-solid:  #0f201c;
  
  --border-color:      rgba(201, 255, 238, 0.12);
  --border-hover:      rgba(125, 255, 225, 0.34);

  --text-primary:      #f6fffb;
  --text-secondary:    #b7cfc7;
  --text-muted:        #78928a;

  --primary:           #34d6c3;
  --primary-hover:     #79ffe1;
  --primary-glow:      rgba(52, 214, 195, 0.18);
  --primary-gradient:  linear-gradient(135deg, #1d7f72 0%, #34d6c3 45%, #f6c453 115%);

  --success:           #10b981;
  --success-glow:      rgba(16, 185, 129, 0.12);
  --warning:           #f6c453;
  --warning-glow:      rgba(246, 196, 83, 0.14);
  --danger:            #ff6b8a;
  --danger-glow:       rgba(255, 107, 138, 0.14);
  --purple:            #a78bfa;
  --gradient-purple:   linear-gradient(135deg, #5b4ab2, #a78bfa 58%, #ff8db2);

  --radius-lg:         8px;
  --radius-md:         8px;
  --radius-sm:         6px;
  --glass-blur:        22px;
  --glass-shadow:      0 18px 48px -24px rgba(0, 0, 0, 0.72), 0 1px 0 rgba(255,255,255,0.05) inset;
  --shadow-md:         0 14px 34px -24px rgba(0, 0, 0, 0.72);
  --shadow-lg:         0 24px 54px -30px rgba(0, 0, 0, 0.78);
  --shadow-glow:       0 0 28px var(--primary-glow);
  --liquid-edge:       rgba(255, 255, 255, 0.08);
  --liquid-warm:       #f6c453;
  --transition-smooth: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);

  /* === Backward-compat aliases === */
  --bg:           var(--bg-base);
  --bg-soft:      var(--bg-surface-solid);
  --panel:        var(--bg-surface);
  --panel-hover:  rgba(255, 255, 255, 0.03);
  --ink:          var(--text-primary);
  --muted:        var(--text-secondary);
  --line:         var(--border-color);
  --line-hover:   var(--border-hover);
  --brand:        var(--primary);
  --brand-light:  #79ffe1;
  --brand-soft:   var(--primary-glow);
  --green:        var(--success);
  --amber:        var(--warning);
  --red:          var(--danger);
  --radius:       var(--radius-md);
  --shadow:       var(--glass-shadow);
  --gradient-blue: var(--primary-gradient);
  --surface:      var(--bg-surface);
  --border:       var(--border-color);
}

:root[data-theme="light"] {
  --bg-base:           #f5fbf8;
  --bg-gradient:
    linear-gradient(132deg, rgba(52, 214, 195, 0.18) 0%, transparent 32%),
    linear-gradient(224deg, rgba(246, 196, 83, 0.16) 3%, transparent 38%),
    linear-gradient(315deg, rgba(167, 139, 250, 0.13) 0%, transparent 36%),
    linear-gradient(180deg, #f8fffc 0%, #eef8f4 52%, #f6fbf8 100%);
  --bg-secondary:      rgba(255, 255, 255, 0.74);
  --bg-surface:        rgba(255, 255, 255, 0.66);
  --bg-surface-solid:  #fbfffd;

  --border-color:      rgba(14, 95, 80, 0.14);
  --border-hover:      rgba(15, 139, 127, 0.34);

  --text-primary:      #10251f;
  --text-secondary:    #48635b;
  --text-muted:        #6d8880;

  --primary:           #0f8b7f;
  --primary-hover:     #0b6f66;
  --primary-glow:      rgba(15, 139, 127, 0.16);
  --primary-gradient:  linear-gradient(135deg, #0b6f66 0%, #34d6c3 48%, #f0b93d 115%);

  --success:           #0f9f72;
  --success-glow:      rgba(15, 159, 114, 0.12);
  --warning:           #c98508;
  --warning-glow:      rgba(201, 133, 8, 0.14);
  --danger:            #d53f64;
  --danger-glow:       rgba(213, 63, 100, 0.12);
  --purple:            #7657d6;
  --gradient-purple:   linear-gradient(135deg, #5a43b0, #8b6df4 58%, #d95f86);

  --glass-shadow:      0 18px 46px -30px rgba(18, 54, 45, 0.28), 0 1px 0 rgba(255,255,255,0.86) inset;
  --shadow-md:         0 14px 34px -26px rgba(18, 54, 45, 0.25);
  --shadow-lg:         0 24px 54px -34px rgba(18, 54, 45, 0.30);
  --shadow-glow:       0 0 24px var(--primary-glow);
  --liquid-edge:       rgba(15, 139, 127, 0.12);
  --liquid-warm:       #c98508;
  --panel-hover:       rgba(15, 139, 127, 0.08);
  --brand-light:       #0b6f66;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
html, body { height: 100%; }
body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    linear-gradient(110deg, transparent 0 12%, rgba(125, 255, 225, 0.10) 13% 18%, transparent 19% 42%, rgba(246, 196, 83, 0.08) 43% 48%, transparent 49%),
    linear-gradient(22deg, transparent 0 22%, rgba(255, 107, 138, 0.07) 23% 28%, transparent 29% 72%, rgba(52, 214, 195, 0.09) 73% 79%, transparent 80%);
  opacity: 0.9;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    repeating-linear-gradient(118deg, rgba(255,255,255,0.026) 0 1px, transparent 1px 11px),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 34%, rgba(0,0,0,0.18));
  mix-blend-mode: screen;
  opacity: 0.34;
}

:root[data-theme="light"] body::before {
  background:
    linear-gradient(110deg, transparent 0 12%, rgba(15, 139, 127, 0.10) 13% 18%, transparent 19% 42%, rgba(201, 133, 8, 0.09) 43% 48%, transparent 49%),
    linear-gradient(22deg, transparent 0 22%, rgba(213, 63, 100, 0.07) 23% 28%, transparent 29% 72%, rgba(52, 214, 195, 0.10) 73% 79%, transparent 80%);
  opacity: 0.55;
}
:root[data-theme="light"] body::after {
  background:
    repeating-linear-gradient(118deg, rgba(16, 37, 31, 0.035) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, rgba(255,255,255,0.32), transparent 34%, rgba(15,139,127,0.08));
  mix-blend-mode: multiply;
  opacity: 0.18;
}

/* Liquid brand background */
.background-glows {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 12% -12%, rgba(52, 214, 195, 0.20), transparent 62%),
    radial-gradient(800px 520px at 96% 12%, rgba(246, 196, 83, 0.13), transparent 61%),
    radial-gradient(760px 580px at 54% 104%, rgba(255, 107, 138, 0.10), transparent 64%);
}
:root[data-theme="light"] .background-glows {
  background:
    radial-gradient(900px 420px at 12% -12%, rgba(52, 214, 195, 0.22), transparent 62%),
    radial-gradient(800px 520px at 96% 12%, rgba(246, 196, 83, 0.18), transparent 61%),
    radial-gradient(760px 580px at 54% 104%, rgba(213, 63, 100, 0.11), transparent 64%);
}
:root[data-theme="light"] .glow { opacity: 0.22; }
.glow {
  position: absolute;
  border-radius: 42% 58% 48% 52%;
  filter: blur(58px);
  opacity: 0.28;
  transition: var(--transition-smooth);
  transform: rotate(-12deg);
}
.glow-1 {
  width: 620px;
  height: 170px;
  top: 52px;
  right: -120px;
  background: linear-gradient(90deg, transparent, rgba(52, 214, 195, 0.42), transparent);
}
.glow-2 {
  width: 740px;
  height: 190px;
  bottom: 86px;
  left: -180px;
  background: linear-gradient(90deg, transparent, rgba(246, 196, 83, 0.22), rgba(16, 185, 129, 0.28), transparent);
  transform: rotate(19deg);
}
.glow-3 {
  width: 520px;
  height: 150px;
  top: 42%;
  left: 44%;
  transform: translate(-50%, -50%) rotate(-28deg);
  background: linear-gradient(90deg, transparent, rgba(255, 107, 138, 0.18), rgba(167, 139, 250, 0.20), transparent);
  opacity: 0.22;
}

/* Custom scrollbar — synced with Quản lý Nhân sự */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Sidebar — synced with progress-dashboard glass style */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(10, 28, 24, 0.82), rgba(6, 16, 14, 0.76)),
    linear-gradient(135deg, rgba(52, 214, 195, 0.08), transparent 45%);
  backdrop-filter: blur(24px) saturate(138%);
  -webkit-backdrop-filter: blur(24px) saturate(138%);
  border-right: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 18px 0 42px -36px rgba(0, 0, 0, 0.9);
}
:root[data-theme="light"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(238, 248, 244, 0.78)),
    linear-gradient(135deg, rgba(52, 214, 195, 0.12), transparent 46%);
  box-shadow: 18px 0 42px -36px rgba(18, 54, 45, 0.42);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 18px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}
.logo-icon {
  width: 34px;
  height: 34px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(145deg, rgba(52, 214, 195, 0.18), rgba(246, 196, 83, 0.10)),
    rgba(255,255,255,0.03);
  border: 1px solid rgba(125, 255, 225, 0.24);
  border-radius: var(--radius-md);
  filter: drop-shadow(0 8px 18px rgba(52, 214, 195, 0.16));
  flex-shrink: 0;
}
:root[data-theme="light"] .logo-icon {
  background:
    linear-gradient(145deg, rgba(52, 214, 195, 0.20), rgba(246, 196, 83, 0.16)),
    rgba(255,255,255,0.64);
  border-color: rgba(15, 139, 127, 0.22);
}
.logo-icon svg { width: 20px; height: 20px; }
.logo-text { display: flex; flex-direction: column; gap: 2px; }
.logo-text h1 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.07em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-hover) 54%, var(--liquid-warm) 118%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}
.logo-text p {
  font-size: 9.5px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-section-label {
  padding: 10px 8px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-section-label-secondary {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.nav-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-title {
  color: inherit;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.15;
}
.nav-desc {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}
.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
  flex-shrink: 0;
}
.ui-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  vertical-align: -0.14em;
  color: currentColor;
  stroke-width: 2;
}
h1 > .ui-icon,
h2 > .ui-icon,
h3 > .ui-icon,
h4 > .ui-icon,
.view-head .ui-icon {
  color: var(--primary-hover);
  filter: drop-shadow(0 0 10px rgba(52, 214, 195, 0.22));
  margin-right: 0.18em;
}
.btn .ui-icon,
.dropdown-item .ui-icon,
.user-action .ui-icon {
  width: 16px;
  height: 16px;
  vertical-align: -0.18em;
}
.filter-group label .ui-icon,
.kpi-lbl .ui-icon,
.table-meta .ui-icon,
.muted .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
  opacity: 0.9;
}
.ins-stat-ico .ui-icon,
.system-col-icon .ui-icon,
.empty-state-icon .ui-icon,
.ins-empty-ico .ui-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-hover);
}
.ins-empty-ico .ui-icon,
.empty-state-icon .ui-icon {
  width: 42px;
  height: 42px;
  opacity: 0.72;
}
.kpi-qc-chip .ui-icon,
.qc-badge .ui-icon,
.qc-kpi small .ui-icon,
.badge .ui-icon,
.vi-badge .ui-icon,
.node-icon .ui-icon,
.ins-tag .ui-icon {
  width: 13px;
  height: 13px;
  margin-right: 3px;
  vertical-align: -0.18em;
}
.node-icon .ui-icon {
  width: 16px;
  height: 16px;
  margin-right: 0;
}
.maps-link .ui-icon,
.rating-stars .ui-icon,
.ins-rating .ui-icon,
.ins-email .ui-icon,
.source-badge .ui-icon {
  width: 14px;
  height: 14px;
}
.modal-close .ui-icon {
  width: 15px;
  height: 15px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
  margin: 3px 0;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}
.nav-item-main {
  align-items: flex-start;
  padding: 12px 14px;
  margin: 0;
}
.nav-item-main .nav-icon {
  margin-top: 2px;
}
.nav-item-secondary {
  padding: 9px 14px;
  font-size: 12.75px;
  margin: 0;
}
.nav-item-secondary .nav-icon {
  width: 16px;
  height: 16px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.055);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.06);
}
:root[data-theme="light"] .nav-item:hover {
  background: rgba(15, 139, 127, 0.08);
  border-color: rgba(15, 139, 127, 0.12);
}
.nav-item.active {
  background:
    linear-gradient(135deg, rgba(52, 214, 195, 0.18), rgba(246, 196, 83, 0.08)),
    rgba(255,255,255,0.04);
  color: var(--primary-hover);
  border-color: rgba(125, 255, 225, 0.28);
  box-shadow: 0 10px 28px -20px rgba(52, 214, 195, 0.7), inset 0 1px 0 rgba(255,255,255,0.08);
}
:root[data-theme="light"] .nav-item.active {
  background:
    linear-gradient(135deg, rgba(15, 139, 127, 0.13), rgba(246, 196, 83, 0.12)),
    rgba(255,255,255,0.72);
  border-color: rgba(15, 139, 127, 0.24);
  box-shadow: 0 12px 28px -22px rgba(15, 139, 127, 0.55), inset 0 1px 0 rgba(255,255,255,0.9);
}
.nav-item:hover .nav-desc,
.nav-item.active .nav-desc {
  color: var(--text-secondary);
}
:root[data-theme="light"] .sidebar-section-label-secondary {
  border-top-color: rgba(15, 23, 42, 0.08);
}
.theme-toggle {
  margin-top: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.theme-toggle:hover {
  background: rgba(52,214,195,0.10);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-hover);
  flex-shrink: 0;
}
.theme-toggle-icon .ui-icon {
  width: 18px;
  height: 18px;
}
.theme-toggle-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smtp-badge {
  margin-top: 8px; font-size: 11.5px; padding: 9px 12px; font-weight: 600;
  border-radius: var(--radius-md); background: rgba(255,255,255,0.045);
  border: 1px solid var(--border-color); color: var(--text-muted);
}
:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .smtp-badge {
  background: rgba(255,255,255,0.62);
  border-color: var(--border-color);
}

/* Content */
.content { flex: 1; padding: 30px 34px; max-width: 1320px; }
h1 { font-size: 1.58rem; font-weight: 800; letter-spacing: 0; margin: 0 0 18px; }
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--border-color);
}
.view-head h1 { margin: 0; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }

/* Action toolbar (above tables/lists, eg Listings & Insight) */
.listings-action-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 12px 14px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  flex-wrap: wrap;
  position: relative; z-index: 50;
  transition: var(--transition-smooth);
}
.listings-action-bar:hover {
  border-color: rgba(125, 255, 225, 0.22);
  box-shadow: 0 15px 35px -16px rgba(52, 214, 195, 0.32);
}

/* Empty state — class chung cho mọi view trống */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 56px 32px; color: var(--text-secondary); gap: 8px;
}
.empty-state-icon { font-size: 44px; opacity: 0.7; margin-bottom: 4px; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.empty-state p { margin: 2px 0; font-size: 13px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.kpi .num { font-size: 28px; font-weight: 700; }
.kpi .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Card / panel — progress-dashboard glass style */
.card {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.072), rgba(255,255,255,0.018) 46%, rgba(52,214,195,0.038)),
    var(--bg-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(142%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(142%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--glass-shadow); margin-bottom: 18px;
  transition: var(--transition-smooth);
}
.card:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 255, 225, 0.28);
  box-shadow: 0 22px 48px -28px rgba(52, 214, 195, 0.45), var(--glass-shadow);
}
:root[data-theme="light"] .card:hover {
  border-color: rgba(15, 139, 127, 0.28);
  box-shadow: 0 22px 48px -32px rgba(15, 139, 127, 0.26), var(--glass-shadow);
}
.card.no-pad { padding: 0; overflow: hidden; }
.card h3 { margin: 0 0 12px; font-weight: 700; font-size: 1rem; letter-spacing: -0.2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border-color); }
.table th {
  color: var(--text-muted); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(0,0,0,0.18);
}
:root[data-theme="light"] .table th {
  background: rgba(15, 139, 127, 0.07);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(52,214,195,0.055); }
:root[data-theme="light"] .table tbody tr:hover { background: rgba(15, 139, 127, 0.08); }
.table td.right, .table th.right { text-align: right; }

/* Buttons — FinFlow gradient + glow */
.btn {
  background: var(--primary-gradient); color: #04120f; border: none;
  padding: 10px 18px; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  box-shadow: 0 12px 28px -18px rgba(52,214,195,0.88), 0 0 0 1px rgba(255,255,255,0.16) inset;
  transition: var(--transition-smooth);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -20px rgba(52,214,195,0.95), 0 0 0 1px rgba(255,255,255,0.24) inset; filter: saturate(1.08); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--primary-gradient); }
.btn.ghost {
  background: rgba(255,255,255,0.045); color: var(--text-primary);
  border: 1px solid var(--border-color); box-shadow: none;
}
:root[data-theme="light"] .btn.ghost {
  background: rgba(255,255,255,0.62);
}
.btn.ghost:hover {
  background: rgba(52,214,195,0.08); border-color: var(--border-hover);
  transform: translateY(-1px); box-shadow: none;
}
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.danger {
  background: var(--danger-glow); color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3); box-shadow: none;
}
.btn.danger:hover { background: rgba(244, 63, 94, 0.25); transform: translateY(-1px); }
.btn.subtle { background: transparent; color: var(--text-secondary); box-shadow: none; }
.btn.subtle:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); transform: none; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Inputs */
.search, input[type=text], input[type=email], input[type=number], select, textarea {
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 10px 13px; font-size: 13.5px; font-family: inherit; width: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.052), rgba(255,255,255,0.018)),
    rgba(0,0,0,0.22);
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="light"] .search,
:root[data-theme="light"] input[type=text],
:root[data-theme="light"] input[type=email],
:root[data-theme="light"] input[type=number],
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.72)),
    rgba(255,255,255,0.64);
}
.search:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), 0 10px 24px -20px rgba(52,214,195,0.8);
}
.search { width: 240px; }
.search::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-surface-solid); color: var(--text-primary); }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.green { background: rgba(52,211,153,0.15); color: var(--green); }
.badge.gray { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge.amber { background: rgba(251,191,36,0.15); color: var(--amber); }
.badge.indigo { background: var(--brand-soft); color: var(--brand); }
.badge.red { background: rgba(251,113,133,0.15); color: var(--red); }

/* Modal — fade + scale animation */
@keyframes modalOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 10, 8, 0.74);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
  animation: modalOverlayIn .2s ease-out;
}
:root[data-theme="light"] .modal-overlay {
  background: rgba(235, 247, 242, 0.72);
}
.modal {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.024) 42%, rgba(52,214,195,0.045)),
    rgba(13, 29, 25, 0.92);
  backdrop-filter: blur(var(--glass-blur)) saturate(142%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(142%);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  width: 100%; max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 28px 80px -34px rgba(0,0,0,0.9), 0 0 48px -28px rgba(52,214,195,0.75);
  animation: modalIn .28s cubic-bezier(.25,.8,.25,1);
}
:root[data-theme="light"] .modal {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.88), rgba(255,255,255,0.64) 42%, rgba(52,214,195,0.10)),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 28px 80px -44px rgba(18,54,45,0.34), 0 0 48px -30px rgba(15,139,127,0.28);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--border-color);
}
.modal-head h3 { margin: 0; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.2px; }
.modal-close {
  background: rgba(255,255,255,0.045); border: 1px solid var(--border-color);
  width: 30px; height: 30px; border-radius: 8px; font-size: 16px; cursor: pointer;
  color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition-smooth);
}
:root[data-theme="light"] .modal-close {
  background: rgba(255,255,255,0.62);
}
.modal-close:hover { background: rgba(52,214,195,0.10); color: var(--text-primary); border-color: var(--border-hover); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border-color);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* Steps / misc */
.steps { margin: 0; padding-left: 20px; line-height: 1.9; }

/* Toast — slide-up + variants */
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.075), rgba(255,255,255,0.02)),
    var(--bg-surface-solid);
  backdrop-filter: blur(var(--glass-blur)) saturate(142%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(142%);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 13px 20px; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500;
  z-index: 100; box-shadow: var(--glass-shadow);
  animation: toastIn .28s cubic-bezier(.25,.8,.25,1);
  max-width: 90vw;
}
.toast.success {
  background: hsla(142, 72%, 45%, 0.15); color: hsl(142, 72%, 60%);
  border-color: hsla(142, 72%, 45%, 0.4);
  box-shadow: 0 8px 24px hsla(142, 72%, 45%, 0.2);
}
.toast.err, .toast.error {
  background: hsla(350, 89%, 60%, 0.15); color: hsl(350, 89%, 70%);
  border-color: hsla(350, 89%, 60%, 0.4);
  box-shadow: 0 8px 24px hsla(350, 89%, 60%, 0.2);
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.list-row { cursor: pointer; }
.list-row.sel { background: var(--brand-soft) !important; }
.chip { display:inline-block; background:rgba(255,255,255,0.06); border-radius:6px; padding:1px 7px; font-size:12px; margin:1px; }

/* ── Stats Bar (Listings) ──────────────────────────────────────────── */
.stats-bar {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.stat-badge {
  flex: 1; min-width: 130px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.stat-num {
  font-size: 26px; font-weight: 700; color: var(--brand);
}
.stat-lbl {
  font-size: 12px; color: var(--muted); text-align: center;
}

/* ── Filter Bar (Listings) ─────────────────────────────────────────── */
.filter-bar {
  margin-bottom: 16px; padding: 14px 18px;
}
.filter-row {
  display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 10px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-group {
  flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 4px;
}
.filter-group label {
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.filter-group input, .filter-group select {
  width: 100%;
}
.search { width: 100% !important; }

/* ── Table meta row ────────────────────────────────────────────────── */
.table-meta {
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}

/* ── Rating stars ──────────────────────────────────────────────────── */
.rating-stars {
  color: var(--warning); font-size: 13px; white-space: nowrap;
}
.rating-stars b { color: var(--text-primary); }

/* ── Pagination ────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 14px;
  border-top: 1px solid var(--line);
}
.page-btn {
  background: var(--brand-soft); color: var(--brand); border: none;
  padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-btn:not(:disabled):hover { filter: brightness(.94); }
.page-info { font-size: 13px; color: var(--muted); }

/* ── Places Cards (Google Search results) ──────────────────────────── */
.places-list {
  display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto;
}
.places-card {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--panel); transition: background .1s;
}
.places-card:hover { background: var(--panel-hover); }
.places-card.imported { opacity: .55; }
.places-card-check { padding-top: 3px; flex-shrink: 0; }
.places-card-info { flex: 1; min-width: 0; }
.places-card-name { font-size: 14px; margin-bottom: 3px; }
.places-card-addr { font-size: 12px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.places-card-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px;
}
.maps-link {
  color: var(--brand); text-decoration: none; font-weight: 500;
}
.maps-link:hover { text-decoration: underline; }

/* ── Error text ─────────────────────────────────────────────────────── */
.err-text { color: var(--red) !important; }

/* ── Places modal wider layout ──────────────────────────────────────── */
.places-modal-inner { display: flex; flex-direction: column; gap: 0; }
/* Widen the modal for tier chips */
#modalOverlay .modal { max-width: 700px; }

/* ── Tier chips selector ────────────────────────────────────────────── */
.tier-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.tier-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1.5px solid transparent; cursor: pointer; user-select: none;
  background: rgba(255,255,255,0.06); color: #8892a4;
  transition: all .15s;
}
.tier-chip:hover {
  background: var(--tier-bg, rgba(59,130,246,0.15));
  color: var(--tier-color, #60a5fa);
  border-color: var(--tier-color, #60a5fa);
}
.tier-chip.active {
  background: var(--tier-bg, rgba(59,130,246,0.15)) !important;
  color: var(--tier-color, #60a5fa) !important;
  border-color: var(--tier-color, #60a5fa) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tier-color, #60a5fa) 15%, transparent);
}

/* ── AI search button ───────────────────────────────────────────────── */
.ai-search-btn {
  background: var(--gradient-purple);
  white-space: nowrap; flex-shrink: 0; padding: 9px 18px;
}
.ai-search-btn:hover { filter: brightness(1.1); }
.ai-search-btn:disabled { opacity: .6; cursor: not-allowed; filter: none; }

/* ── AI / Preset hint strip ─────────────────────────────────────────── */
.ai-hint {
  font-size: 12px; color: var(--muted); margin-top: 8px;
  padding: 6px 10px; background: rgba(255,255,255,0.03); border-radius: 6px; border-left: 3px solid rgba(255,255,255,0.08);
}
.ai-hint code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.ai-hint.ai-on { border-left-color: #8b5cf6; background: rgba(167,139,250,0.15); color: #c4b5fd; }

/* ── Results meta bar ───────────────────────────────────────────────── */
.results-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 10px;
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--gradient-purple);
  color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.preset-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,0.06); color: #8892a4;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
}

/* ── Query details disclosure ───────────────────────────────────────── */
.query-details {
  font-size: 12px; color: var(--muted); margin-left: auto;
}
.query-details summary { cursor: pointer; user-select: none; }
.query-details ul { margin: 4px 0 0 12px; padding: 0; list-style: disc; }
.query-details li { margin: 2px 0; }
.query-details code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; }

/* ── Tier result badge (on each result card) ────────────────────────── */
.tier-result-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid currentColor; margin-left: 6px; vertical-align: middle;
}

/* ── Search loading spinner ─────────────────────────────────────────── */
.places-searching {
  display: flex; align-items: center; gap: 12px;
  padding: 24px; color: var(--muted); font-size: 14px;
}
.search-spinner {
  width: 22px; height: 22px; border: 3px solid rgba(255,255,255,0.08);
  border-top-color: #8b5cf6; border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── places-card-name inline layout ────────────────────────────────── */
.places-card-name {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-size: 14px; margin-bottom: 3px;
}

/* ── Email Finder Modal ─────────────────────────────────────────────── */
.email-finder-modal { display: flex; flex-direction: column; gap: 16px; }
.ef-setup { display: flex; flex-direction: column; gap: 12px; }
.ef-preview {
  font-size: 13px; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border-radius: 8px; border-left: 3px solid var(--brand);
}
.ef-method-info {
  font-size: 13px; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border-radius: 8px;
}

/* ── Progress track ─────────────────────────────────────────────────── */
.progress-track {
  height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden;
  margin: 8px 0;
}
.progress-bar {
  height: 100%; background: var(--primary-gradient);
  border-radius: 999px; transition: width .5s ease;
  min-width: 4px;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ── EF stats row ───────────────────────────────────────────────────── */
.ef-stats { margin-bottom: 4px; }
.ef-stat-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 13px;
}
.ef-kpi { color: var(--muted); }
.ef-kpi b { font-size: 18px; color: var(--ink); }
.ef-kpi.found b { color: var(--green); }
.ef-kpi.failed b { color: var(--muted); }
.ef-kpi.pct b { color: var(--brand); }

/* ── Current listing indicator ──────────────────────────────────────── */
.ef-current {
  font-size: 13px; color: var(--muted); min-height: 20px;
  padding: 4px 0;
}

/* ── Result list ────────────────────────────────────────────────────── */
.ef-results { margin-top: 10px; }
.ef-result-header {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 6px;
}
.ef-result-list {
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.crawl-result-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 10px; border-radius: 8px; font-size: 13px;
}
.crawl-result-row.found { background: rgba(52,211,153,0.10); }
.crawl-result-row.not-found { background: rgba(255,255,255,0.03); }
.crawl-name { font-weight: 500; flex: 1; min-width: 120px; }
.crawl-email { color: var(--green); font-weight: 500; }
.crawl-no-email { font-style: italic; }

/* ── Source badge ───────────────────────────────────────────────────── */
.source-badge {
  display: inline-flex; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.source-badge.green  { background: rgba(52,211,153,0.15); color: var(--green); }
.source-badge.indigo { background: var(--brand-soft); color: var(--brand); }
.source-badge.amber  { background: rgba(251,191,36,0.15); color: var(--amber); }
.source-badge.gray   { background: rgba(255,255,255,0.06); color: var(--muted); }

/* ── QC (Quality Control) Badges ────────────────────────────────────── */
.qc-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  white-space: nowrap; cursor: default;
  border: 1.5px solid transparent;
}
.qc-ok       { background: rgba(52,211,153,0.15); color: #34d399; border-color: rgba(52,211,153,0.30); }
.qc-warning  { background: rgba(251,191,36,0.13); color: #fbbf24; border-color: rgba(251,191,36,0.30); }
.qc-bad      { background: rgba(251,113,133,0.15); color: #fb7185; border-color: rgba(251,113,133,0.30); }
.qc-closed   { background: rgba(255,255,255,0.08); color: #94a3b8; border-color: #cbd5e1; }
.qc-pending  { background: rgba(255,255,255,0.03); color: #94a3b8; border-color: rgba(255,255,255,0.08); }

/* tooltip cho qc issues */
.qc-badge[title] { cursor: help; }

/* ── QC Stats bar cells ──────────────────────────────────────────────── */
.stat-badge.qc-ok-cell     { border-left: 4px solid #34d399; }
.stat-badge.qc-warn-cell   { border-left: 4px solid #fbbf24; }
.stat-badge.qc-bad-cell    { border-left: 4px solid #fb7185; }
.stat-badge.qc-closed-cell { border-left: 4px solid #8892a4; }
.stat-badge.qc-none-cell   { border-left: 4px solid rgba(255,255,255,0.08); }

/* ── QC Modal ────────────────────────────────────────────────────────── */
.qc-modal { display: flex; flex-direction: column; gap: 16px; }
.qc-setup  { display: flex; flex-direction: column; gap: 12px; }
.qc-preview {
  font-size: 13px; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border-radius: 8px; border-left: 3px solid #6366f1;
}
.qc-option-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 10px 14px; background: rgba(251,191,36,0.13); border-radius: 8px;
  border-left: 3px solid #fbbf24;
}
.qc-option-row label { margin: 0; font-size: 13px; color: var(--ink); cursor: pointer; }
.qc-info-box {
  font-size: 12px; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border-radius: 8px; color: var(--muted);
}
.qc-info-box b { color: var(--ink); }
.qc-rule-list { margin: 4px 0 0 0; padding-left: 18px; line-height: 1.9; }

/* ── QC Progress area ───────────────────────────────────────────────── */
.qc-summary {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.qc-kpi { text-align: center; min-width: 60px; }
.qc-kpi b { display: block; font-size: 22px; }
.qc-kpi small { font-size: 11px; color: var(--muted); }
.qc-kpi.ok b     { color: #34d399; }
.qc-kpi.warn b   { color: #fbbf24; }
.qc-kpi.bad b    { color: #fb7185; }
.qc-kpi.closed b { color: #8892a4; }
.qc-kpi.pct b    { color: var(--brand); }

/* ── QC Result list ─────────────────────────────────────────────────── */
.qc-result-list {
  max-height: 280px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px; margin-top: 8px;
}
.qc-result-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px; border-radius: 8px; font-size: 12px;
}
.qc-result-row.ok      { background: rgba(52,211,153,0.10); }
.qc-result-row.warning { background: rgba(251,191,36,0.10); }
.qc-result-row.bad     { background: rgba(251,113,133,0.10); }
.qc-result-row.closed  { background: rgba(255,255,255,0.03); }
.qc-result-name { font-weight: 500; flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-issues-list {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px;
}
.qc-issue-chip {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 4px; background: rgba(251,113,133,0.15); color: #fb7185; font-weight: 500;
}
.qc-issue-chip.warning { background: rgba(251,191,36,0.15); color: #fbbf24; }
.qc-issue-chip.closed  { background: rgba(255,255,255,0.08); color: #94a3b8; }
.qc-current {
  font-size: 13px; color: var(--muted); min-height: 20px; padding: 4px 0;
}

.source-badge.blue   { background: rgba(96,165,250,0.15); color: #60a5fa; }

/* ── Action Bar — Dropdown Groups ───────────────────────────────────── */
.btn-dropdown, .dropdown {
  position: relative;
  display: inline-flex;
}
.dropdown-toggle { gap: 4px; }
.dropdown-toggle .chevron {
  font-size: 10px;
  transition: transform .2s;
  display: inline-block;
}
.dropdown-toggle.active .chevron { transform: rotate(180deg); }

.dropdown-menu {
  display: flex; flex-direction: column; gap: 2px;
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 240px;
  background: var(--bg-surface-solid);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  padding: 6px; z-index: 200;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98);
  transform-origin: top left;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  pointer-events: none;
}
.dropdown-menu.open {
  opacity: 1; visibility: visible; transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}
.dropdown-item:hover {
  background: var(--primary-glow); color: var(--primary);
  transform: translateX(2px);
}

/* ── Stats Bar — 4 KPIs ─────────────────────────────────────────────── */
.stats-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.stat-kpi {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  min-width: 130px; flex: 1;
  box-shadow: var(--glass-shadow);
  position: relative; overflow: hidden;
  transition: var(--transition-smooth);
}
.stat-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary-gradient);
  border-radius: 4px 0 0 4px;
}
.stat-kpi:hover {
  transform: translateY(-4px);
  border-color: rgba(125, 255, 225, 0.28);
  box-shadow: 0 15px 35px -16px rgba(52, 214, 195, 0.38);
}
.kpi-num {
  font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px;
  color: var(--text-primary); line-height: 1;
}
.kpi-lbl {
  font-size: 11px; color: var(--text-muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

/* KPI email — progress bar */
.kpi-email { min-width: 200px; flex: 2; }
.kpi-email-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.kpi-email-count {
  font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1;
}
.kpi-email-count small { font-size: 13px; color: var(--muted); font-weight: 400; }
.kpi-email-pct {
  font-size: 13px; font-weight: 600; color: var(--muted);
}

.kpi-bar-track {
  height: 8px; background: rgba(255,255,255,0.08);
  border-radius: 999px; overflow: hidden;
  margin-bottom: 2px;
}
.kpi-bar-fill {
  height: 100%; border-radius: 999px;
  transition: width .6s ease, background-color .4s;
  min-width: 4px;
}
.kpi-bar-fill.good { background: linear-gradient(90deg, #22c55e, #34d399); }
.kpi-bar-fill.mid  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-bar-fill.low  { background: linear-gradient(90deg, #f87171, #fb7185); }

/* KPI QC */
.kpi-qc { cursor: pointer; transition: box-shadow .2s; }
.kpi-qc:hover { box-shadow: 0 0 0 2px var(--brand); }
.kpi-qc-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.kpi-qc-chip {
  font-size: 13px; font-weight: 600; padding: 2px 6px;
  border-radius: 6px;
}
.kpi-qc-chip.ok     { background: rgba(52,211,153,0.15); color: #34d399; }
.kpi-qc-chip.warn   { background: rgba(251,191,36,0.15); color: #fbbf24; }
.kpi-qc-chip.bad    { background: rgba(251,113,133,0.15); color: #fb7185; }
.kpi-qc-chip.closed { background: rgba(255,255,255,0.06); color: #8892a4; }
.kpi-qc-empty .kpi-qc-row { opacity: .35; }
.kpi-qc-empty::after {
  content: "Chưa QC";
  font-size: 11px; color: var(--muted); font-style: italic;
}

/* ── QC Badge — taxonomy mới (5 trạng thái) ────────────────────────── */
.qc-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.qc-ready      { background: rgba(52,211,153,0.15); color: #34d399; }
.qc-needs      { background: rgba(96,165,250,0.15); color: #60a5fa; }
.qc-suspect    { background: rgba(251,191,36,0.13); color: #fbbf24; border: 1px solid rgba(251,191,36,0.30); }
.qc-nocontact  { background: rgba(255,255,255,0.06); color: #94a3b8; }
.qc-closed     { background: rgba(255,255,255,0.06); color: #94a3b8; }
.qc-pending    { background: rgba(255,255,255,0.03); color: #94a3b8; border: 1px dashed #cbd5e1; }

/* QC chips trong filter dropdown — xoá style cũ */
.qc-ok, .qc-warning, .qc-bad { all: unset; }

/* ── Visual Insight Modal ────────────────────────────────────────────── */
.vi-pipeline {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; margin: 12px 0;
}
.vi-tier {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink);
}
.vi-tier-icon { font-size: 16px; width: 22px; flex-shrink: 0; }
.vi-tier span:nth-child(2) { flex: 1; }
.vi-tier-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px;
}
.vi-tier-badge.best   { background:rgba(52,211,153,0.15); color:#34d399; }
.vi-tier-badge.mid    { background:rgba(96,165,250,0.15); color:#60a5fa; }
.vi-tier-badge.base   { background:rgba(255,255,255,0.06); color:#8892a4; }

.vi-summary {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px;
}
.vi-kpi {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px;
}
.vi-kpi b { font-size: 20px; font-weight: 700; line-height: 1; }
.vi-kpi small { font-size: 11px; color: var(--muted); }

.vi-result-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.vi-result-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  font-size: 13px;
}
.vi-result-row.error { border-color: rgba(251,113,133,0.15); background: rgba(251,113,133,0.10); }
.vi-result-name { font-weight: 600; color: var(--ink); }
.vi-result-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; align-items: center; }
.vi-result-hl   { font-size: 11.5px; color: var(--muted); font-style: italic; }

.vi-badge {
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: 999px; background: rgba(255,255,255,0.06); color: #94a3b8;
}
.vi-src-photo { background: rgba(52,211,153,0.15); color: #34d399; }
.vi-src-web   { background: rgba(96,165,250,0.15); color: #60a5fa; }
.vi-src-inf   { background: rgba(251,191,36,0.13); color: #fbbf24; }

/* ══════════════════════════════════════════════════════════════════════
   INSIGHT TAB — Hang Đôi Production
   ══════════════════════════════════════════════════════════════════════ */

/* Stats bar */
.insight-stats-bar {
  display: flex; gap: 0; flex-wrap: wrap; align-items: center;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 16px 10px 16px 22px; margin-bottom: 18px;
  box-shadow: var(--glass-shadow);
}
.ins-stat { display: flex; align-items: center; gap: 12px; padding: 2px 20px; }
.ins-stat:not(:last-child) { border-right: 1px solid var(--border-color); }
.ins-stat-ico {
  font-size: 18px; line-height: 1;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-glow); color: var(--primary);
  flex-shrink: 0;
}
.ins-stat-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ins-stat-val { font-size: 1.3rem; font-weight: 800; line-height: 1; color: var(--text-primary); letter-spacing: -0.3px; }
.ins-stat-lbl { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* Split layout */
.insight-layout {
  display: grid; grid-template-columns: 25% 1fr; gap: 16px;
  height: calc(100vh - 220px); overflow: hidden;
}

@keyframes pulseGlow {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}
.ins-svc-badge.pulse {
  animation: pulseGlow 1.5s infinite;
}
.insight-list-panel {
  display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
.insight-filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.insight-filters select {
  width: 100%; min-width: 0; font-size: 12.5px;
  border: 1px solid var(--border-color); border-radius: 8px;
  padding: 6px 8px; background: rgba(255, 255, 255, 0.03); color: var(--text-primary);
  text-overflow: ellipsis;
  outline: none;
  font-family: inherit;
  transition: var(--transition-smooth);
}
.insight-filters select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.insight-filters select.full { grid-column: 1 / -1; }
.insight-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.insight-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 24px; color: var(--muted); gap: 4px; }
.ins-empty-ico { font-size: 38px; margin-bottom: 6px; opacity: .85; }
.ins-empty-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.insight-empty p { margin: 2px 0; font-size: 13px; }

.insight-card {
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 12px 14px; cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition-smooth);
}
.insight-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-2px);
}
.insight-card.active {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.ins-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 5px; }
.ins-card-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.ins-svc-badge {
  font-size: 11.5px; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--svc-color) 12%, transparent);
  color: var(--svc-color);
  border: 1px solid color-mix(in srgb, var(--svc-color) 25%, transparent);
}
.ins-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ins-tier, .ins-region, .ins-rating, .ins-email {
  font-size: 11.5px; color: var(--muted);
}
/* Tier variants */
.ins-budget   { color: #94a3b8; }
.ins-midrange { color: #fbbf24; }
.ins-boutique { color: #9333ea; }
.ins-luxury   { color: #60a5fa; }
.ins-ultralux { color: #be185d; }

.ins-fit-bar-row { display: flex; align-items: center; gap: 8px; }
.ins-fit-bar-track { flex: 1; height: 5px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.ins-fit-bar-fill  { height: 100%; border-radius: 99px; transition: width .4s; }
.ins-fit-val { font-size: 11.5px; font-weight: 700; color: var(--muted); min-width: 28px; text-align: right; }
.ins-pain { font-size: 11.5px; color: var(--muted); margin-top: 5px; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Detail panel */
.insight-detail-panel {
  overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
}
.insight-detail-empty, .insight-detail-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 14px; gap: 8px; text-align: center; padding: 24px;
}
.ins-detail { padding: 20px 24px; }

/* Detail header */
.ins-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.ins-detail-name { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.ins-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.ins-confidence { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* Recommended service block */
.ins-rec-service {
  display: flex; align-items: center; gap: 14px;
  background: color-mix(in srgb, var(--svc-color) 8%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--svc-color) 20%, transparent);
  border-radius: 14px; padding: 14px 18px; margin-bottom: 18px;
}
.ins-rec-icon { font-size: 28px; }
.ins-rec-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.ins-rec-angle { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ins-rec-fit { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--svc-color); }

/* Section */
.ins-section { margin-bottom: 18px; }
.ins-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }

/* Fit bars (detail) */
.ins-fit-bars { display: flex; flex-direction: column; gap: 8px; }
.ins-fit-row {
  display: grid; grid-template-columns: 20px 1fr 1fr 32px;
  align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  transition: background .15s;
}
.ins-fit-row.is-rec { background: rgba(59,130,246,0.12); }
.ins-fit-row:hover  { background: rgba(255,255,255,0.03); }
.ins-fit-icon { font-size: 15px; }
.ins-fit-label { font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.rec-badge { font-size: 10.5px; background: #7c3aed; color: #fff; padding: 1px 6px; border-radius: 99px; }
.ins-fit-bar-track.wide { height: 7px; }
.ins-fit-score { font-size: 12.5px; font-weight: 700; text-align: right; }
.ins-fit-score.high { color: #34d399; }
.ins-fit-score.mid  { color: #fbbf24; }
.ins-fit-score.low  { color: #94a3b8; }

/* Email intel grid */
.ins-intel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ins-intel-block {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.ins-intel-block.full { grid-column: 1 / -1; }
.ins-intel-lbl { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px; }
.ins-intel-val { font-size: 13px; color: var(--ink); }
.ins-intel-val.hook { font-style: italic; font-size: 13.5px; color: var(--text-primary); }
.copy-btn { font-size: 11px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer; margin-left: auto; }
.copy-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

/* Digital presence */
.ins-presence-grid { display: flex; flex-direction: column; gap: 8px; }
.ins-pres-item { display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.03); }
.ins-pres-item span:first-child { color: var(--muted); font-weight: 600; min-width: 100px; }
.ins-pres-item a { color: var(--primary); }

/* Visual tags */
.ins-visual-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ins-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.06); color: #94a3b8; border: 1px solid rgba(255,255,255,0.08);
}
.ins-tag.positive { background: rgba(52,211,153,0.15); color: #34d399; border-color: rgba(52,211,153,0.30); }
.ins-tag.negative { background: rgba(251,113,133,0.15); color: #fb7185; border-color: rgba(251,113,133,0.30); }
.ins-tag.freshness-fresh    { background: rgba(52,211,153,0.15); color: #34d399; }
.ins-tag.freshness-moderate { background: rgba(251,191,36,0.13); color: #fbbf24; }
.ins-tag.freshness-stale    { background: rgba(251,113,133,0.15); color: #fb7185; }
.ins-usp { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Sources */
.ins-sources { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ins-src-badge { background: rgba(255,255,255,0.06); color: #94a3b8; padding: 2px 8px; border-radius: 99px; font-size: 11px; }

/* History */
.ins-history { display: flex; flex-direction: column; gap: 4px; }
.ins-history-item { font-size: 12.5px; color: var(--muted); padding: 4px 8px; background: rgba(255,255,255,0.03); border-radius: 6px; }

/* Pagination */
.pagination-bar { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.pg-info { font-size: 12.5px; color: var(--muted); flex: 1; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ── Retainer Fit (GĐ4) ─────────────────────────────────────────────── */
.ins-retainer-badge {
  display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid #c7d2fe;
}
.ins-retainer .ins-ret-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.ins-ret-score { font-size: 14px; color: var(--ink); }
.ins-ret-score b { color: var(--brand); font-size: 17px; }
.ins-ret-note { font-size: 12px; margin-bottom: 4px; }
.ins-cadence-form {
  margin-top: 10px; padding: 12px; border: 1px dashed var(--line);
  border-radius: var(--radius); background: rgba(255,255,255,0.03);
}
.ins-cad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 12px; }
.ins-cad-grid label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.ins-cad-grid input {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink); background: rgba(255,255,255,0.05);
}
.ins-cad-grid input:focus { outline: none; border-color: var(--brand); }
.ins-cad-budget {
  display: flex; align-items: center; gap: 6px; margin: 10px 0;
  font-size: 13px; color: var(--ink); font-weight: 500;
}
.ins-cad-budget input { width: auto; }

/* ── Card badges + email flag (hoàn thiện) ──────────────────────────── */
.ins-card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ins-pattern-badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.12); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3);
}
.ins-mail-flag {
  font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
  letter-spacing: .1px; white-space: nowrap;
}
.ins-mail-flag .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.ins-mail-flag.ok { background: rgba(34, 197, 94, 0.13); color: #4ade80; }
.ins-mail-flag.ok .dot { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.6); }
.ins-mail-flag.no { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.ins-mail-flag.no .dot { background: #64748b; }

/* List footer: limit + pagination cùng dòng */
.insight-list-foot {
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
  border-top: 1px solid var(--border); padding-top: 8px;
}
.ins-limit-sel {
  font-size: 11.5px; padding: 4px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  flex-shrink: 0; width: 95px;
}
.insight-list-foot .pagination-bar { flex: 1; padding: 0; justify-content: flex-end; }
.insight-list-foot .pg-info { text-align: right; font-size: 11.5px; }

/* Stats bar — chống overflow khi top service dài */
.ins-stat-val { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#insTopService .ins-stat-val { font-size: 16px; }
#insJobStatus  .ins-stat-val { font-size: 14px; }
.insight-stats-bar { overflow-x: auto; }

/* Detail header right column (confidence + actions) */
.ins-detail-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ins-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ins-detail-actions .btn.sm { font-size: 12px; padding: 4px 9px; }
.ins-detail-actions .btn.danger {
  color: #fca5a5; border-color: rgba(248, 113, 113, 0.3);
}
.ins-detail-actions .btn.danger:hover {
  background: rgba(248, 113, 113, 0.12); color: #f87171;
}
.ins-web-link {
  font-size: 12px; color: var(--brand); text-decoration: none;
  padding: 2px 8px; border-radius: 999px; background: rgba(59, 130, 246, 0.1);
}
.ins-web-link:hover { background: var(--primary-glow); }
.ins-email.muted { color: var(--text-muted); font-style: italic; }

/* ── Đợt chạy gần đây (GĐ5.1 — Reliability) ─────────────────────────── */
.ins-jobs-panel {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  margin-bottom: 18px; box-shadow: var(--glass-shadow);
  overflow: hidden;
}
.ins-jobs-panel > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; cursor: pointer; user-select: none;
  list-style: none; font-size: 13.5px;
  transition: background .2s;
}
.ins-jobs-panel > summary::-webkit-details-marker { display: none; }
.ins-jobs-panel > summary:hover { background: rgba(255,255,255,0.03); }
.ins-jobs-icon { font-size: 18px; }
.ins-jobs-title { font-weight: 700; color: var(--text-primary); letter-spacing: -0.1px; }
.ins-jobs-summary { color: var(--text-secondary); flex: 1; font-size: 12.5px; }
.ins-jobs-toggle { color: var(--text-muted); font-size: 14px; transition: transform .2s; }
.ins-jobs-panel[open] .ins-jobs-toggle { transform: rotate(180deg); }
.ins-jobs-body { padding: 0 18px 18px; border-top: 1px solid var(--border-color); }
.ins-jobs-loading, .ins-jobs-empty {
  padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px;
}
.ins-jobs-empty code {
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px;
  font-size: 12px; color: var(--primary);
}

/* Totals strip */
.ins-jobs-totals {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0 10px;
  border-bottom: 1px solid var(--border-color); margin-bottom: 10px;
}
.ins-jobs-kpi {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.ins-jobs-kpi b { color: var(--text-primary); font-weight: 700; margin-right: 2px; }
.ins-jobs-kpi.success { background: hsla(142, 72%, 45%, 0.1); border-color: hsla(142, 72%, 45%, 0.25); color: hsl(142, 72%, 60%); }
.ins-jobs-kpi.success b { color: hsl(142, 72%, 70%); }
.ins-jobs-kpi.error   { background: hsla(350, 89%, 60%, 0.1); border-color: hsla(350, 89%, 60%, 0.25); color: hsl(350, 89%, 70%); }
.ins-jobs-kpi.error b { color: hsl(350, 89%, 75%); }
.ins-jobs-kpi.cost    { background: var(--primary-glow); border-color: hsla(217, 91%, 60%, 0.3); color: var(--primary); }
.ins-jobs-kpi.cost b  { color: hsl(217, 91%, 75%); }

/* Job table */
.ins-jobs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ins-jobs-table th, .ins-jobs-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-color);
}
.ins-jobs-table th {
  color: var(--text-muted); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.4px;
  background: rgba(0,0,0,0.15);
}
.ins-jobs-table tr:last-child td { border-bottom: none; }
.ins-jobs-table tr:hover td { background: rgba(255,255,255,0.02); }
.ins-jobs-table td.num { font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.ins-job-row.error td { background: hsla(350, 89%, 60%, 0.04); }
.ins-job-row.skipped td { opacity: 0.7; }

.job-time { display: block; color: var(--text-primary); font-weight: 600; }
.job-dur { display: block; color: var(--text-muted); font-size: 11px; margin-top: 1px; }
.job-badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-weight: 700; font-size: 11px; letter-spacing: 0.3px;
}
.job-badge.ok      { background: hsla(142,72%,45%,0.15); color: hsl(142,72%,65%); }
.job-badge.warn    { background: hsla(38, 92%, 50%, 0.15); color: hsl(38, 92%, 65%); }
.job-badge.skipped { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.job-badge.idle    { background: rgba(255,255,255,0.04); color: var(--text-muted); font-style: italic; }
.job-reap {
  margin-left: 4px; padding: 2px 7px; border-radius: 999px;
  background: hsla(270, 85%, 60%, 0.15); color: hsl(270, 85%, 70%);
  font-size: 10.5px; font-weight: 700;
}
.job-errs > summary {
  cursor: pointer; color: var(--text-secondary); font-size: 11.5px;
  list-style: disclosure-closed;
}
.job-errs[open] > summary { list-style: disclosure-open; color: var(--danger); }
.job-err-row {
  padding: 4px 0 4px 14px; font-size: 11px; color: var(--text-secondary);
  border-left: 2px solid hsla(350, 89%, 60%, 0.3); margin: 2px 0;
}
.job-err-row b { color: var(--text-primary); }

/* GĐ5.2 — Provider chip + cache + force refresh ──────────────────── */
.ins-stat.ins-stat-clickable { cursor: pointer; transition: background .15s; }
.ins-stat.ins-stat-clickable:hover { background: rgba(255,255,255,0.04); border-radius: var(--radius-md); }

.btn.warn {
  background: var(--warning-glow); color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3); box-shadow: none;
}
.btn.warn:hover { background: rgba(245, 158, 11, 0.25); transform: translateY(-1px); }

/* Job table extra cells */
.job-provider {
  display: inline-block; margin-right: 4px;
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--primary-glow); color: var(--primary); font-weight: 600;
}
.cache-hit {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: hsla(142, 72%, 45%, 0.12); color: hsl(142, 72%, 65%);
  font-size: 11px; font-weight: 700;
}

/* Provider modal */
.prv-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.prv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
}
.prv-rank {
  font-size: 12px; font-weight: 800; color: var(--text-muted);
  background: rgba(255,255,255,0.05); padding: 4px 8px; border-radius: 6px;
}
.prv-icon { font-size: 22px; line-height: 1; }
.prv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.prv-name { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.prv-name code {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: rgba(255,255,255,0.05); color: var(--text-muted); margin-left: 6px;
}
.prv-badge {
  align-self: flex-start; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  font-weight: 600;
}
.prv-badge.ok      { background: hsla(142,72%,45%,0.15); color: hsl(142,72%,65%); }
.prv-badge.cooling { background: hsla(38, 92%, 50%, 0.15); color: hsl(38, 92%, 70%); }
.prv-badge.nokey   { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.prv-badge.err     { background: hsla(350, 89%, 60%, 0.15); color: hsl(350, 89%, 70%); }
.prv-err { font-size: 11px; color: var(--danger); margin-top: 2px; }
.prv-ok  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.prv-uses { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.prv-in-chain {
  display: inline-block; padding: 1px 6px; border-radius: 99px;
  background: rgba(255,255,255,0.05); font-size: 10.5px; font-weight: 600;
  margin-right: 4px; color: var(--text-secondary);
}

/* GĐ2 Refine — Chain per task */
.prv-task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.prv-task-row {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 12px 14px;
}
.prv-task-head {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px;
}
.prv-task-ico { font-size: 22px; line-height: 1; flex-shrink: 0; }
.prv-task-head > div { flex: 1; min-width: 0; }
.prv-task-name { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.prv-task-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.prv-task-env {
  font-size: 10px; background: rgba(255,255,255,0.05); padding: 3px 7px;
  border-radius: 4px; color: var(--primary); white-space: nowrap;
}

.prv-chain-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.2); padding: 10px; border-radius: var(--radius-sm);
}
.prv-chain-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-color);
  color: var(--text-primary); font-weight: 600;
}
.prv-chain-chip.ok      { background: hsla(142,72%,45%,0.1);  border-color: hsla(142,72%,45%,0.3);  color: hsl(142,72%,75%); }
.prv-chain-chip.cooling { background: hsla(38,92%,50%,0.1);   border-color: hsla(38,92%,50%,0.3);   color: hsl(38,92%,70%); }
.prv-chain-chip.nokey   { background: rgba(255,255,255,0.03); border-color: var(--border-color);    color: var(--text-muted); }
.prv-chain-rank {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,0.08); color: var(--text-muted); font-weight: 700;
}
.prv-chain-model {
  font-size: 10px; color: var(--text-muted); margin-left: 4px;
  font-variant: small-caps; opacity: 0.85;
}
.prv-chain-arrow { color: var(--text-muted); font-size: 14px; user-select: none; }

.prv-section-title {
  font-size: 13px; font-weight: 700; margin: 6px 0 10px;
  color: var(--text-primary); display: flex; align-items: center; gap: 8px;
}
.prv-cache-totals { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cache-pill {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.cache-pill b { color: var(--text-primary); margin-right: 2px; }
.cache-pill.success { background: hsla(142,72%,45%,0.12); border-color: hsla(142,72%,45%,0.3); color: hsl(142,72%,65%); }
.cache-pill.success b { color: hsl(142,72%,75%); }
.cache-pill.primary { background: var(--primary-glow); border-color: hsla(217, 91%, 60%, 0.3); color: var(--primary); }
.cache-pill.primary b { color: hsl(217, 91%, 75%); }

.cache-layers { display: flex; flex-direction: column; gap: 4px; }
.cache-layer-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: rgba(255,255,255,0.02); border-radius: 6px;
  font-size: 12px;
}
.cache-layer-row code {
  background: rgba(255,255,255,0.06); padding: 1px 7px; border-radius: 4px;
  color: var(--primary); font-size: 11.5px;
}
.cache-meta { color: var(--text-muted); font-size: 11.5px; }

/* GĐ5.3 — AI Cadence Vision: upload zone + result modal */
.cad-source-badge {
  display: inline-block; margin-left: 8px;
  font-size: 10.5px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; vertical-align: middle;
  text-transform: none; letter-spacing: 0;
}
.cad-source-badge.ai     { background: var(--primary-glow); color: var(--primary); border: 1px solid hsla(217,91%,60%,0.3); }
.cad-source-badge.manual { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-color); }

.cad-upload-zone {
  border: 1.5px dashed var(--border-color); border-radius: var(--radius-md);
  padding: 12px; background: rgba(255,255,255,0.02);
  transition: border-color .2s, background .2s;
}
.cad-upload-zone.drag    { border-color: var(--primary); background: var(--primary-glow); }
.cad-upload-zone.loading { opacity: .7; pointer-events: none; }
.cad-upload-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-secondary);
}
.cad-upload-head b { color: var(--text-primary); }
.cad-channel-sel {
  width: auto !important; font-size: 12px; padding: 4px 8px !important;
  border-radius: var(--radius-sm) !important;
}
.cad-upload-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: rgba(255,255,255,0.03); transition: background .15s;
  border: 1px solid var(--border-color);
}
.cad-upload-btn:hover { background: var(--primary-glow); border-color: hsla(217, 91%, 60%, 0.3); }
.cad-upload-btn > span:first-of-type { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.cad-upload-hint { font-size: 11px; color: var(--text-muted); }

/* AI result modal */
.cad-ai-result { display: flex; flex-direction: column; gap: 12px; }
.cad-ai-source { font-size: 11.5px; color: var(--text-muted); }
.cad-ai-stats { display: flex; gap: 8px; }
.cad-ai-stat {
  flex: 1; text-align: center; padding: 14px 12px;
  border-radius: var(--radius-md); background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 4px;
}
.cad-ai-stat b { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.cad-ai-stat small { font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; font-weight: 700; }
.cad-ai-stat.primary { background: var(--primary-glow); border-color: hsla(217, 91%, 60%, 0.3); }
.cad-ai-stat.primary b { color: hsl(217, 91%, 75%); }

.cad-ai-range, .cad-ai-notes, .cad-ai-explain {
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02); border-left: 3px solid var(--border-color);
}
.cad-ai-range span { color: var(--text-muted); margin-right: 4px; }
.cad-ai-notes { border-left-color: var(--primary); color: var(--text-secondary); }
.cad-ai-explain { border-left-color: var(--purple); color: var(--text-secondary); }

.cad-ai-suggest-title { font-weight: 700; margin-top: 4px; color: var(--text-primary); font-size: 13.5px; }
.cad-ai-suggest {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px; background: hsla(142, 72%, 45%, 0.08);
  border: 1px solid hsla(142, 72%, 45%, 0.25); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary);
}
.cad-ai-suggest b { color: hsl(142, 72%, 70%); font-size: 1.05rem; font-weight: 800; margin-right: 4px; }
.cad-ai-cost {
  font-size: 11px; color: var(--text-muted); text-align: center;
  font-variant-numeric: tabular-nums; padding-top: 4px;
}

/* GĐ5.3 Refine — Preview thumbnail trong upload zone */
.cad-upload-zone.has-preview { padding: 8px; }
.cad-preview {
  display: flex; gap: 12px; align-items: center;
  padding: 8px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  position: relative;
}
.cad-thumb {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border-color); flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.cad-preview-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cad-preview-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cad-preview-meta { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cad-saved {
  margin-left: 6px; padding: 1px 7px; border-radius: 99px;
  background: hsla(142,72%,45%,0.15); color: hsl(142,72%,65%);
  font-size: 10.5px; font-weight: 600;
}
.cad-preview-status { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.cad-preview-status b { color: hsl(217, 91%, 75%); }
.cad-preview-clear {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.4); border: 1px solid var(--border-color);
  color: var(--text-secondary); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; transition: var(--transition-smooth);
}
.cad-preview-clear:hover { background: var(--danger); color: #fff; }

/* GĐ5.3 Refine — History uploads list */
.ins-section-count { font-size: 11.5px; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.cad-history-list { display: flex; flex-direction: column; gap: 6px; }
.cad-h-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02); border: 1px solid var(--border-color);
  transition: border-color .15s, background .15s;
}
.cad-h-row:hover { border-color: var(--border-hover); }
.cad-h-row.applied { border-left: 3px solid hsl(142, 72%, 45%); }
.cad-h-thumb {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border-color); flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.cad-h-info { flex: 1; min-width: 0; }
.cad-h-head {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 12px; margin-bottom: 2px;
}
.cad-h-ch {
  font-weight: 700; color: var(--text-primary); font-size: 11.5px;
  padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,0.05);
}
.cad-h-ok  { font-size: 11.5px; color: hsl(142, 72%, 65%); font-weight: 600; }
.cad-h-err { font-size: 11.5px; color: var(--danger); font-weight: 600; }
.cad-h-cost {
  font-size: 10.5px; padding: 1px 6px; border-radius: 99px;
  background: var(--primary-glow); color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.cad-h-time { font-size: 10.5px; color: var(--text-muted); }
.cad-h-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.cad-h-applied {
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  background: hsla(142,72%,45%,0.15); color: hsl(142,72%,65%);
  border: 1px solid hsla(142, 72%, 45%, 0.3);
}

/* =========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================= */
@media (max-width: 1100px) {
  .insight-layout { grid-template-columns: 320px 1fr; gap: 12px; height: calc(100vh - 200px); }
  .content { padding: 24px 22px; }
  .ins-detail-actions { gap: 4px; }
}

@media (max-width: 880px) {
  .sidebar { width: 200px; padding: 16px 10px; }
  .nav-item { font-size: 13px; padding: 10px 12px; }
  .nav-title { font-size: 13px; }
  .nav-desc { font-size: 10.5px; }
  .insight-layout {
    grid-template-columns: 1fr; height: auto; overflow: visible;
  }
  .insight-list-panel { max-height: 60vh; }
  .insight-detail-panel { min-height: 400px; }
  .stats-bar, .insight-stats-bar { padding: 12px; }
  .ins-stat { padding: 2px 12px; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { display: block; }
  .sidebar {
    width: 100%; height: auto; min-height: auto; position: sticky;
    top: 0; padding: 12px 14px; border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row; align-items: center; gap: 8px;
    overflow-x: auto;
  }
  .brand { padding: 4px 8px; margin: 0; border-bottom: none; font-size: 14px; }
  .brand { flex-shrink: 0; min-width: 116px; gap: 8px; }
  .logo-icon { width: 32px; height: 32px; }
  .logo-icon svg { width: 18px; height: 18px; }
  .logo-text h1 { font-size: 12px; white-space: nowrap; letter-spacing: 0.05em; }
  .logo-text p { display: none; }
  .sidebar-nav { flex-direction: row; gap: 4px; align-items: stretch; }
  .sidebar-section-label { display: none; }
  .nav-item {
    padding: 6px 10px; font-size: 12.5px; white-space: nowrap;
    border-left: none; border-bottom: 2px solid transparent; margin: 0; border-radius: 8px;
  }
  .nav-item-main,
  .nav-item-secondary {
    align-items: center;
    padding: 6px 10px;
  }
  .nav-copy {
    display: block;
  }
  .nav-title {
    font-size: 12.5px;
    font-weight: 600;
  }
  .nav-desc {
    display: none;
  }
  .nav-item.active { border-left-color: transparent; border-bottom-color: var(--primary); }
  .theme-toggle {
    width: auto;
    margin-top: 0;
    padding: 6px 10px;
    flex-shrink: 0;
  }
  .theme-toggle-label { display: none; }
  .smtp-badge { display: none; }
  .content { padding: 16px 14px; max-width: 100%; }
  h1 { font-size: 1.25rem; }
  .insight-filters { grid-template-columns: 1fr; }
  .modal { max-height: 95vh; border-radius: var(--radius-md); }
  .modal-body { padding: 16px; }
  .toast { bottom: 16px; padding: 11px 16px; font-size: 13px; }
  .listings-action-bar { flex-wrap: wrap; gap: 6px; }
}

/* =========================================================================
   GĐ6: SEASON STRATEGY & AI EMAIL DRAFTING
   ========================================================================= */

/* Season plans grid & cards */
.season-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.season-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
  cursor: pointer;
}
.season-card:hover {
  transform: translateY(-4px);
  border-color: rgba(125, 255, 225, 0.32);
  box-shadow: var(--glass-shadow), 0 18px 32px -24px rgba(52, 214, 195, 0.44);
}
.variant-item-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
}
.variant-item-card:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.3) !important;
  box-shadow: var(--shadow-md), 0 0 15px rgba(167, 139, 250, 0.06);
}
.season-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.season-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.2px;
}
.season-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.season-card-angle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
}
.season-card-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
  padding-top: 12px;
  justify-content: flex-end;
}

/* Campaign details & filters */
.campaign-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.campaign-detail-header.running {
  border-color: rgba(52, 214, 195, 0.28);
  box-shadow: 0 24px 54px -36px rgba(13, 148, 136, 0.42), 0 0 0 1px rgba(52, 214, 195, 0.08);
}
.campaign-detail-header.running::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #16a34a 0%, #2dd4bf 55%, #facc15 100%);
}
.campaign-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(45, 212, 191, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.campaign-live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.12);
}
.campaign-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.campaign-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}
.campaign-summary-chip strong {
  color: var(--text-primary);
  font-size: 13px;
}
.campaign-summary-chip.attention {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.18);
  color: #f59e0b;
}
.campaign-summary-chip.ok {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.18);
  color: #10b981;
}
:root[data-theme="light"] .campaign-detail-header.running {
  border-color: rgba(13, 148, 136, 0.24);
  box-shadow: 0 24px 54px -40px rgba(15, 118, 110, 0.25), 0 0 0 1px rgba(13, 148, 136, 0.08);
}
:root[data-theme="light"] .campaign-live-pill {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(14, 165, 233, 0.08));
  border-color: rgba(16, 185, 129, 0.18);
  color: #047857;
}
:root[data-theme="light"] .campaign-summary-chip {
  background: rgba(255,255,255,0.68);
  border-color: rgba(15, 23, 42, 0.08);
  color: #52606d;
}
:root[data-theme="light"] .campaign-summary-chip strong {
  color: #102a24;
}
:root[data-theme="light"] .campaign-summary-chip.attention {
  background: rgba(254, 243, 199, 0.92);
  border-color: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
:root[data-theme="light"] .campaign-summary-chip.ok {
  background: rgba(220, 252, 231, 0.9);
  border-color: rgba(16, 185, 129, 0.16);
  color: #047857;
}
.outreach-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  align-items: flex-end;
}
.outreach-preview-text {
  border-top: 1px dashed rgba(255,255,255,0.06);
  padding-top: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 980px) {
  .campaign-detail-header {
    flex-direction: column;
  }
  .campaign-action-panel {
    width: 100%;
    flex-wrap: wrap;
  }
  .campaign-action-panel .btn {
    flex: 1 1 180px;
  }
}

/* Card tabs styling */
.card-header-tabs {
  background: rgba(255,255,255,0.01);
  padding: 0 16px;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}
.card-header-tabs .tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  outline: none;
  font-family: inherit;
}
.card-header-tabs .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.02);
}
.card-header-tabs .tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Split-screen modal for email editing */
.email-editor-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  height: 60vh;
  min-height: 450px;
}
.email-editor-sidebar {
  border-right: 1px solid rgba(255,255,255,0.06);
  padding-right: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.email-editor-sidebar h4 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.email-editor-sidebar .info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.email-editor-sidebar .info-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.email-editor-sidebar .info-val {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}
.email-editor-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
}
.email-editor-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.email-editor-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.email-editor-form input,
.email-editor-form textarea {
  width: 100%;
}
.email-editor-form textarea {
  flex-grow: 1;
  min-height: 250px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .email-editor-split {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 70vh;
  }
  .email-editor-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-right: 0;
    padding-bottom: 16px;
    height: 150px;
  }
}

/* =========================================================================
   GĐ7: SEASON STRATEGY SEQUENCE FLOWCHART DIAGRAM
   ========================================================================= */
.sequence-flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  gap: 8px;
  backdrop-filter: blur(10px);
}

.flow-node {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  min-width: 90px;
}

.flow-node:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(125, 255, 225, 0.30);
  transform: translateY(-2px);
}

.flow-node.active {
  background: rgba(52, 214, 195, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 18px rgba(52, 214, 195, 0.22);
}

.flow-node.active .node-title {
  color: var(--primary-hover);
}

.flow-node.draft {
  border-color: rgba(255, 255, 255, 0.15);
}

.flow-node.approved {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.05);
}

.flow-node.sending {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.05);
}

.flow-node.sent {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.05);
}

.flow-node.opened {
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.05);
}

.flow-node.replied {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.flow-node.skipped {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
  opacity: 0.45;
}

.flow-node.failed {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.05);
}

.node-icon {
  font-size: 16px;
  margin-bottom: 3px;
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.1));
}

.node-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
}

.node-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.flow-node.draft .node-status-badge { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.flow-node.approved .node-status-badge { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.flow-node.sending .node-status-badge { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.flow-node.sent .node-status-badge { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.flow-node.opened .node-status-badge { background: rgba(192, 132, 252, 0.15); color: #c084fc; }
.flow-node.replied .node-status-badge { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.flow-node.skipped .node-status-badge { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.flow-node.failed .node-status-badge { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.node-time {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 0.3;
  min-width: 30px;
}

.connector-line {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
}

.flow-connector.active .connector-line {
  background: var(--primary);
  box-shadow: 0 0 8px rgba(52, 214, 195, 0.42);
}

.connector-delay {
  font-size: 8.5px;
  color: var(--text-muted);
  position: absolute;
  top: -14px;
  white-space: nowrap;
  font-weight: 700;
  background: rgba(20,20,30,0.85);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.04);
}

.flow-connector.active .connector-delay {
  color: var(--primary-hover);
  border-color: rgba(125, 255, 225, 0.24);
}

.connector-arrow {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.2);
  position: absolute;
  right: -1px;
  transform: translateY(-50%);
  top: 50%;
}

.flow-connector.active .connector-arrow {
  color: var(--primary);
}



/* ──────────────────────────────────────────────────────────────────────────
   AUTH (task 1.1) — User widget trong sidebar + bảng quản lý user
   ────────────────────────────────────────────────────────────────────────── */
.user-widget {
  margin-top: 12px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(52, 214, 195, 0.28), rgba(246, 196, 83, 0.18));
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(125, 255, 225, 0.24);
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-meta {
  min-width: 0;
  flex: 1;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.user-action {
  width: 32px; height: 32px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.user-action:hover {
  background: rgba(52, 214, 195, 0.10);
  color: var(--primary-hover);
  border-color: rgba(125, 255, 225, 0.30);
}

/* Ẩn các nút sửa hàng loạt khi không có quyền ghi */
body:not(.can-edit) .edit-only { display: none !important; }
body.is-guest .guest-hidden    { display: none !important; }

/* Trạng thái role trong bảng users */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-badge.admin  { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.role-badge.editor { background: rgba(52, 214, 195, 0.15);  color: var(--primary-hover); }
.role-badge.viewer { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

/* =========================================================================
   LIQUID BRAND CONSOLIDATION
   ========================================================================= */
.kpi,
.stat-kpi,
.stat-badge,
.listings-action-bar,
.filter-bar,
.insight-stats-bar,
.ins-jobs-panel,
.insight-detail-panel,
.insight-card,
.ins-intel-block,
.ins-rec-service,
.vi-pipeline,
.vi-kpi,
.vi-result-row,
.prv-row,
.prv-task-row,
.cad-ai-stat,
.cad-upload-zone,
.cad-preview,
.cad-h-row,
.season-card,
.variant-item-card,
.sequence-flow-diagram,
.flow-node {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.068), rgba(255,255,255,0.018) 50%, rgba(52,214,195,0.035)),
    rgba(13, 31, 27, 0.56);
  border-color: var(--border-color);
  box-shadow: var(--glass-shadow);
}

.kpi,
.stat-kpi,
.listings-action-bar,
.filter-bar,
.insight-stats-bar,
.ins-jobs-panel,
.insight-detail-panel,
.dropdown-menu {
  backdrop-filter: blur(var(--glass-blur)) saturate(142%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(142%);
}

.kpi .num,
.stat-num,
.kpi-num,
.ins-stat-val {
  color: var(--text-primary);
  text-shadow: 0 0 22px rgba(52, 214, 195, 0.16);
}

.stat-kpi::before {
  background: linear-gradient(180deg, var(--primary), var(--liquid-warm));
}

.dropdown-menu {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.078), rgba(255,255,255,0.022)),
    rgba(10, 24, 21, 0.94);
}

.dropdown-item:hover,
.copy-btn:hover,
.page-btn:not(:disabled):hover {
  background: rgba(52, 214, 195, 0.10);
  color: var(--primary-hover);
}

.progress-bar,
.kpi-bar-fill,
.kpi-bar-fill.good,
.kpi-bar-fill.mid,
.kpi-bar-fill.low {
  background: var(--primary-gradient);
  box-shadow: 0 0 18px rgba(52, 214, 195, 0.24);
}

.ai-search-btn,
.ai-badge {
  background: linear-gradient(135deg, #4c3a99, var(--purple) 55%, #ff8db2);
}

.source-badge.blue,
.qc-needs,
.vi-tier-badge.mid,
.vi-src-web,
.ins-luxury,
.flow-node.approved .node-status-badge {
  color: var(--primary-hover);
}

.source-badge.blue,
.qc-needs,
.vi-tier-badge.mid,
.vi-src-web,
.flow-node.approved .node-status-badge {
  background: rgba(52, 214, 195, 0.14);
}

.ins-web-link,
.job-provider,
.cache-pill.primary,
.cad-source-badge.ai,
.cad-h-cost {
  background: rgba(52, 214, 195, 0.12);
  border-color: rgba(125, 255, 225, 0.28);
  color: var(--primary-hover);
}

.connector-delay {
  background: rgba(8, 19, 16, 0.88);
  border-color: var(--border-color);
}

/* Light theme readability pass — keep the liquid language without dark glass wash. */
:root[data-theme="light"] {
  color-scheme: light;
}
:root:not([data-theme="light"]) {
  color-scheme: dark;
}
:root[data-theme="light"] .card,
:root[data-theme="light"] .kpi,
:root[data-theme="light"] .stat-kpi,
:root[data-theme="light"] .stat-badge,
:root[data-theme="light"] .listings-action-bar,
:root[data-theme="light"] .filter-bar,
:root[data-theme="light"] .insight-stats-bar,
:root[data-theme="light"] .ins-jobs-panel,
:root[data-theme="light"] .insight-detail-panel,
:root[data-theme="light"] .insight-card,
:root[data-theme="light"] .ins-intel-block,
:root[data-theme="light"] .ins-rec-service,
:root[data-theme="light"] .vi-pipeline,
:root[data-theme="light"] .vi-kpi,
:root[data-theme="light"] .vi-result-row,
:root[data-theme="light"] .prv-row,
:root[data-theme="light"] .prv-task-row,
:root[data-theme="light"] .cad-ai-stat,
:root[data-theme="light"] .cad-upload-zone,
:root[data-theme="light"] .cad-preview,
:root[data-theme="light"] .cad-h-row,
:root[data-theme="light"] .season-card,
:root[data-theme="light"] .variant-item-card,
:root[data-theme="light"] .sequence-flow-diagram,
:root[data-theme="light"] .flow-node,
:root[data-theme="light"] #view-crm-deals .kanban-column,
:root[data-theme="light"] #view-crm-deals .crm-card {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.92), rgba(255,255,255,0.70) 52%, rgba(52,214,195,0.09)),
    rgba(255,255,255,0.78) !important;
  border-color: rgba(14, 95, 80, 0.16) !important;
  box-shadow: 0 18px 42px -34px rgba(18, 54, 45, 0.32), inset 0 1px 0 rgba(255,255,255,0.86) !important;
  color: var(--text-primary);
}
:root[data-theme="light"] .kpi,
:root[data-theme="light"] .stat-kpi,
:root[data-theme="light"] .stat-badge {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.86), rgba(235,248,244,0.82) 48%, rgba(52,214,195,0.12)),
    rgba(255,255,255,0.80) !important;
}
:root[data-theme="light"] .filter-bar,
:root[data-theme="light"] .listings-action-bar,
:root[data-theme="light"] .insight-stats-bar,
:root[data-theme="light"] .vi-pipeline,
:root[data-theme="light"] #view-crm-deals .kanban-column {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.90), rgba(239,249,245,0.82)),
    rgba(255,255,255,0.78) !important;
}
:root[data-theme="light"] .insight-detail-panel {
  min-height: 520px;
}
:root[data-theme="light"] .kpi .num,
:root[data-theme="light"] .stat-num,
:root[data-theme="light"] .kpi-num,
:root[data-theme="light"] .ins-stat-val {
  color: #10251f;
  text-shadow: none;
}
:root[data-theme="light"] .kpi .lbl,
:root[data-theme="light"] .kpi-lbl,
:root[data-theme="light"] .stat-lbl,
:root[data-theme="light"] .ins-stat-lbl,
:root[data-theme="light"] .muted,
:root[data-theme="light"] .hint {
  color: #557268;
}
:root[data-theme="light"] .progress-track,
:root[data-theme="light"] .kpi-bar-track,
:root[data-theme="light"] .ins-fit-bar-track {
  background: rgba(14, 95, 80, 0.12);
}
:root[data-theme="light"] .dropdown-menu {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.94), rgba(242,250,247,0.88)),
    rgba(255,255,255,0.92) !important;
  border-color: rgba(14, 95, 80, 0.16);
  box-shadow: 0 18px 42px -30px rgba(18, 54, 45, 0.28);
}
:root[data-theme="light"] .badge.gray,
:root[data-theme="light"] .source-badge.gray,
:root[data-theme="light"] .qc-closed,
:root[data-theme="light"] .qc-pending,
:root[data-theme="light"] .kpi-qc-chip.closed,
:root[data-theme="light"] .qc-nocontact,
:root[data-theme="light"] .qc-pending,
:root[data-theme="light"] .vi-tier-badge.base,
:root[data-theme="light"] .preset-badge {
  background: rgba(16, 37, 31, 0.07) !important;
  color: #557268 !important;
  border-color: rgba(14, 95, 80, 0.14) !important;
}
:root[data-theme="light"] .badge.green,
:root[data-theme="light"] .source-badge.green,
:root[data-theme="light"] .qc-ok,
:root[data-theme="light"] .qc-ready,
:root[data-theme="light"] .vi-tier-badge.best,
:root[data-theme="light"] .ins-mail-flag.ok,
:root[data-theme="light"] .job-badge.ok {
  color: #0f8f66 !important;
}
:root[data-theme="light"] .badge.amber,
:root[data-theme="light"] .source-badge.amber,
:root[data-theme="light"] .qc-warning,
:root[data-theme="light"] .qc-suspect,
:root[data-theme="light"] .vi-src-inf,
:root[data-theme="light"] .job-badge.warn {
  color: #b17405 !important;
}
:root[data-theme="light"] .badge.red,
:root[data-theme="light"] .qc-bad,
:root[data-theme="light"] .qc-issue-chip,
:root[data-theme="light"] .ins-tag.negative,
:root[data-theme="light"] .job-badge.error {
  color: #c7335a !important;
}
:root[data-theme="light"] .season-card > div:last-child,
:root[data-theme="light"] #view-crm-deals .crm-card [style*="border-top"] {
  border-top-color: rgba(14, 95, 80, 0.12) !important;
}
:root[data-theme="light"] .season-card:hover,
:root[data-theme="light"] .insight-card:hover,
:root[data-theme="light"] #view-crm-deals .crm-card:hover {
  border-color: rgba(15, 139, 127, 0.30) !important;
  box-shadow: 0 22px 46px -32px rgba(15, 139, 127, 0.34), inset 0 1px 0 rgba(255,255,255,0.86) !important;
}
:root[data-theme="light"] #view-crm-deals .crm-kanban-board {
  gap: 12px !important;
}
:root[data-theme="light"] #view-crm-deals .kanban-column {
  flex: 1 0 220px !important;
  min-width: 220px;
  max-width: 280px;
}
:root[data-theme="light"] #view-crm-deals .kanban-cards-container > div:not(.crm-card) {
  background: rgba(255,255,255,0.44) !important;
  border-color: rgba(14, 95, 80, 0.16) !important;
  color: #6d8880 !important;
}
:root[data-theme="light"] #view-crm-deals .crm-card [style*="background:rgba(255,255,255,0.03)"],
:root[data-theme="light"] #view-crm-deals .crm-card [style*="background: rgba(255,255,255,0.03)"] {
  background: rgba(15, 139, 127, 0.07) !important;
}
:root[data-theme="light"] #view-crm-deals .crm-card [style*="rgba(56, 189, 248, 0.05)"] {
  background: rgba(15, 139, 127, 0.08) !important;
  border-color: rgba(15, 139, 127, 0.16) !important;
}
:root[data-theme="light"] .connector-delay {
  background: rgba(255,255,255,0.88);
  color: var(--text-secondary);
}
