/* SKYup News - Feed Analyst & Telemetry System
 * Executive Dark-Mode Design System
 */

:root {
  --bg-base: #080c14;
  --bg-surface: #0f172a;
  --bg-card: rgba(18, 26, 44, 0.75);
  --bg-card-hover: rgba(26, 38, 64, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(139, 92, 246, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.45rem 1rem;
}

.header-container {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.brand-logo-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo-badge:hover {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-company {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
}

.brand-app {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.version-badge {
  font-size: 0.58rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-family: var(--font-mono);
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.app-nav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(15, 23, 42, 0.85);
  padding: 2px 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.nav-tab-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none !important;
  white-space: nowrap;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-tab-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-tab-link.active {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.22);
}

.nav-tab-link svg {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.time-filter-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1px;
  background: rgba(15, 23, 42, 0.75);
  padding: 2px 3px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.time-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 3px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.time-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.time-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

/* Special style for "All Time" button */
.time-btn[data-hours="0"].active {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.5);
}

@media (max-width: 1440px) {
  .time-btn[data-hours="12"],
  .time-btn[data-hours="8760"] {
    display: none;
  }
}

@media (max-width: 1280px) {
  .time-btn[data-hours="168"],
  .time-btn[data-hours="720"] {
    display: none;
  }
}

@media (max-width: 1120px) {
  .time-btn[data-hours="6"] {
    display: none;
  }
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border: 1px solid var(--border-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-primary svg {
  width: 13px;
  height: 13px;
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Dashboard Container */
.dashboard-main {
  max-width: 1560px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Top KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.15rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

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

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  font-family: var(--font-display);
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-views { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.icon-clicks { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-likes { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.icon-comments { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.icon-dwell { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.trend-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.trend-badge.positive {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.trend-badge.neutral {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
}

.ctr-details {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.live-readers-tag {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.kpi-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Visualizer Grid (Charts & Geo) */
.visualizer-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 1.25rem;
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: #ffffff;
}

.panel-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-legend-custom {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.views { background: var(--accent-cyan); }
.dot.clicks { background: var(--accent-blue); }
.dot.likes { background: var(--accent-rose); }

.chart-container {
  position: relative;
  height: 275px;
  width: 100%;
}

/* Area-Wise Section */
.geo-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: var(--radius-md);
}

.geo-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.geo-tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.geo-content-container {
  overflow-y: auto;
  max-height: 275px;
  padding-right: 0.35rem;
}

.geo-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.geo-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}

.geo-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.geo-name-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.geo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.geo-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f1f5f9;
}

.geo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.geo-metrics-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.geo-views {
  color: #ffffff;
  font-weight: 600;
}

.geo-share {
  color: var(--accent-cyan);
  font-weight: 600;
}

.geo-progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.geo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
  border-radius: 9999px;
}

/* Secondary Grid (Categories + Live Ticker) */
.secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.category-bars {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.category-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category-row-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.cat-name { color: #f8fafc; }
.cat-stats { font-family: var(--font-mono); color: var(--text-secondary); font-size: 0.76rem; }

.cat-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.fill-tech { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.fill-business { background: linear-gradient(90deg, #10b981, #059669); }
.fill-politics { background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.fill-sports { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.fill-general { background: linear-gradient(90deg, #64748b, #94a3b8); }

/* Live Ticker */
.ticker-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stream-event-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.stream-event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.stream-event-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.event-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.badge-view { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.badge-click { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-like { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.badge-comment { background: rgba(139, 92, 246, 0.2); color: #c084fc; }
.badge-share { background: rgba(52, 211, 153, 0.2); color: #34d399; }

.stream-story-title {
  color: #e2e8f0;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-event-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.stream-geo {
  color: var(--text-secondary);
}

/* Feed Performance Table */
.feed-table-section {
  width: 100%;
}

.table-panel {
  padding: 1.5rem;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.category-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.cat-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.cat-pill.active {
  background: var(--accent-blue);
  color: white;
}

.date-selector,
.sort-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.custom-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: white;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
}

.custom-select option {
  background: #0f172a;
  color: white;
}

.table-responsive {
  overflow-x: auto;
  /* overflow-x makes this a scroll container on both axes, so the sticky header
     below pins to this box rather than the page. Give it a viewport-relative
     height so that header actually has something to stick to. */
  max-height: calc(100vh - 12rem);
  overscroll-behavior: contain;
}

.feed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.feed-table th {
  position: sticky;
  /* Pins to the top of .table-responsive. Any offset here pushes the header
     down over the first row instead, since sticky does not reflow siblings. */
  top: 0;
  z-index: 20;
  background: #0d1527;
  text-align: left;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.feed-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.feed-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.story-col-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.story-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #1e293b;
  flex-shrink: 0;
}

.story-meta-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.story-row-title {
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-row-author {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Dateline: where the story was reported from, not where it was read */
.story-row-dateline {
  align-self: flex-start;
  margin-top: 3px;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.num-cell {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: #f1f5f9;
}

.ctr-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.ctr-high { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.ctr-med { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.ctr-low { background: rgba(255, 255, 255, 0.08); color: #94a3b8; }

.btn-inspect {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-inspect:hover {
  background: var(--accent-blue);
  color: white;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  background: #0f172a;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-cat-tag {
  background: var(--accent-blue);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
}

.modal-id-tag {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: white;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-funnel-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.funnel-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.funnel-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.funnel-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
}

.funnel-val.highlight {
  color: var(--accent-cyan);
}

.funnel-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}

.modal-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.modal-stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.modal-section-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.5rem;
}

.modal-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 180px;
  overflow-y: auto;
}

.comment-bubble {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comment-bubble-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.comment-author {
  font-weight: 600;
  color: #cbd5e1;
}

.comment-sentiment-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 600;
}

.sentiment-positive { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.sentiment-neutral { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.comment-bubble-text {
  font-size: 0.78rem;
  color: #e2e8f0;
}

.empty-state {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .visualizer-grid, .secondary-grid {
    grid-template-columns: 1fr;
  }
}

/* Location Filter Box */
.location-filter-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-md);
}

/* The dateline filter sits beside the audience-location one and answers the
   opposite question, so it carries the amber of the dateline chips rather than
   the cyan used for reader geography. */
.dateline-filter-box {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.28);
}

.dateline-filter-box .loc-label {
  color: #fbbf24;
}

.dateline-filter-box .loc-select {
  max-width: 190px;
}

.loc-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.loc-select {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #f8fafc;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  outline: none;
}

.loc-select:focus {
  border-color: var(--accent-cyan);
}

.location-active-banner {
  background: rgba(6, 182, 212, 0.08);
  border-left: 3px solid var(--accent-cyan);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.location-share-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

/* Modal Geo Breakdown */
.modal-geo-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  max-height: 160px;
  overflow-y: auto;
}

.modal-geo-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-geo-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
}

.modal-geo-city {
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.modal-geo-stats {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent-cyan);
}

.modal-geo-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.modal-geo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
  border-radius: 9999px;
}

/* Live Telemetry Pulse Highlighting */
@keyframes livePulsePink {
  0% { transform: scale(1); color: #f43f5e; text-shadow: 0 0 10px rgba(244, 63, 94, 0.8); }
  50% { transform: scale(1.28); color: #fda4af; text-shadow: 0 0 18px rgba(244, 63, 94, 1); font-weight: 800; }
  100% { transform: scale(1); }
}

@keyframes livePulseCyan {
  0% { transform: scale(1); color: #06b6d4; text-shadow: 0 0 10px rgba(6, 182, 212, 0.8); }
  50% { transform: scale(1.28); color: #67e8f9; text-shadow: 0 0 18px rgba(6, 182, 212, 1); font-weight: 800; }
  100% { transform: scale(1); }
}

@keyframes livePulseBlue {
  0% { transform: scale(1); color: #3b82f6; text-shadow: 0 0 10px rgba(59, 130, 246, 0.8); }
  50% { transform: scale(1.28); color: #93c5fd; text-shadow: 0 0 18px rgba(59, 130, 246, 1); font-weight: 800; }
  100% { transform: scale(1); }
}

@keyframes livePulseEmerald {
  0% { transform: scale(1); color: #10b981; text-shadow: 0 0 10px rgba(16, 185, 129, 0.8); }
  50% { transform: scale(1.28); color: #6ee7b7; text-shadow: 0 0 18px rgba(16, 185, 129, 1); font-weight: 800; }
  100% { transform: scale(1); }
}

.pulse-pink {
  animation: livePulsePink 1.2s ease-out;
  display: inline-block;
}

.pulse-cyan {
  animation: livePulseCyan 1.2s ease-out;
  display: inline-block;
}

.pulse-blue {
  animation: livePulseBlue 1.2s ease-out;
  display: inline-block;
}

.pulse-emerald {
  animation: livePulseEmerald 1.2s ease-out;
  display: inline-block;
}


/* ==========================================================================
   Audience Recommendations panel
   ========================================================================== */

.reco-section { margin-bottom: 1.5rem; }

.reco-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.reco-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reco-mode-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.mode-warm { background: rgba(52, 211, 153, 0.14); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.28); }
.mode-cold { background: rgba(56, 189, 248, 0.14); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.28); }

.reco-body {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem 1.25rem 1.25rem;
}

@media (max-width: 1100px) {
  .reco-body { grid-template-columns: minmax(0, 1fr); }
}

.reco-col { min-width: 0; }

.reco-col-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.15rem;
}
.reco-col-title-spaced { margin-top: 1.5rem; }

.reco-col-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.75;
  margin: 0 0 0.6rem;
}

.reco-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }

.reco-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reco-item {
  display: grid;
  grid-template-columns: 26px 46px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.reco-item:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(59, 130, 246, 0.28); }

.reco-rank {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding-top: 2px;
}

.reco-thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.reco-main { min-width: 0; }

.reco-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.reco-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reco-score {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #60a5fa;
  flex-shrink: 0;
}

.reco-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.reco-geo { color: #fbbf24; font-weight: 600; }

/* Signal bars: the four inputs to the score, so the ranking is auditable */
.reco-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.reco-bar-item { display: flex; flex-direction: column; gap: 2px; }

.reco-bar-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.8;
}

.reco-bar-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.reco-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.bar-geo      { background: #fbbf24; }
.bar-local    { background: #34d399; }
.bar-interest { background: #a78bfa; }
.bar-fresh    { background: #38bdf8; }

.reco-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.5rem; }

.reco-reason {
  font-size: 0.63rem;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
}

/* Coverage gaps: a diverging bar around a centre line */
.reco-gaps { display: flex; flex-direction: column; gap: 5px; }

.gap-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 40px;
  gap: 0.5rem;
  align-items: center;
}

.gap-cat {
  font-size: 0.7rem;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gap-track {
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.gap-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
}

.gap-fill { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; }
.gap-under { background: rgba(52, 211, 153, 0.65); }
.gap-over  { background: rgba(244, 63, 94, 0.55); }

.gap-value {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: right;
}
.gap-under-text { color: #34d399; }
.gap-over-text  { color: #fb7185; }

.gap-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Dateline health: the ceiling on geographic matching */
.reco-health { display: flex; flex-direction: column; gap: 0.7rem; }

.health-headline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.health-good { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.25); }
.health-warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.25); }
.health-bad  { background: rgba(244, 63, 94, 0.1);  border-color: rgba(244, 63, 94, 0.25); }

.health-pct {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
}

.health-label { font-size: 0.7rem; color: var(--text-muted); line-height: 1.35; }

.health-list-title {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.health-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 0.5rem;
  padding: 3px 0;
  font-size: 0.68rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.health-item-loc {
  color: #fb7185;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-item-title {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User Profile Pill & Sign Out (Compact Executive Edition) */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 2px 8px 2px 3px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.user-profile-badge:hover {
  background: rgba(22, 34, 60, 0.95);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.2);
}

.user-avatar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.user-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  border: 1px solid #0f172a;
  box-shadow: 0 0 6px #10b981;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1;
}

.user-name {
  font-size: 0.71rem;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1320px) {
  .user-name {
    display: none;
  }
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.28);
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.1;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 3px 7px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-sm);
  color: #fda4af;
  font-family: var(--font-sans);
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout svg {
  width: 12px;
  height: 12px;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.btn-logout:active {
  transform: translateY(0);
}

/* ==========================================================
   API INTEGRATION HUB & EXTERNAL CONNECTORS STYLING
   ========================================================== */

.btn-integration {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.82rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(6, 182, 212, 0.18));
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: var(--radius-sm);
  color: #e0e7ff;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-integration:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(6, 182, 212, 0.32));
  border-color: rgba(99, 102, 241, 0.8);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-integration svg {
  color: #a5b4fc;
}

.modal-container-wide {
  max-width: 900px !important;
  width: 95% !important;
}

.integration-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.integration-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-sm {
  padding: 0.32rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-outline-cyan {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
}

.btn-outline-cyan:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: rgba(6, 182, 212, 0.6);
  color: #ffffff;
}

/* Pipeline Status Grid */
.pipeline-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pipeline-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
}

.pipe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.pipe-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pipe-indicator {
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.pipe-indicator.ok {
  color: #34d399;
}

.pipe-indicator.err {
  color: #f87171;
}

.pipe-val-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pipe-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.pipe-latency {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.pipe-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Integration Tabs */
.integration-tabs-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.25rem;
  padding-bottom: 0.25rem;
  overflow-x: auto;
}

.int-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.int-tab-btn:hover {
  color: #e2e8f0;
}

.int-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.int-tab-btn svg {
  color: inherit;
}

.int-tab-panel {
  display: none;
}

.int-tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Connector Blocks */
.connector-block {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-left: 4px solid var(--accent-cyan);
}

.connector-block:nth-child(2) {
  border-left-color: #6366f1;
}

.connector-block:nth-child(3) {
  border-left-color: #f59e0b;
}

.connector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.connector-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.connector-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.connector-icon.icon-feed {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.connector-icon.icon-ems {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.connector-icon.icon-crm {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.connector-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.connector-desc {
  margin: 0.2rem 0 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Presets Pills */
.preset-pill-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.preset-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

.preset-pill.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.6);
  color: #e0e7ff;
}

/* Connector Form Grid */
.connector-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-input, .form-select {
  padding: 0.52rem 0.8rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #f1f5f9;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.form-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  gap: 0.4rem;
}

.btn-input-action {
  padding: 0.52rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-input-action:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.btn-group-row {
  display: flex;
  gap: 0.5rem;
}

.connector-test-result {
  margin-top: 0.85rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.connector-test-result.ok {
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
  background: rgba(6, 78, 59, 0.2);
}

.connector-test-result.err {
  border-color: rgba(248, 113, 113, 0.4);
  color: #f87171;
  background: rgba(127, 29, 29, 0.2);
}

/* Save Footer */
.integration-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 1rem;
}

.auto-sync-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.save-status-msg {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

/* TAB 2: Key Management Box */
.key-management-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border-left: 4px solid var(--accent-cyan);
}

.key-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.key-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.key-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-box-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.key-box-desc {
  margin: 0.25rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.key-display-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.key-code-display {
  flex: 1;
  min-width: 280px;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-mask-toggle {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.btn-mask-toggle:hover {
  color: #ffffff;
}

.key-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.spec-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.spec-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.spec-value {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.spec-value code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.spec-value.highlight {
  color: #34d399;
}

/* TAB 3: Snippets & Docs */
.snippets-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.snippet-lang-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.snip-lang-btn {
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.snip-lang-btn:hover {
  color: #ffffff;
}

.snip-lang-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.5);
  color: #67e8f9;
}

.code-box-wrapper {
  position: relative;
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.btn-copy-snippet {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-snippet:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.code-pre {
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #f1f5f9;
  overflow-x: auto;
  max-height: 320px;
}

.docs-promo-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.docs-promo-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.docs-promo-card h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  color: #f8fafc;
}

.docs-promo-card p {
  margin: 0 0 0.85rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* TAB 4: Live Tester */
.tester-container {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.tester-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tester-auth-row {
  margin-bottom: 1rem;
}

.tester-response-card {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
}

.tester-res-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.5rem;
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #34d399;
}

.latency-badge {
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.tester-res-body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #e2e8f0;
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   Publishing Bureau & Country Filter Bar (Upfront Gateway)
   ========================================================================== */

.bureau-filter-section {
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.6rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(59, 130, 246, 0.12);
  position: relative;
  overflow: hidden;
}

.bureau-filter-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #8b5cf6);
}

.bureau-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.bureau-badge-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
}

.bureau-filter-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bureau-filter-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 650px;
  line-height: 1.45;
}

.bureau-filter-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 6px 14px;
}

.status-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-inactive {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.dot-active {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.bureau-status-text {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.bureau-filter-controls {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.bureau-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 240px;
}

.bureau-control-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
}

.bureau-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.bureau-select:hover:not(:disabled) {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.bureau-select:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.35);
}

.bureau-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.4);
}

.bureau-select option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 8px 12px;
}

.bureau-control-actions {
  display: flex;
  align-items: center;
}

.btn-secondary-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #f43f5e;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-secondary-outline:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #fff;
}

.btn-fetch-live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38bdf8;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-fetch-live:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.spinning {
  animation: spin 0.8s linear infinite !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fetch-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  border: 1px solid #38bdf8;
  box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.4);
  color: #f8fafc;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.fetch-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Gateway Empty State Panel */
.bureau-gateway-panel {
  margin: 1.5rem 0 2.5rem;
}

.gateway-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(10, 15, 30, 0.95));
  border: 1px dashed rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.gateway-icon-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(6, 182, 212, 0.18));
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.2);
}

.gateway-heading {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.6rem;
}

.gateway-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 2rem;
  line-height: 1.55;
}

.gateway-text strong {
  color: #38bdf8;
}

/* Quick Bureau Cards Grid */
.quick-bureau-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto;
}

.quick-bureau-card {
  background: rgba(18, 26, 44, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.quick-bureau-card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  background: rgba(30, 41, 69, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(59, 130, 246, 0.25);
}

.quick-bureau-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-bureau-flag {
  font-size: 1.4rem;
}

.quick-bureau-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  padding: 2px 7px;
  border-radius: 9999px;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.quick-bureau-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.quick-bureau-country {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.quick-bureau-reads {
  font-size: 0.72rem;
  color: #38bdf8;
  font-family: var(--font-mono);
  margin-top: 0.25rem;
}

/* Active Bureau Scope Banner */
.active-bureau-banner {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.banner-pin {
  font-size: 1.35rem;
}

.banner-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
}

.banner-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.banner-stat-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 10px;
  border-radius: 9999px;
}

.banner-stat-chip.chip-views {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
}

/* ==========================================================================
   Theme Toggle Button & Light Mode Design System
   ========================================================================== */

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Light Mode Theme Variables & Component Overrides
   -------------------------------------------------------------------------- */

html[data-theme="light"],
body.light-theme {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: rgba(248, 250, 252, 0.98);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(37, 99, 235, 0.3);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.1);

  background-color: #f8fafc;
  color: #0f172a;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(139, 92, 246, 0.04) 0%, transparent 40%);
}

/* Header & Navigation in Light Mode */
body.light-theme .app-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

body.light-theme .brand-app {
  color: #0f172a;
}

body.light-theme .brand-logo-badge {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.light-theme .app-nav-tabs {
  background: #e2e8f0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

body.light-theme .nav-tab-link {
  color: #475569;
}

body.light-theme .nav-tab-link:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.85);
}

body.light-theme .nav-tab-link.active {
  color: #0284c7;
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

body.light-theme .time-filter-group {
  background: #e2e8f0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

body.light-theme .time-btn {
  color: #475569;
}

body.light-theme .time-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.8);
}

body.light-theme .time-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

body.light-theme .theme-toggle-btn {
  background: #e2e8f0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #475569;
}

body.light-theme .theme-toggle-btn:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

body.light-theme .btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

body.light-theme .btn-primary:hover {
  background: #1d4ed8;
}

body.light-theme .user-profile-badge {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

body.light-theme .user-name {
  color: #0f172a;
}

body.light-theme .user-role-badge {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0284c7;
}

body.light-theme .btn-logout {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
  color: #e11d48;
}

body.light-theme .btn-logout:hover {
  background: rgba(244, 63, 94, 0.15);
}

/* Bureau Filter Section in Light Mode */
body.light-theme .bureau-filter-section {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

body.light-theme .bureau-filter-title {
  color: #0f172a;
}

body.light-theme .bureau-filter-subtitle {
  color: #475569;
}

body.light-theme .bureau-filter-status {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .bureau-status-text {
  color: #0f172a;
}

body.light-theme .bureau-control-label {
  color: #475569;
}

body.light-theme .bureau-select {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .bureau-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

body.light-theme .bureau-select option {
  background: #ffffff;
  color: #0f172a;
}

body.light-theme .bureau-select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .btn-secondary-outline {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #475569;
}

body.light-theme .btn-secondary-outline:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.2);
}

/* Gateway & Quick Bureau Cards in Light Mode */
body.light-theme .gateway-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body.light-theme .gateway-heading {
  color: #0f172a;
}

body.light-theme .gateway-text {
  color: #475569;
}

body.light-theme .quick-bureau-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

body.light-theme .quick-bureau-card:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}

body.light-theme .quick-bureau-name {
  color: #0f172a;
}

body.light-theme .quick-bureau-country {
  color: #64748b;
}

body.light-theme .quick-bureau-reads {
  color: #475569;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .quick-bureau-count {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Active Bureau Scope Banner in Light Mode */
body.light-theme .active-bureau-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.06);
}

body.light-theme .banner-title {
  color: #0f172a;
}

body.light-theme .banner-sub {
  color: #475569;
}

/* KPIs in Light Mode */
body.light-theme .kpi-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .kpi-card:hover {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body.light-theme .kpi-label {
  color: #64748b;
}

body.light-theme .kpi-value {
  color: #0f172a;
}

body.light-theme .kpi-sub {
  color: #64748b;
}

/* Analytics Panels & Chart Cards in Light Mode */
body.light-theme .panel-card,
body.light-theme .chart-card,
body.light-theme .chart-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .panel-title,
body.light-theme .chart-title {
  color: #0f172a;
}

body.light-theme .panel-subtitle,
body.light-theme .chart-subtitle {
  color: #64748b;
}

/* Feed Table in Light Mode */
body.light-theme .feed-table-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .feed-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .feed-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

body.light-theme .feed-table tr:hover td {
  background: #f8fafc;
}

body.light-theme .story-title-cell a {
  color: #0f172a;
}

body.light-theme .story-title-cell a:hover {
  color: #2563eb;
}

body.light-theme .table-search-input {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

body.light-theme .table-search-input::placeholder {
  color: #94a3b8;
}

body.light-theme .category-filter-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .category-filter-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body.light-theme .category-filter-pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Recommendations Studio in Light Mode */
body.light-theme .reco-hero-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

body.light-theme .reco-hero-title {
  color: #0f172a;
}

body.light-theme .reco-hero-desc {
  color: #475569;
}

body.light-theme .reco-kpi-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .reco-kpi-value {
  color: #0f172a;
}

body.light-theme .audience-selector-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .aud-pill-btn {
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #475569;
}

body.light-theme .aud-pill-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body.light-theme .aud-pill-btn.active {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.18);
}

body.light-theme .candidate-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .candidate-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: rgba(37, 99, 235, 0.3);
}

body.light-theme .candidate-title {
  color: #0f172a;
}

body.light-theme .gap-card,
body.light-theme .integrity-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .gap-title,
body.light-theme .integrity-title {
  color: #0f172a;
}

/* ==========================================================================
   ANALYST TERRITORY & RBAC CONTROL STYLING
   ========================================================================== */

.nav-tab-link.admin-only-tab {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm, 6px);
  transition: all 0.2s ease;
  font-size: 0.72rem;
}

.nav-tab-link.admin-only-tab:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

body.light-theme .nav-tab-link.admin-only-tab {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0284c7;
}

body.light-theme .nav-tab-link.admin-only-tab:hover {
  background: rgba(2, 132, 199, 0.15);
  color: #0369a1;
}

/* Scope Pill in Bureau Filter Section */
.analyst-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
  animation: fadeInPill 0.3s ease-out;
}

body.light-theme .analyst-scope-pill {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.12);
}

@keyframes fadeInPill {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #0b132b;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  width: 100%;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(56, 189, 248, 0.25);
  position: relative;
  margin: auto 0;
  animation: modalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .modal-dialog {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(2, 132, 199, 0.2);
}

.modal-dialog.modal-lg {
  max-width: 960px;
}

.modal-dialog.modal-xl {
  max-width: 1360px;
  width: 96vw;
}

.modal-header {
  padding: 1.15rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: #0f172a;
  flex-shrink: 0;
}

body.light-theme .modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: #f8fafc;
}

.modal-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 0.25rem;
}

body.light-theme .modal-badge {
  color: #0284c7;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.light-theme .modal-title {
  color: #0f172a;
}

.modal-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}

body.light-theme .modal-subtitle {
  color: #64748b;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: #ffffff;
}

body.light-theme .modal-close-btn:hover {
  color: #0f172a;
}

.modal-body {
  padding: 1.25rem 1.6rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1 1 auto;
  min-height: 0;
}

/* Toolbar */
.analyst-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-pill {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  color: #cbd5e1;
}

body.light-theme .count-pill {
  background: #f1f5f9;
  color: #475569;
}

/* Create Analyst Form */
.create-analyst-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 1.1rem;
}

body.light-theme .create-analyst-panel {
  background: #f8fafc;
  border-color: rgba(2, 132, 199, 0.25);
}

.subheading {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.light-theme .subheading {
  color: #0f172a;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

body.light-theme .form-group label {
  color: #475569;
}

.form-input {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  color: #f8fafc;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: #38bdf8;
}

body.light-theme .form-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-theme .form-input:focus {
  border-color: #0284c7;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

/* Analysts Table */
.analyst-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: calc(90vh - 230px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  position: relative;
}

body.light-theme .analyst-table-wrapper {
  border-color: rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

.analyst-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  text-align: left;
}

/* Sticky First Column: Employee Identity is NEVER cut off */
.analyst-table th:first-child,
.analyst-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #0f172a;
}

body.light-theme .analyst-table th:first-child,
body.light-theme .analyst-table td:first-child {
  background: #ffffff;
}

.analyst-table th:first-child {
  z-index: 25;
  background: #0f172a;
}

body.light-theme .analyst-table th:first-child {
  background: #f1f5f9;
}

.analyst-table th:first-child,
.analyst-table td:first-child {
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.35);
}

body.light-theme .analyst-table th:first-child,
body.light-theme .analyst-table td:first-child {
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
}

.analyst-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0f172a;
  padding: 0.85rem 1rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

body.light-theme .analyst-table th {
  background: #f1f5f9;
  color: #475569;
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.analyst-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  vertical-align: middle;
}

body.light-theme .analyst-table td {
  border-bottom-color: rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

.analyst-table tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}

body.light-theme .analyst-table tr:hover td {
  background: #f8fafc;
}

.analyst-table th:last-child,
.analyst-table td:last-child {
  text-align: right;
  padding-right: 1.25rem;
}

.user-identity-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-cell-meta {
  display: flex;
  flex-direction: column;
}

.user-cell-name {
  font-weight: 600;
  color: #f8fafc;
}

body.light-theme .user-cell-name {
  color: #0f172a;
}

.user-cell-username {
  font-size: 0.7rem;
  color: #94a3b8;
}

body.light-theme .user-cell-username {
  color: #64748b;
}

.role-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-tag.role-admin {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-tag.role-analyst {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

body.light-theme .role-tag.role-admin {
  background: rgba(147, 51, 234, 0.1);
  color: #7e22ce;
  border-color: rgba(147, 51, 234, 0.25);
}

body.light-theme .role-tag.role-analyst {
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.25);
}

.locations-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.loc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  color: #cbd5e1;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.light-theme .loc-badge {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.loc-badge.universal {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

body.light-theme .loc-badge.universal {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
}

.loc-badge.loc-badge-none {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

body.light-theme .loc-badge.loc-badge-none {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

/* Drawer / Territory Editor */
.edit-allotment-drawer {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  animation: slideDownDrawer 0.2s ease-out;
}

body.light-theme .edit-allotment-drawer {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

@keyframes slideDownDrawer {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.drawer-header h4 {
  margin: 0;
  font-size: 0.92rem;
  color: #f8fafc;
}

body.light-theme .drawer-header h4 {
  color: #0f172a;
}

.highlight-text {
  color: #38bdf8;
  font-weight: 700;
}

body.light-theme .highlight-text {
  color: #0284c7;
}

.close-drawer-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.drawer-quick-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-tag:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #ffffff;
}

body.light-theme .btn-tag {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

body.light-theme .btn-tag:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0284c7;
}

.offices-selector-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.country-offices-group {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.75rem;
}

body.light-theme .country-offices-group {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

.country-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #cbd5e1;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

body.light-theme .country-group-title {
  color: #334155;
}

.office-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: #94a3b8;
  margin-bottom: 0.4rem;
  cursor: pointer;
  user-select: none;
}

body.light-theme .office-checkbox-label {
  color: #475569;
}

.office-checkbox-label input[type="checkbox"] {
  accent-color: #0284c7;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.drawer-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .drawer-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.save-status-msg {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4ade80;
}

body.light-theme .save-status-msg {
  color: #16a34a;
}

.btn-delete-story:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
  transform: scale(1.05);
}

/* ==========================================
   MODERN EMPLOYEE ACCESS & USER DIRECTORY STYLES
   ========================================== */

.modal-dialog.modal-xl {
  max-width: 1360px;
  width: 96vw;
}

.nav-counter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #38bdf8;
  color: #0b1329;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 9999px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
  line-height: 1;
}

body.light-theme .nav-counter-pill {
  background: #0284c7;
  color: #ffffff;
}

.analyst-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .analyst-modal-toolbar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.toolbar-stats-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-controls-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.badge-ems-synced {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.search-filter-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-filter-box .search-icon {
  position: absolute;
  left: 0.65rem;
  color: #64748b;
  pointer-events: none;
}

.user-search-input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.65rem 0.4rem 2rem;
  font-size: 0.74rem;
  color: #f8fafc;
  width: 210px;
  outline: none;
  transition: all 0.2s;
}

.user-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  width: 250px;
}

body.light-theme .user-search-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-theme .user-search-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.user-filter-select {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.74rem;
  color: #cbd5e1;
  outline: none;
  cursor: pointer;
}

body.light-theme .user-filter-select {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-sync-roster {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sync-roster:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-sync-roster.loading {
  opacity: 0.75;
  cursor: wait;
}

.spin-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.roster-sync-banner {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.76rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.2s ease;
}

.roster-sync-banner.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.roster-sync-banner.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* User Identity Cell enhancements */
.user-cell-name-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.source-badge {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.source-badge.ems-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.source-badge.local-badge {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.emp-code-pill {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

body.light-theme .emp-code-pill {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

.user-office-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

body.light-theme .user-office-sub {
  color: #64748b;
}

/* Designation Chip */
.designation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  text-transform: capitalize;
}

body.light-theme .designation-chip {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

.designation-chip .desig-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.designation-chip .desig-text {
  white-space: nowrap;
}

/* Role Badges */
.role-tag {
  white-space: nowrap;
}

.role-tag.role-manager {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.role-tag.role-reporter {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-tag.role-editor {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

body.light-theme .role-tag.role-manager {
  background: rgba(202, 138, 4, 0.12);
  color: #a16207;
  border-color: rgba(202, 138, 4, 0.3);
}

body.light-theme .role-tag.role-reporter {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.25);
}

body.light-theme .role-tag.role-editor {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  border-color: rgba(79, 70, 229, 0.25);
}

/* Department Pill */
.dept-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}

body.light-theme .dept-pill {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.loc-badge-more {
  font-size: 0.65rem;
  color: #94a3b8;
  align-self: center;
  font-weight: 600;
  white-space: nowrap;
}

/* Status Button Toggle */
.btn-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-status-toggle.status-active {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.btn-status-toggle.status-inactive {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-dot-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.status-dot-inactive {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f87171;
}

.row-suspended {
  opacity: 0.6;
  background: rgba(239, 68, 68, 0.03);
}

/* Action Buttons */
.user-actions-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-action-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.32rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-action-icon:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-action-delete {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
}

.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

body.light-theme .btn-action-icon {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

body.light-theme .btn-action-icon:hover {
  background: rgba(2, 132, 199, 0.1);
  border-color: #0284c7;
  color: #0284c7;
}
  color: #0284c7;
}

/* Form Layout enhancements */
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .form-row-3, .form-row-4 {
    grid-template-columns: 1fr;
  }
}

.panel-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.pill-badge-info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

span.req {
  color: #f87171;
  font-weight: 700;
}




