:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101522;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 55, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.45);
  
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background cyber glow effect */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.05) 50%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: 15%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(244, 63, 94, 0.03) 60%, transparent 70%);
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

/* Header & Nav */
header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.logo-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-link {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-indigo);
  color: #fff;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 5px 12px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.pulsing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 1.8s infinite;
}

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

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 980px;
  margin: 0 auto 36px;
}

.hero-tagline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #a5b4fc;
  margin-bottom: 16px;
}

.hero-section h2 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.hero-section h2 .gradient-text {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Main Nav Tabs */
.main-nav-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.nav-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

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

.nav-tab.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-indigo);
  color: #fff;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* Main Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  align-items: start;
}

.sticky-col {
  position: sticky;
  top: 20px;
}

/* Section Panels */
.section-panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Filter Buttons */
.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

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

.filter-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-indigo);
  color: #fff;
}

/* Service Cards Grid (Scrollable Container) */
.services-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom Scrollbar */
.services-list::-webkit-scrollbar,
.stream-logs::-webkit-scrollbar,
pre.code-view::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.services-list::-webkit-scrollbar-thumb,
.stream-logs::-webkit-scrollbar-thumb,
pre.code-view::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.service-card {
  background: rgba(16, 21, 34, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.service-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.service-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.15);
}

.service-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.service-name {
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: capitalize;
  flex-shrink: 0;
}

.status-badge.operational {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.status-badge.degraded {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  animation: pulse-warn 2s infinite;
}

.status-badge.outage {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--accent-rose);
  animation: pulse-warn 1.5s infinite;
}

@keyframes pulse-warn {
  0% { opacity: 0.85; }
  50% { opacity: 1; filter: brightness(1.2); }
  100% { opacity: 0.85; }
}

.service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.etag-tag {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* Incident Box */
.incident-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.incident-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.incident-scope {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #fbbf24;
  font-weight: 600;
}

.incident-summary {
  font-size: 0.88rem;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.agent-hint-banner {
  background: rgba(99, 102, 241, 0.15);
  border-left: 3px solid var(--accent-indigo);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 0.82rem;
  color: #c7d2fe;
}

.agent-hint-banner strong {
  color: #38bdf8;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.72rem;
  display: block;
  margin-bottom: 3px;
}

/* Preflight Checkbox Selector */
.preflight-deps-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.dep-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dep-checkbox-label input {
  accent-color: var(--accent-indigo);
  cursor: pointer;
}

.dep-checkbox-label.checked {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-indigo);
  color: #fff;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), #4f46e5);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-active);
}

/* Code Preview Terminal */
.terminal-block {
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.terminal-header {
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-title {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

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

pre.code-view {
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #cbd5e1;
  overflow-x: auto;
  max-height: 280px;
}

/* Form Styles */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(16, 21, 34, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-active);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.25s ease-out;
  max-width: 380px;
}

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

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}

.toast.toast-info {
  border-color: rgba(6, 182, 212, 0.5);
}

/* Live Event Stream Ticker */
.stream-logs {
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  height: 280px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.log-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.log-event {
  color: var(--accent-cyan);
  font-weight: 600;
}

.log-msg {
  color: #cbd5e1;
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .sticky-col {
    position: static;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .services-list {
    grid-template-columns: 1fr;
    max-height: 400px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .hero-section h2 {
    font-size: 1.85rem;
  }
  .app-container {
    padding: 14px;
  }
  .main-nav-tabs {
    flex-direction: column;
  }
  .nav-tab {
    width: 100%;
    justify-content: center;
  }
}
