/**
 * DataBank Phase 2 — Global Enterprise Foundation Stylesheet
 * Standardized across Manager & Executive Portals
 * Source Design Reference: extra/DataBank_Phase2_System_11 1.html
 * 
 * Rules:
 *  - 100% Non-destructive: preserves existing layout, dropdowns, tables, and modal functionality.
 *  - 60% / 30% / 10% Color Balance.
 *  - Full Design Token System (CSS Variables).
 *  - High-precision Typography (Space Grotesk, IBM Plex Sans, IBM Plex Mono, Plus Jakarta Sans).
 */

/* ==========================================================================
   1. GOOGLE WEB FONTS
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   2. DESIGN TOKENS & CSS VARIABLES
   ========================================================================== */
:root {
  /* Colors - 60/30/10 Rule */
  --bg-color: #F8FAFC;         /* 60% Neutral Backgrounds */
  --surface-color: #FFFFFF;    /* 30% Primary Surfaces */
  --primary-color: #4F46E5;    /* 10% Accent/Primary */
  
  --secondary-color: #64748B;
  --accent-color: #4F46E5;
  --success-color: #22C55E;
  --warning-color: #F59E0B;
  --danger-color: #EF4444;
  --info-color: #3B82F6;
  
  /* Text Colors */
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  
  /* Border & States */
  --border-color: #E5E7EB;
  --hover-color: #F1F5F9;
  --active-color: #E2E8F0;
  --disabled-bg: #F3F4F6;
  --disabled-text: #9CA3AF;
  
  /* Component Backgrounds */
  --card-bg: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --navbar-bg: #FFFFFF;

  /* Typography Scale */
  --font-family: 'IBM Plex Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;

  --font-size-h1: 32px;
  --font-size-h2: 24px;
  --font-size-h3: 20px;
  --font-size-h4: 18px;
  --font-size-body-large: 16px;
  --font-size-body: 14px;
  --font-size-small: 12px;
  
  /* Spacing Scale */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 24px;
  --spacing-6: 32px;
  --spacing-8: 48px;
  
  /* Radii */
  --radius:     10px;
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Phase 2 Specific Design Tokens --- */
  --indigo-700: #4338CA;
  --indigo-600: #4F46E5;
  --indigo-500: #6366F1;
  --indigo-100: #E7E6FB;
  --indigo-50:  #EFEEFC;

  --violet-700: #6B21A8;
  --violet-600: #7E3AF2;
  --violet-100: #F1E6FC;
  --violet-50:  #F8F1FE;

  --teal-600:   #0E8074;
  --teal-500:   #14A198;
  --teal-100:   #DCF3F0;

  --slate-25:   #FBFBFD;
  --slate-50:   #F6F7F9;
  --slate-100:  #EEF0F4;
  --slate-200:  #E2E5EC;
  --slate-300:  #CBD1DC;

  --ink-900:    #12162A;
  --ink-600:    #4B5468;
  --ink-400:    #8A93A6;

  --green-600:  #1E8E5A;
  --green-100:  #E1F3E8;

  --amber-600:  #B8791A;
  --amber-100:  #FBEED9;

  --red-600:    #C4432E;
  --red-100:    #FBE4DF;

  --white:      #FFFFFF;
}

/* ==========================================================================
   3. GLOBAL RESETS & BASE STYLING
   ========================================================================== */
body {
  font-family: var(--font-body), 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 13px !important;
  background-color: var(--slate-50, #F6F7F9) !important;
  color: var(--ink-900, #12162A) !important;
  margin: 0;
  padding: 0;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, .view-title {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  color: var(--ink-900, #12162A) !important;
  letter-spacing: -0.01em;
}

h2, .section-title {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: var(--ink-900, #12162A) !important;
}

h3, .card-title {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--ink-900, #12162A) !important;
}

h4 {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  color: var(--ink-900, #12162A) !important;
}

h5 {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink-900, #12162A) !important;
}

h6 {
  font-family: var(--font-display), 'Space Grotesk', sans-serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--ink-900, #12162A) !important;
}

p {
  font-family: var(--font-body), 'IBM Plex Sans', sans-serif !important;
  font-size: 13px !important;
  color: var(--ink-600, #4B5468);
  line-height: 1.45;
}

svg.ic {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ==========================================================================
   4. LAYOUT STRUCTURE
   ========================================================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar — fixed so it stays visible while the main content scrolls */
.app-sidebar {
  width: 252px;
  min-width: 252px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  z-index: 1000;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Shell / Sidebar aliases */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--slate-200);
  padding: 22px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Sidebar Brand Header */
.sidebar-logo-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 22px 0 16px 0 !important;
  margin: 0 14px !important;
  border-bottom: 1px solid #E2E5EC !important;
  min-height: auto !important;
}
.sidebar-logo-container img {
  height: 72px;
  width: auto;
  max-width: 100%;
  display: block;
}

.brand {
  text-align: center;
  padding-bottom: 16px;
}

/* Brand styling from DataBank_Phase2_System */
.logo-row {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}
.logo-globe {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
}
.logo-text {
  font-family: var(--font-display), 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 700 !important;
  font-size: 23px !important;
  letter-spacing: -0.01em !important;
  line-height: 1 !important;
}
.logo-text .lv {
  color: #232735 !important;
}
.logo-text .ls {
  background: linear-gradient(90deg, #14A198, #3E7BD6) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}
.brand-tagline {
  font-family: var(--font-body), 'IBM Plex Sans', sans-serif !important;
  font-size: 10px !important;
  letter-spacing: .16em !important;
  text-transform: uppercase !important;
  color: #8A93A6 !important;
  margin-top: 3px !important;
  font-weight: 500 !important;
}
.portal-pill {
  font-family: var(--font-body), 'IBM Plex Sans', sans-serif !important;
  display: inline-block !important;
  margin-top: 13px !important;
  background: #EFEEFC !important;
  color: #4338CA !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 16px !important;
  border-radius: 20px !important;
}

/* Sidebar Navigation Items */
.sidebar-nav-group {
  padding: 12px 14px !important;
}
.sidebar-group-label {
  font-family: var(--font-body) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  color: #8A93A6 !important;
  text-transform: uppercase !important;
  letter-spacing: .1em !important;
  padding: 14px 12px 6px 12px !important;
}
.sidebar-nav-item {
  font-family: var(--font-body) !important;
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: #333A4D !important;
  text-decoration: none !important;
  transition: all 0.12s ease !important;
  margin-bottom: 2px !important;
  border-left: none !important;
}
.sidebar-nav-item:hover {
  background-color: #F6F7F9 !important;
  color: #4338CA !important;
}
.sidebar-nav-item.active {
  background-color: #EFEEFC !important;
  color: #4338CA !important;
  font-weight: 600 !important;
}
.sidebar-nav-item i {
  width: 18px !important;
  font-size: 15px !important;
  margin-right: 0 !important;
  text-align: center !important;
  color: #5A6377 !important;
}
.sidebar-nav-item.active i {
  color: #4F46E5 !important;
}

/* Nav Item Phase 2 enhancements */
.nav-scroll {
  border-top: 1px solid var(--slate-200);
  padding-top: 6px;
  flex: 1;
}
.nav-group-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--ink-400);
  text-transform: uppercase;
  font-weight: 600;
  padding: 16px 12px 7px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: #333A4D;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item svg.ic {
  color: #5A6377;
}
.nav-item:hover {
  background: var(--slate-50);
}
.nav-item.active {
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-weight: 600;
}
.nav-item.active svg.ic {
  color: var(--indigo-600);
}
.nav-badge {
  margin-left: auto;
  background: var(--slate-100);
  color: var(--ink-600);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 10px;
}
.nav-item.active .nav-badge {
  background: var(--indigo-100);
  color: var(--indigo-700);
}
.nav-badge.warn {
  background: var(--amber-100);
  color: var(--amber-600);
}

.sidebar-footer {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--indigo-600);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-meta .un {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
}
.user-meta .ur {
  font-size: 11px;
  color: var(--ink-400);
}

/* Main Content Area — offset by fixed sidebar width */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 252px;
}
.main {
  padding: 26px 34px 60px;
  max-width: 1420px;
}

/* Header */
.app-header {
  height: 72px;
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-6);
  position: relative;
  z-index: 1050;
}
.app-header-left {
  display: flex;
  align-items: center;
}
.app-header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}
.header-user-profile {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  cursor: pointer;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}
.header-user-profile:hover {
  background-color: var(--hover-color);
}
.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--active-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary-color);
  overflow: hidden;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.header-user-info {
  display: flex;
  flex-direction: column;
}
.header-user-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.header-user-role { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* Topline & View Headers */
.topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 20px;
  flex-wrap: wrap;
}
.view-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--indigo-600);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.view-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-900);
}
.view-desc {
  font-size: 13px;
  color: var(--ink-600);
  margin-top: 4px;
  max-width: 600px;
}
.topline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ==========================================================================
   5. REUSABLE CARDS, BUTTONS & FORM CONTROLS
   ========================================================================== */
.card-enterprise {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-5);
}

.btn-enterprise {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--spacing-4);
  height: 40px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-body);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  gap: var(--spacing-2);
}
.btn-primary { background-color: var(--primary-color); color: #FFF; }
.btn-primary:hover { background-color: #4338CA; }
.btn-outline { background-color: #FFF; border-color: var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background-color: var(--hover-color); }
.btn-danger { background-color: var(--danger-color); color: #FFF; }

.btn-ghost {
  background: #ffffff;
  border-color: var(--slate-300);
  color: var(--ink-900);
}
.btn-ghost:hover {
  border-color: var(--ink-400);
}
.link-btn {
  background: none;
  border: none;
  color: var(--indigo-600);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover {
  text-decoration: underline;
}

.badge-enterprise {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background-color: #DCFCE7; color: var(--success-color); }
.badge-warning { background-color: #FEF3C7; color: var(--warning-color); }
.badge-danger { background-color: #FEE2E2; color: var(--danger-color); }

/* Forms */
.form-control-ent {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control-ent:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}
.form-label-ent {
  display: block;
  margin-bottom: var(--spacing-2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   6. KPI METRICS & EXECUTIVE RAG CARDS
   ========================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.kpi {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--slate-200);
}

.kpi.k-indigo::before { background: var(--indigo-500); }
.kpi.k-teal::before   { background: var(--teal-500); }
.kpi.k-green::before  { background: var(--green-600); }
.kpi.k-amber::before  { background: var(--amber-600); }
.kpi.k-red::before    { background: var(--red-600); }

.kpi-label {
  font-size: 11px;
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--ink-900);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--ink-400);
  margin-top: 3px;
  font-family: var(--font-mono);
}

.kpi-delta {
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.kpi-delta.up   { color: var(--green-600); }
.kpi-delta.down { color: var(--red-600); }

/* Executive RAG Cards */
.rag-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.rag-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 16px;
}

.rag-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.rag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rag-label {
  font-size: 11px;
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.rag-value {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  color: var(--ink-900);
}

.rag-status {
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 3px;
}

.rag-sub {
  font-size: 11px;
  color: var(--ink-400);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ==========================================================================
   7. PANELS, DATA VISUALIZATIONS & ACTIVITY
   ========================================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.panel {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-900);
}

.panel-title-sub {
  font-size: 11.5px;
  color: var(--ink-400);
  margin-top: 2px;
}

.panel-body {
  padding: 18px;
}

/* Distribution Bars */
.dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dist-label {
  width: 130px;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.dist-track {
  flex: 1;
  background: var(--slate-100);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  border-radius: 6px;
}

.dist-count {
  width: 34px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-600);
}

/* Funnel Rows */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
}

.funnel-label {
  width: 100px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--ink-600);
}

.funnel-track {
  flex: 1;
  background: var(--slate-100);
  border-radius: 6px;
  height: 26px;
  position: relative;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #ffffff;
  font-weight: 600;
}

/* Horizontal Metric Bars */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
  font-size: 12.3px;
}

.bar-label {
  width: 150px;
  flex-shrink: 0;
  color: var(--ink-900);
  font-weight: 500;
}

.bar-track {
  flex: 1;
  background: var(--slate-100);
  border-radius: 5px;
  height: 9px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--indigo-500);
}

.bar-val {
  width: 60px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-600);
}

/* Activity Items */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--slate-200);
  font-size: 12.5px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-main { flex: 1; }
.activity-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-400);
  white-space: nowrap;
}

/* ==========================================================================
   8. FILTER BARS, SEARCH & BULK TOOLBAR
   ========================================================================== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-200);
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="date"] {
  font-size: 12.5px;
  padding: 7px 10px;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink-900);
  outline: none;
}

.filter-bar input[type="text"] {
  min-width: 200px;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--indigo-500);
}

.filter-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-400);
  font-family: var(--font-mono);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--ink-400);
  min-width: 230px;
}
.search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--ink-900);
  width: 100%;
}

.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--ink-900);
  color: #ffffff;
  padding: 10px 18px;
  font-size: 12.5px;
  border-bottom: 1px solid #232840;
}
.bulk-bar.show { display: flex; }
.bulk-bar b { font-family: var(--font-mono); color: #A5B4FC; }
.bulk-bar .spacer { flex: 1; }

/* ==========================================================================
   9. DATA TABLES (Scattered & Scoped for Safety)
   ========================================================================== */
.table-ent,
.table-system,
.panel table {
  width: 100%;
  border-collapse: collapse;
}

.table-ent th,
.table-system th,
.panel thead th {
  background-color: var(--bg-color);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.table-ent td,
.table-system td,
.panel tbody td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table-ent tr:last-child td,
.table-system tr:last-child td { border-bottom: none; }
.table-ent tr:hover td,
.table-system tr:hover td { background-color: var(--hover-color); }

.cell-contact .cn {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cell-contact .cc {
  font-size: 11.5px;
  color: var(--ink-400);
}

.keyf {
  display: inline-flex;
  gap: 3px;
}
.keyf svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}
.keyf .on  { color: var(--indigo-600); }
.keyf .off { color: var(--slate-300); }

.chk {
  width: 15px;
  height: 15px;
  accent-color: var(--indigo-600);
  cursor: pointer;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.icon-btn {
  border: 1px solid var(--slate-300);
  background: #ffffff;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-900);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.1s ease;
}
.icon-btn:hover {
  border-color: var(--indigo-500);
  color: var(--indigo-700);
}
.icon-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* ==========================================================================
   10. LEAD SCORING & STATUS PILLS
   ========================================================================== */
.score-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 118px;
}

.score-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 5px;
  width: fit-content;
}

.band-hot        { background: var(--green-100); color: var(--green-600); }
.band-warm       { background: var(--amber-100); color: var(--amber-600); }
.band-cold,
.band-incomplete { background: var(--red-100);   color: var(--red-600); }

.composition {
  display: flex;
  height: 5px;
  width: 100px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--slate-100);
}
.composition span { height: 100%; }

.enrich-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 100px;
}
.enrich-track {
  flex: 1;
  background: var(--slate-100);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.enrich-fill {
  height: 100%;
  background: var(--indigo-500);
  border-radius: 4px;
}
.enrich-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-600);
  width: 30px;
}

/* Status Pills */
.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  white-space: nowrap;
}

.pill-new        { background: var(--slate-100); color: var(--ink-600); }
.pill-reviewed   { background: #E4EAF5;         color: #3A5AA6; }
.pill-qualified  { background: var(--indigo-100); color: var(--indigo-700); }
.pill-rejected   { background: var(--red-100);   color: var(--red-600); }
.pill-synced     { background: var(--green-100); color: var(--green-600); }
.pill-failed     { background: var(--red-100);   color: var(--red-600); }
.pill-duplicate  { background: var(--amber-100); color: var(--amber-600); }
.pill-notsynced  { background: var(--slate-100); color: var(--ink-400); }
.pill-manager    { background: var(--indigo-100); color: var(--indigo-700); }
.pill-executive  { background: var(--teal-100);   color: var(--teal-600); }

.channel-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: .02em;
}
.channel-tag.cc { background: var(--green-100);  color: var(--green-600); }
.channel-tag.li { background: var(--indigo-100); color: var(--indigo-700); }
.channel-tag.em { background: var(--teal-100);   color: var(--teal-600); }

/* ============================================================
   11. ACTION DROPDOWN — SHARED DESIGN (All Tables, All Pages)
   Clean text-only design with color-coded labels.
   Matches screenshot: white card, soft shadow, generous spacing.
   ============================================================ */

/* ── Trigger button ─────────────────────────────────────────── */
.btn-icon-dropdown {
  width: 28px !important;
  height: 28px !important;
  border-radius: 6px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 auto !important;
  cursor: pointer !important;
  color: #64748b !important;
  font-size: 28px !important;
  font-weight: 900 !important;
  transition: background var(--transition-fast), box-shadow var(--transition-fast),
              color var(--transition-fast) !important;
  text-decoration: none !important;
  background-image: none !important;
}
.btn-icon-dropdown:hover,
.btn-icon-dropdown:focus,
.btn-icon-dropdown[aria-expanded="true"] {
  background: transparent !important;
  box-shadow: none !important;
  color: #1e293b !important;
  outline: none !important;
}

/* ── Dropdown panel ─────────────────────────────────────────── */
.action-dropdown .dropdown-menu {
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08),
              0 1px 3px  rgba(15, 23, 42, 0.04) !important;
  padding: 8px !important;
  min-width: 160px !important;
  background: #ffffff !important;
  margin-top: 6px !important;
}

/* ── Menu items (text only, no icons) ──────────────────────── */
.action-dropdown .dropdown-item {
  border-radius: 6px !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  font-family: var(--font-family) !important;
  color: #1f2937 !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  transition: background var(--transition-fast), color var(--transition-fast) !important;
  background: transparent !important;
  border: none !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  line-height: 1.4 !important;
}

/* Hide any icons that might exist inside items */
.action-dropdown .dropdown-item i,
.action-dropdown .dropdown-item .fas,
.action-dropdown .dropdown-item .far,
.action-dropdown .dropdown-item .fab {
  display: none !important;
}

/* Normal hover state */
.action-dropdown .dropdown-item:hover,
.action-dropdown .dropdown-item:focus {
  background: #f8fafc !important;
  color: #0f172a !important;
}

/* Default link text (View, Edit) */
.action-dropdown .dropdown-item {
  color: #374151 !important;
}
.action-dropdown .dropdown-item:hover,
.action-dropdown .dropdown-item:focus {
  color: #111827 !important;
}

/* Success (Qualify, Re-activate) — Green */
.action-dropdown .dropdown-item.text-success {
  color: #16a34a !important;
  font-weight: 600 !important;
}
.action-dropdown .dropdown-item.text-success:hover,
.action-dropdown .dropdown-item.text-success:focus {
  background: #f0fdf4 !important;
  color: #15803d !important;
}

/* Danger (Delete, Reject) — Red */
.action-dropdown .dropdown-item.text-danger {
  color: #dc2626 !important;
  font-weight: 600 !important;
}
.action-dropdown .dropdown-item.text-danger:hover,
.action-dropdown .dropdown-item.text-danger:focus {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

/* Warning (Push to HubSpot) — Orange */
.action-dropdown .dropdown-item.text-warning {
  color: #d97706 !important;
  font-weight: 600 !important;
}
.action-dropdown .dropdown-item.text-warning:hover,
.action-dropdown .dropdown-item.text-warning:focus {
  background: #fffbeb !important;
  color: #b45309 !important;
}

/* Info / primary */
.action-dropdown .dropdown-item.text-info,
.action-dropdown .dropdown-item.text-primary {
  color: #0ea5e9 !important;
}
.action-dropdown .dropdown-item.text-info:hover,
.action-dropdown .dropdown-item.text-primary:hover {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}

/* Purple (Requalify, Re-activate) */
.action-dropdown .dropdown-item.text-purple {
  color: #9333ea !important;
  font-weight: 600 !important;
}
.action-dropdown .dropdown-item.text-purple:hover,
.action-dropdown .dropdown-item.text-purple:focus {
  background: #faf5ff !important;
  color: #7e22ce !important;
}

/* Muted / disabled */
.action-dropdown .dropdown-item.text-muted,
.action-dropdown .dropdown-item:disabled,
.action-dropdown .dropdown-item.disabled {
  color: #9ca3af !important;
  opacity: 0.6 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  font-weight: normal !important;
}

/* Divider */
.action-dropdown .dropdown-divider {
  border-color: #e5e7eb !important;
  margin: 6px 4px !important;
  opacity: 0.5 !important;
}

/* ==========================================================================
   12. GLOBAL MODAL STYLES (DataBank Phase 2 Standard)
   Directly matching manager/all_data_reports.html
   ========================================================================== */
.modal-content {
  border-radius: 12px !important;
  border: 1px solid var(--slate-200, #E2E5EC) !important;
  box-shadow: 0 24px 60px rgba(18, 22, 42, 0.2) !important;
  background: #ffffff !important;
  overflow: hidden !important;
}
.modal-header {
  padding: 18px 20px !important;
  border-bottom: 1px solid var(--slate-200, #E2E5EC) !important;
  background: #ffffff !important;
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}
.modal-title,
.modal-header .modal-title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif) !important;
  font-weight: 700 !important;
  font-size: 16.5px !important;
  color: var(--ink-900, #12162A) !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}
.modal-header .btn-close {
  opacity: 0.45 !important;
  padding: 8px !important;
  margin: -4px -4px -4px auto !important;
  transition: opacity 0.15s ease, transform 0.15s ease !important;
  box-shadow: none !important;
  outline: none !important;
}
.modal-header .btn-close:hover {
  opacity: 1 !important;
  transform: scale(1.05) !important;
}
.modal-body {
  padding: 20px 22px !important;
  color: var(--ink-600, #4B5468) !important;
  font-size: 13.5px !important;
  font-family: var(--font-body, 'IBM Plex Sans', sans-serif) !important;
  line-height: 1.5 !important;
}
.modal-body p {
  font-size: 13.5px !important;
  color: var(--ink-600, #4B5468) !important;
  line-height: 1.5 !important;
  margin-bottom: 8px !important;
}
.modal-body p:last-child {
  margin-bottom: 0 !important;
}
.modal-footer {
  padding: 14px 20px !important;
  border-top: 1px solid var(--slate-200, #E2E5EC) !important;
  background: var(--slate-25, #FBFBFD) !important;
  border-bottom-left-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Modal Buttons Standard */
.modal-footer .btn {
  height: 33px !important;
  min-height: 33px !important;
  padding: 0 16px !important;
  border-radius: 7px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  font-family: var(--font-body, 'IBM Plex Sans', sans-serif) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  line-height: normal !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  box-shadow: none !important;
}

.modal-footer .btn-secondary,
.modal-footer .btn-outline-secondary,
.modal-footer .btn-ghost {
  background: #ffffff !important;
  border: 1px solid var(--slate-300, #CBD1DC) !important;
  color: var(--ink-900, #12162A) !important;
}

.modal-footer .btn-secondary:hover,
.modal-footer .btn-outline-secondary:hover,
.modal-footer .btn-ghost:hover {
  background: var(--slate-50, #F6F7F9) !important;
  border-color: var(--slate-400, #94A3B8) !important;
  color: var(--ink-900, #12162A) !important;
}

.modal-footer .btn-danger {
  background: var(--red-600, #C4432E) !important;
  border: 1px solid var(--red-600, #C4432E) !important;
  color: #ffffff !important;
}

.modal-footer .btn-danger:hover {
  background: #A83321 !important;
  border-color: #A83321 !important;
  color: #ffffff !important;
}

.modal-footer .btn-primary {
  background: var(--indigo-600, #4F46E5) !important;
  border: 1px solid var(--indigo-600, #4F46E5) !important;
  color: #ffffff !important;
}

.modal-footer .btn-primary:hover {
  background: var(--indigo-700, #4338CA) !important;
  border-color: var(--indigo-700, #4338CA) !important;
  color: #ffffff !important;
}

/* ── Danger modal header ── */
.modal-header-danger {
  background: #FEF2F2 !important;
  border-bottom-color: #FECACA !important;
}
.modal-header-danger .modal-title {
  color: #991B1B !important;
}

/* ── Warning modal header ── */
.modal-header-warning {
  background: #FFFBEB !important;
  border-bottom-color: #FDE68A !important;
}
.modal-header-warning .modal-title {
  color: #92400E !important;
}

/* ── Success modal header ── */
.modal-header-success {
  background: #F0FDF4 !important;
  border-bottom-color: #BBF7D0 !important;
}
.modal-header-success .modal-title {
  color: #166534 !important;
}

/* ── Info modal header ── */
.modal-header-info {
  background: #EFF6FF !important;
  border-bottom-color: #BFDBFE !important;
}
.modal-header-info .modal-title {
  color: #1E40AF !important;
}

/* ── Modal buttons ── */
.modal-footer .btn {
  height: 36px !important;
  padding: 0 18px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}
.modal-footer .btn-primary {
  background: #4F46E5 !important;
  border-color: #4F46E5 !important;
  color: #fff !important;
}
.modal-footer .btn-primary:hover {
  background: #4338CA !important;
  border-color: #4338CA !important;
}
.modal-footer .btn-danger {
  background: #EF4444 !important;
  border-color: #EF4444 !important;
  color: #fff !important;
}
.modal-footer .btn-danger:hover {
  background: #DC2626 !important;
  border-color: #DC2626 !important;
}
.modal-footer .btn-secondary,
.modal-footer .btn-outline-secondary {
  background: #fff !important;
  border: 1px solid #E2E8F0 !important;
  color: #475569 !important;
}
.modal-footer .btn-secondary:hover,
.modal-footer .btn-outline-secondary:hover {
  background: #F1F5F9 !important;
}
.modal-footer .btn-warning {
  background: #F59E0B !important;
  border-color: #F59E0B !important;
  color: #fff !important;
}
.modal-footer .btn-warning:hover {
  background: #D97706 !important;
  border-color: #D97706 !important;
}

/* ── Reject modal shared styles ───────────────────────────────── */
.btn-confirm-reject {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: 6px;
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-confirm-reject:hover {
  background: #EF4444 !important;
  color: #fff !important;
  border-color: #EF4444 !important;
}
.reject-modal-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: #FEE2E2;
  display: inline-flex align-items: center; justify-content: center;
  flex-shrink: 0;
}
.reject-modal-icon i { color: #EF4444; font-size: 16px; }
.reject-textarea {
  width: 100%;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #374151;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reject-textarea:focus {
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

/* ==========================================================================
   13. TOAST NOTIFICATIONS & LOGS
   ========================================================================== */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--ink-900);
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
  min-width: 260px;
  animation: slidein .18s ease-out;
}
.toast .tdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
@keyframes slidein {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

code.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-600);
}

.log-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-100);
}
.log-item:last-child { border-bottom: none; }
.log-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.log-main { flex: 1; font-size: 12.8px; }
.log-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-400);
  white-space: nowrap;
}

/* ==========================================================================
   14. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1200px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1100px) {
  .kpi-row,
  .rag-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .app-main {
    margin-left: 0;
  }
  .kpi-row,
  .rag-row {
    grid-template-columns: 1fr;
  }
  .topline {
    flex-direction: column;
    align-items: flex-start;
  }
}
