/* ==========================================================================
   HYSEKT CRM — MODERN DEEP SLATE & CHARCOAL DESIGN SYSTEM
   Design Reference: Balanced dark mode (Tailwind Slate, Linear, Stripe Dark)
   Balance: Rich tonal depth, crisp contrast, surgical color accents
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (BALANCED SLATE & CHARCOAL ELEVATION)
   -------------------------------------------------------------------------- */
:root {
  /* Tonal Elevations (Rich Slate Navy — NOT pitch black void) */
  --bg-app: #0b0f19;              /* Canvas base */
  --bg-surface: #111827;          /* Cards & Panels */
  --bg-surface-elevated: #162032; /* Top bar, inputs, modal drawer */
  --bg-surface-hover: #1c283f;    /* Hover state with real contrast */
  --bg-surface-active: #23324f;   /* Active selection */

  /* Hairline Borders (Crisp, Visible Definition) */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: #6366f1;

  /* Typography Hierarchy */
  --text-title: #ffffff;
  --text-body: #e2e8f0;           /* Slate 200 */
  --text-muted: #94a3b8;          /* Slate 400 */
  --text-dim: #64748b;            /* Slate 500 */
  --text-accent: #818cf8;         /* Soft Indigo */

  /* Primary Brand Accents */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: rgba(99, 102, 241, 0.14);
  --accent-border: rgba(99, 102, 241, 0.35);

  /* Status Colors (Distinct & High-Legibility) */
  --status-tier-a-bg: rgba(245, 158, 11, 0.14);
  --status-tier-a-text: #fbbf24;
  --status-tier-a-border: rgba(245, 158, 11, 0.35);

  --status-tier-b-bg: rgba(14, 165, 233, 0.14);
  --status-tier-b-text: #38bdf8;
  --status-tier-b-border: rgba(14, 165, 233, 0.35);

  --status-disq-bg: rgba(239, 68, 68, 0.12);
  --status-disq-text: #f87171;
  --status-disq-border: rgba(239, 68, 68, 0.3);

  --status-sent-bg: rgba(168, 85, 247, 0.14);
  --status-sent-text: #c084fc;
  --status-sent-border: rgba(168, 85, 247, 0.35);

  --status-jit-bg: rgba(16, 185, 129, 0.14);
  --status-jit-text: #34d399;
  --status-jit-border: rgba(16, 185, 129, 0.35);

  --status-won-bg: rgba(244, 63, 94, 0.14);
  --status-won-text: #fb7185;
  --status-won-border: rgba(244, 63, 94, 0.35);

  /* Social Brand Colors */
  --social-yt-bg: rgba(239, 68, 68, 0.12);
  --social-yt-text: #f87171;
  --social-yt-border: rgba(239, 68, 68, 0.3);

  --social-ig-bg: rgba(236, 72, 153, 0.12);
  --social-ig-text: #f472b6;
  --social-ig-border: rgba(236, 72, 153, 0.3);

  --social-th-bg: rgba(148, 163, 184, 0.12);
  --social-th-text: #cbd5e1;
  --social-th-border: rgba(148, 163, 184, 0.25);

  --social-x-bg: rgba(56, 189, 248, 0.12);
  --social-x-text: #38bdf8;
  --social-x-border: rgba(56, 189, 248, 0.3);

  /* Geometry & Shadows */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   2. GLOBAL BASE & RESET
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--text-body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

/* Modern Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #26334d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #374768;
}

/* --------------------------------------------------------------------------
   3. APP HEADER
   -------------------------------------------------------------------------- */
.top-appbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

.badge-live {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Executive Pipeline Segmented Bar */
.kpi-segmented-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.kpi-item:hover {
  color: var(--text-title);
  background: var(--bg-surface-hover);
}

.kpi-item.active {
  background: var(--bg-surface-active);
  color: var(--text-title);
  border: 1px solid var(--border-medium);
}

.kpi-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-body);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-top {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-body);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.btn-top:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. EXECUTIVE HERO METRIC CARDS
   -------------------------------------------------------------------------- */
.kpi-cards-grid {
  max-width: 1720px;
  margin: 18px auto 0;
  padding: 0 24px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1024px) {
  .kpi-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .kpi-cards-grid { grid-template-columns: 1fr; }
}

.kpi-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.15s ease;
}

.kpi-metric-card:hover {
  border-color: var(--border-medium);
  background: #141f33;
  transform: translateY(-1px);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-card-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-title);
  letter-spacing: -0.02em;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.kpi-trend-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
}

.kpi-sub-text {
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   5. SEARCH, FILTER & ACTION TOOLBAR
   -------------------------------------------------------------------------- */
.toolbar-container {
  max-width: 1720px;
  margin: 18px auto 0;
  padding: 0 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toolbar-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrapper {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-title);
  padding: 9px 36px 9px 34px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.search-wrapper input:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.search-wrapper input::placeholder {
  color: var(--text-dim);
}

.search-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  background: var(--bg-surface-elevated);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.toolbar-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-pill {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%2394a3b8' d='M0 0l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 7px 28px 7px 11px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.select-pill:focus, .select-pill:hover {
  border-color: var(--border-medium);
  background-color: var(--bg-surface-elevated);
  color: #ffffff;
}

.btn-reset-filters {
  background: var(--bg-surface);
  border: 1px dashed var(--border-medium);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}

.btn-reset-filters:hover {
  border-color: var(--text-title);
  color: var(--text-title);
  background: var(--bg-surface-hover);
}

/* Quick Filter Chips */
.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
  user-select: none;
}

.chip-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-title);
  border-color: var(--border-medium);
}

.chip-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.chip-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.85;
}

/* Bulk Action Toolbar */
#bulk-action-toolbar {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 24px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.bulk-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-title);
}

.bulk-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-bulk {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-body);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.btn-bulk:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: #ffffff;
}

.btn-bulk-claim {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.btn-bulk-claim:hover {
  background: var(--accent-hover);
}

.btn-bulk-release {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-muted);
}

.btn-bulk-release:hover {
  background: var(--bg-surface-hover);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}

.btn-bulk-clear {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  color: var(--text-muted);
}

.btn-bulk-clear:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
}

.row-select-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.leads-table tbody tr.selected-for-bulk {
  background: var(--accent-subtle);
  box-shadow: inset 3px 0 0 var(--accent);
}

.leads-table thead th:first-child {
  padding: 0;
}

/* Sub-bar: results count & view toggle */
.sub-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.view-toggle-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s;
}

.view-btn.active {
  background: var(--bg-surface-active);
  color: var(--text-title);
}

/* --------------------------------------------------------------------------
   6. DATA TABLE (BALANCED TONAL CONTRAST)
   -------------------------------------------------------------------------- */
main.main-content {
  max-width: 1720px;
  margin: 14px auto 40px;
  padding: 0 24px;
  width: 100%;
  flex: 1;
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table-scroll {
  overflow-x: auto;
  max-height: calc(100vh - 290px);
}

table.leads-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
}

table.leads-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #162032; /* Distinct, elevated header row */
  border-bottom: 1px solid var(--border-medium);
}

table.leads-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  border-bottom: 1px solid var(--border-medium);
  transition: color 0.12s ease;
}

table.leads-table th:hover {
  color: var(--text-title);
}

table.leads-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.12s ease;
  cursor: pointer;
}

table.leads-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

table.leads-table tbody tr.selected-row {
  background: var(--bg-surface-active);
  box-shadow: inset 3px 0 0 var(--accent);
}

table.leads-table td {
  padding: 11px 16px;
  vertical-align: middle;
  color: var(--text-body);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Prospect Identity Cell */
.prospect-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.avatar-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.prospect-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.prospect-name {
  font-weight: 700;
  color: var(--text-title);
  font-size: 13.5px;
  letter-spacing: -0.01em;
}

.prospect-handle {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-accent);
  text-decoration: none;
  margin-top: 1px;
}

.prospect-handle:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Category & Platform Badges */
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.tag-platform {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}

.tag-niche {
  background: var(--bg-surface-elevated);
  color: #cbd5e1;
  border: 1px solid var(--border-subtle);
}

/* Claim / lock badges */
.badge-claim {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-medium);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.badge-claim:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.badge-claimed-me {
  background: var(--status-jit-bg);
  border: 1px solid var(--status-jit-border);
  color: var(--status-jit-text);
  font-size: 10.5px;
  font-weight: 700;
}
.badge-claimed-other {
  background: var(--status-sent-bg);
  border: 1px solid var(--status-sent-border);
  color: var(--status-sent-text);
  font-size: 10.5px;
  font-weight: 700;
}

/* Status Select Pills in Table */
.row-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-surface-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%2394a3b8' d='M0 0l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 4px 22px 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.row-select:focus, .row-select:hover {
  border-color: var(--border-medium);
  background-color: var(--bg-surface-hover);
  color: #ffffff;
}

/* Status Color Themes */
.row-select.qual-tier-a {
  background-color: var(--status-tier-a-bg);
  border-color: var(--status-tier-a-border);
  color: var(--status-tier-a-text);
}
.row-select.qual-tier-b {
  background-color: var(--status-tier-b-bg);
  border-color: var(--status-tier-b-border);
  color: var(--status-tier-b-text);
}
.row-select.qual-disq {
  background-color: var(--status-disq-bg);
  border-color: var(--status-disq-border);
  color: var(--status-disq-text);
}

.row-select.status-sent {
  background-color: var(--status-sent-bg);
  border-color: var(--status-sent-border);
  color: var(--status-sent-text);
}
.row-select.status-jit {
  background-color: var(--status-jit-bg);
  border-color: var(--status-jit-border);
  color: var(--status-jit-text);
}
.row-select.status-won {
  background-color: var(--status-won-bg);
  border-color: var(--status-won-border);
  color: var(--status-won-text);
}

/* Date Touchpoint Cell */
.date-touchpoint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
}

.date-touchpoint.due-overdue {
  background: var(--status-disq-bg);
  border: 1px solid var(--status-disq-border);
  color: var(--status-disq-text);
  font-weight: 700;
}

.date-touchpoint.has-date {
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

/* Notes Brief */
.notes-preview-cell {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  color: var(--text-dim);
}

.notes-preview-cell.has-notes {
  color: var(--text-muted);
}

/* Action Buttons in Row */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.btn-row-action {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.btn-row-action:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
  border-color: var(--border-medium);
}

.btn-row-inspect {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: #c7d2fe;
}

.btn-row-inspect:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Social Brand Badges in Table */
.social-pills-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.badge-social {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.12s ease;
}

.badge-social:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
  border-color: var(--border-medium);
}

.badge-social-yt {
  background: var(--social-yt-bg);
  border-color: var(--social-yt-border);
  color: var(--social-yt-text);
}
.badge-social-yt:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

.badge-social-ig {
  background: var(--social-ig-bg);
  border-color: var(--social-ig-border);
  color: var(--social-ig-text);
}
.badge-social-ig:hover {
  background: rgba(236, 72, 153, 0.25);
  color: #ffffff;
}

.badge-social-th {
  background: var(--social-th-bg);
  border-color: var(--social-th-border);
  color: var(--social-th-text);
}
.badge-social-th:hover {
  background: rgba(148, 163, 184, 0.25);
  color: #ffffff;
}

.badge-social-x {
  background: var(--social-x-bg);
  border-color: var(--social-x-border);
  color: var(--social-x-text);
}
.badge-social-x:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   7. SLIDE-OVER DETAIL DRAWER
   -------------------------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 500px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-medium);
  z-index: 101;
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-elevated);
}

.drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.015em;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: all 0.1s;
}

.btn-close-drawer:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
}

.drawer-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.field-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-key {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.drawer-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  outline: none;
  width: 100%;
}

.drawer-input:focus {
  border-color: var(--border-focus);
}

.drawer-textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
  outline: none;
  width: 100%;
  min-height: 95px;
  resize: vertical;
  font-family: inherit;
}

.drawer-textarea:focus {
  border-color: var(--border-focus);
}

.drawer-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-drawer-action {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.12s ease;
}

.btn-drawer-action:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  color: #ffffff;
}

/* Enrichment status badges */
.badge-enrich-status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-enrich-tier1 {
  background: var(--status-jit-bg);
  border: 1px solid var(--status-jit-border);
  color: var(--status-jit-text);
}

.badge-enrich-tier2 {
  background: var(--status-tier-b-bg);
  border: 1px solid var(--status-tier-b-border);
  color: var(--status-tier-b-text);
}

.badge-enrich-tier3 {
  background: var(--status-tier-a-bg);
  border: 1px solid var(--status-tier-a-border);
  color: var(--status-tier-a-text);
}

.badge-enrich-none {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

.badge-enrich-exempt {
  background: var(--status-sent-bg);
  border: 1px solid var(--status-sent-border);
  color: var(--status-sent-text);
}

.btn-enrich-action {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.btn-enrich-action:hover {
  background: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   8. PAGINATION BAR
   -------------------------------------------------------------------------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.page-nav-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.page-nav-btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  color: #ffffff;
  border-color: var(--border-medium);
}

.page-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-label {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   9. TOAST NOTIFICATION
   -------------------------------------------------------------------------- */
.save-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 200;
}

/* --------------------------------------------------------------------------
   10. LOGIN MODAL & USER PILL
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.login-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  z-index: 151;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.login-modal-header {
  padding: 20px 24px 8px;
  text-align: center;
}

.login-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.02em;
}

.login-modal-body {
  padding: 0 24px 24px;
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-title);
  padding: 11px 13px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  outline: none;
  transition: all 0.15s ease;
}

.login-field input:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.login-field input::placeholder {
  color: var(--text-dim);
}

.login-error {
  font-size: 12px;
  color: #f87171;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  text-align: center;
}

.btn-login-submit {
  width: 100%;
  margin-top: 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-login-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* User Pill */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 5px 14px 5px 10px;
  font-size: 12px;
  color: var(--text-body);
}

.user-pill #userName {
  font-weight: 600;
  color: var(--text-title);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-logout:hover {
  background: var(--bg-surface-hover);
  color: #f87171;
}

/* Hide main content when login required */
body.auth-required main.main-content,
body.auth-required .toolbar-container,
body.auth-required .kpi-cards-grid {
  display: none;
}

body.auth-required .top-appbar .kpi-segmented-bar {
  display: none;
}
