/* ═══════════════════════════════════════════════════════
   CarbonCrunch Integration Hub — Design System
   Modern dark glassmorphism with vibrant accents
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-deep: #05080f;
  --bg-surface: #0c1220;
  --bg-card: rgba(16, 24, 48, 0.75);
  --bg-card-hover: rgba(22, 34, 66, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-hover: rgba(255, 255, 255, 0.12);

  --accent-cyan: #00d4ff;
  --accent-cyan-glow: rgba(0, 212, 255, 0.25);
  --accent-green: #00e68a;
  --accent-green-glow: rgba(0, 230, 138, 0.2);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.2);
  --accent-orange: #f97316;
  --accent-red: #ef4444;

  --text-primary: #f0f4f8;
  --text-secondary: #7c8db5;
  --text-muted: #4a5a7a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

/* Ambient glow effects */
body::before {
  content: "";
  position: fixed;
  top: -15%;
  right: -10%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(
    circle,
    rgba(0, 212, 255, 0.08) 0%,
    transparent 70%
  );
  z-index: -1;
  animation: ambientDrift 20s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  bottom: -15%;
  left: -10%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.06) 0%,
    transparent 70%
  );
  z-index: -1;
  animation: ambientDrift 25s ease-in-out infinite alternate-reverse;
}

@keyframes ambientDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(30px, -20px) scale(1.05);
  }
}

.app-container {
  display: flex;
  height: 100vh;
}

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  width: 270px;
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.25rem;
  z-index: 10;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding-left: 0.75rem;
}

.logo-ring {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, #a5b4c8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #fff;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.12);
}
.nav-item.active i {
  color: var(--accent-cyan);
}

/* Sidebar Org Badge */
.sidebar-org-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-top: auto;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.org-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
}

.org-meta {
  display: flex;
  flex-direction: column;
}
.org-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.org-plan {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  position: relative;
}

.pulse.green {
  background: var(--accent-green);
}
.pulse.green::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-green);
  animation: pulseAnim 2s infinite;
}

.pulse.red {
  background: var(--accent-red);
}
.pulse.red::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-red);
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* ═══════════ MAIN CONTENT ═══════════ */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar {
  width: 6px;
}
.main-content::-webkit-scrollbar-track {
  background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.top-bar h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.org-chip {
  background: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ═══════════ BADGES & PILLS ═══════════ */
.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.badge.pro {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
}
.badge.status-active,
.badge.status-oauth_completed,
.badge.status-source_created {
  background: rgba(0, 230, 138, 0.12);
  color: var(--accent-green);
}
.badge.status-oauth_pending,
.badge.status-connection_created,
.badge.status-initial_sync_running {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
}
.badge.status-failed,
.badge.status-sync_failed {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}
.badge.status-token_expired {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
}
.badge.status-disconnected,
.badge.status-paused {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.pill {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition);
}
.pill:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}
.pill.active {
  background: rgba(16, 24, 48, 0.98);
  border: 1px solid var(--glass-border);
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

/* ═══════════ RESOURCE SELECTOR ═══════════ */
.resource-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.resource-item-card {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resource-item-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--accent-cyan-glow);
}

.resource-item-card.selected {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-cyan);
}

.resource-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 1.25rem;
  color: var(--accent-cyan);
}

.resource-meta {
  flex: 1;
}

.resource-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.modal-footer {
  background: rgba(255, 255, 255, 0.02);
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

/* ═══════════ BUTTONS ═══════════ */
.btn {
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0098b3);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-cyan-glow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
}
.full-width {
  width: 100%;
  justify-content: center;
}
.link-btn {
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ═══════════ GLASS PANELS ═══════════ */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.panel {
  padding: 1.5rem;
}

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

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h2 i {
  color: var(--accent-cyan);
  font-size: 0.9rem;
}

/* ═══════════ SECTIONS ═══════════ */
.content-section {
  display: none;
  animation: sectionFade 0.35s ease-out;
}
.content-section.active {
  display: block;
}

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

.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.section-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}
.section-desc code {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

.section-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.section-header-bar h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

/* ═══════════ KPI GRID ═══════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: var(--transition);
}
.kpi-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-hover);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  margin: 0.25rem 0;
}
.kpi-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi-sub.positive {
  color: var(--accent-green);
}
.kpi-sub i {
  margin-right: 0.25rem;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.kpi-icon.accent-cyan {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}
.kpi-icon.accent-green {
  background: rgba(0, 230, 138, 0.1);
  color: var(--accent-green);
}
.kpi-icon.accent-purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
}

/* ═══════════ DASHBOARD GRID ═══════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Platform Mini Cards */
.platform-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.platform-mini-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  cursor: pointer;
}
.platform-mini-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.03);
}

.platform-mini-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.platform-mini-icon.sheets {
  background: rgba(52, 168, 83, 0.15);
  color: #34a853;
}
.platform-mini-icon.sap {
  background: rgba(0, 105, 180, 0.15);
  color: #0069b4;
}
.platform-mini-icon.salesforce {
  background: rgba(0, 161, 224, 0.15);
  color: #00a1e0;
}
.platform-mini-icon.hubspot {
  background: rgba(255, 122, 89, 0.15);
  color: #ff7a59;
}
.platform-mini-icon.quickbooks {
  background: rgba(44, 160, 28, 0.15);
  color: #2ca01c;
}
.platform-mini-icon.default {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}

.platform-mini-info {
  display: flex;
  flex-direction: column;
}
.platform-mini-info .p-name {
  font-weight: 600;
  font-size: 0.85rem;
}
.platform-mini-info .p-status {
  font-size: 0.72rem;
  font-weight: 600;
}
.p-status.active {
  color: var(--accent-green);
}
.p-status.sync_failed {
  color: var(--accent-red);
}
.p-status.failed {
  color: var(--accent-red);
}
.p-status.inactive {
  color: var(--text-muted);
}
.p-status.oauth_pending {
  color: var(--accent-cyan);
}
.p-status.token_expired {
  color: var(--accent-orange);
}
.p-status.connection_created {
  color: var(--accent-purple);
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-dot.succeeded {
  background: var(--accent-green);
}
.activity-dot.active {
  background: var(--accent-green);
}
.activity-dot.running {
  background: var(--accent-cyan);
  animation: pulseAnim 1.5s infinite;
}
.activity-dot.initial_sync_running {
  background: var(--accent-cyan);
  animation: pulseAnim 1.5s infinite;
}
.activity-dot.failed {
  background: var(--accent-red);
}
.activity-dot.sync_failed {
  background: var(--accent-red);
}
.activity-dot.pending {
  background: var(--text-muted);
}
.activity-dot.oauth_pending {
  background: var(--accent-cyan);
}
.activity-dot.token_expired {
  background: var(--accent-orange);
}

.activity-details {
  flex: 1;
}
.activity-details .a-platform {
  font-weight: 600;
  font-size: 0.85rem;
}
.activity-details .a-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.activity-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}
.activity-badge.succeeded {
  background: rgba(0, 230, 138, 0.1);
  color: var(--accent-green);
}
.activity-badge.active {
  background: rgba(0, 230, 138, 0.1);
  color: var(--accent-green);
}
.activity-badge.running {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}
.activity-badge.initial_sync_running {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}
.activity-badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}
.activity-badge.sync_failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}
.activity-badge.oauth_pending {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}
.activity-badge.token_expired {
  background: rgba(249, 115, 22, 0.1);
  color: var(--accent-orange);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.empty-state-mini {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.empty-state-mini i {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  display: block;
}
.empty-state-mini p {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* ═══════════ CONNECTIONS GRID ═══════════ */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.connection-card {
  padding: 1.75rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.connection-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-3px);
}

.connection-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.connection-card.active::before {
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}
.connection-card.initial_sync_running::before {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
}
.connection-card.oauth_pending::before,
.connection-card.connection_created::before {
  background: var(--accent-cyan);
}
.connection-card.failed::before,
.connection-card.sync_failed::before {
  background: var(--accent-red);
}
.connection-card.token_expired::before {
  background: var(--accent-orange);
}
.connection-card.disconnected::before {
  background: var(--text-muted);
}

.conn-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.conn-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.conn-header-info {
  flex: 1;
}
.conn-header-info h3 {
  font-size: 1rem;
  font-weight: 700;
}
.conn-header-info .conn-platform {
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
}

.conn-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.conn-stat {
  display: flex;
  flex-direction: column;
}
.conn-stat label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.conn-stat span {
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.conn-actions {
  display: flex;
  gap: 0.5rem;
}

/* ═══════════ CONNECTOR CATALOG ═══════════ */
.connector-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.connector-card {
  padding: 1.75rem;
  transition: var(--transition);
  position: relative;
}
.connector-card:hover {
  border-color: var(--glass-border-hover);
}

.connector-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.sheets-icon {
  background: rgba(52, 168, 83, 0.15);
  color: #34a853;
}
.sap-icon {
  background: rgba(0, 105, 180, 0.15);
  color: #0069b4;
}
.sf-icon {
  background: rgba(0, 161, 224, 0.15);
  color: #00a1e0;
}
.hubspot-icon {
  background: rgba(255, 122, 89, 0.15);
  color: #ff7a59;
}
.postgres-icon {
  background: rgba(51, 103, 145, 0.15);
  color: #336791;
}

.connector-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.connector-card > p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.connector-trigger {
  width: 100%;
  justify-content: center;
}

/* Connector Form */
.connector-form {
  margin-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: #fff;
  width: 100%;
  font-size: 0.88rem;
  transition: var(--transition);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}
input::placeholder {
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ═══════════ TABLE ═══════════ */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: rgba(0, 0, 0, 0.2);
}

th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  font-size: 0.88rem;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.empty-table {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem !important;
}

.status-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
}
.st-succeeded {
  color: var(--accent-green);
  background: rgba(0, 230, 138, 0.1);
}
.st-running {
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.1);
}
.st-failed {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}
.st-pending {
  color: var(--text-muted);
  background: rgba(74, 90, 122, 0.2);
}
.st-cancelled {
  color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.1);
}

/* ═══════════ PROFILE ═══════════ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.profile-card {
  padding: 2rem;
}
.profile-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.profile-card h3 i {
  color: var(--accent-cyan);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
}

.profile-header > div {
  flex: 1;
}
.profile-header h3 {
  font-size: 1.25rem;
  margin-bottom: 0.15rem;
}
.profile-industry {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
}
.detail-row i {
  width: 18px;
  text-align: center;
  color: var(--accent-cyan);
  font-size: 0.85rem;
}
.detail-row span {
  color: var(--text-secondary);
}

/* Output Files */
.output-files {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.output-file {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.output-file:last-child {
  border-bottom: none;
}
.output-file i {
  color: var(--accent-cyan);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}
.file-name {
  font-weight: 600;
  font-size: 0.88rem;
  display: block;
}
.file-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Code Viewer */
.code-viewer {
  background: #000;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  color: var(--accent-green);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ═══════════ TOAST NOTIFICATIONS ═══════════ */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 9999;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastSlide 0.35s ease-out;
  min-width: 280px;
  font-size: 0.88rem;
}

.toast.success {
  border-left: 3px solid var(--accent-green);
}
.toast.error {
  border-left: 3px solid var(--accent-red);
}
.toast.info {
  border-left: 3px solid var(--accent-cyan);
}

.toast.success i {
  color: var(--accent-green);
}
.toast.error i {
  color: var(--accent-red);
}
.toast.info i {
  color: var(--accent-cyan);
}

@keyframes toastSlide {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ═══════════ MODAL STYLES ═══════════ */
.close-modal,
.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}
.close-modal:hover,
.close-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

#modal-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

/* ═══════════ LOADING SPINNER ═══════════ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .connector-catalog {
    grid-template-columns: 1fr;
  }
  .connections-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    padding: 1.5rem;
  }
  .top-bar {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

/* ═══════════ NEW DATASET EXPLORER STYLES ═══════════ */
.quality-cell {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  width: 60px;
}
.quality-cell.high {
  background: rgba(0, 230, 138, 0.15);
  color: var(--accent-green);
}
.quality-cell.medium {
  background: rgba(255, 212, 0, 0.15);
  color: var(--accent-yellow);
}
.quality-cell.low {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.action-group {
  display: flex;
  gap: 0.5rem;
}
.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}
.btn-icon:hover {
  background: var(--accent-cyan);
  color: #000;
  transform: scale(1.1);
}
.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: none; /* Hidden by default toggled by JS */
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@keyframes modalPop {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.modal-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
}
.preview-meta-bar {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.preview-table-container {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}
.preview-table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.preview-table-container th {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  text-align: left;
  position: sticky;
  top: 0;
}
.preview-table-container td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logs-viewer {
  background: #000;
  color: #0f0;
  font-family: "Fira Code", monospace;
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.log-entry {
  margin-bottom: 0.4rem;
}
.log-entry.error {
  color: #ff5555;
}
.log-entry.warn {
  color: #ffb86c;
}
.log-time {
  color: #6272a4;
  margin-right: 0.5rem;
}
.log-step {
  color: #8be9fd;
  font-weight: bold;
}

.quality-report-body {
  padding: 2rem;
  text-align: center;
}
.quality-score-big {
  font-size: 4rem;
  font-weight: 900;
  background: var(--grad-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2rem;
}
.quality-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.q-metric {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  text-align: left;
}
.q-metric label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.q-metric span {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.id-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ═══════════ DATA LAKE EXPLORER ═══════════ */
.lake-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.bucket-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bucket-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

.bucket-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bucket-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.bucket-info h3 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-primary);
}

.bucket-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.bucket-stats {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}

.b-stat {
  display: flex;
  flex-direction: column;
}

.b-stat label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.b-stat span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.b-stat.count span {
  color: var(--accent-cyan);
}

.lake-live-preview {
  display: block;
  max-width: 500px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.lake-live-row:hover .lake-live-preview {
  color: var(--text-primary);
}

/* OAuth & Auth Sub-fields */
.auth-sub-fields {
  margin-bottom: 1rem;
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-notice {
  display: flex !important;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
}

.auth-notice i {
  font-size: 1.1rem;
  margin-top: 2px;
}

.auth-notice div {
  flex: 1;
}

.auth-notice.success {
  background: rgba(0, 230, 138, 0.05);
  border-color: rgba(0, 230, 138, 0.15);
  color: #a0ffcf;
}

.auth-notice.oauth {
  background: rgba(0, 212, 255, 0.05);
  border-color: rgba(0, 212, 255, 0.15);
  color: #a0f0ff;
}

.auth-notice.info {
  background: rgba(139, 92, 246, 0.05);
  border-color: rgba(139, 92, 246, 0.15);
  color: #d1c1ff;
}

.auth-notice strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

.copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

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