@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   MGate Telecom & Infrastructure Engineering Design System
   Style: Cloudflare / Stripe Telecom (Clean White, Steel Slate #0f172a / #334155, 
          Subtle Engineering Grids, Telecom Data Matrices, Crisp Status Badges)
   ========================================================================== */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Pure White Canvas & Steel Slate Hierarchy */
  --bg-body: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;      /* Slate-50 for technical panels */
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-card-subtle: #f1f5f9; /* Slate-100 */
  --bg-glass: rgba(255, 255, 255, 0.96);

  /* Terminal & Code (Stripe / Cloudflare CLI Slate) */
  --bg-code: #0f172a;        /* Slate-900 */
  --bg-code-header: #1e293b; /* Slate-800 */
  --border-code: #334155;    /* Slate-700 */

  /* Precision Engineering Borders */
  --border-subtle: #e2e8f0;  /* Slate-200 */
  --border-default: #cbd5e1; /* Slate-300 */
  --border-strong: #94a3b8;  /* Slate-400 */
  --border-focus: #0f172a;   /* Slate-900 */

  /* High-Contrast Technical Typography */
  --text-main: #0f172a;      /* Slate-900 (Dominant headers & values) */
  --text-muted: #334155;     /* Slate-700 (High-legibility engineering text) */
  --text-dim: #64748b;       /* Slate-500 (Labels, specs, RFC citations) */
  --text-inverse: #ffffff;

  /* Primary Brand Action (Deep Steel Slate - Stripe / Vercel standard) */
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-light: #f1f5f9;
  --primary-border: #cbd5e1;

  /* Telecom Infrastructure Accents */
  --accent-orange: #f38020;        /* Cloudflare Engineering Orange */
  --accent-orange-light: #fff7ed;  /* Orange-50 */
  --accent-orange-border: #fed7aa; /* Orange-200 */
  
  --accent-blue: #0284c7;          /* Data Routing / Transport Blue */
  --accent-blue-light: #f0f9ff;
  --accent-blue-border: #bae6fd;

  --accent-emerald: #10b981;       /* Carrier-Grade Online / 99.999% SLA */
  --accent-emerald-light: #ecfdf5;
  --accent-emerald-border: #a7f3d0;

  --accent-amber: #d97706;         /* Warning / Queue Alert */
  --accent-amber-light: #fffbeb;
  --accent-amber-border: #fde68a;

  --accent-red: #ef4444;           /* Block / Reject */

  /* Hairline Shadows (Tactile, Crisp, Zero Blur Fog) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Base Reset & Layout
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-body);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--text-main);
}

.text-link {
  color: var(--text-main);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--border-default);
  text-underline-offset: 3px;
}

.text-link:hover {
  text-decoration-color: var(--primary);
}

.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.25;
}

.text-gradient {
  color: var(--text-main);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
}

.nav-item a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 0;
  position: relative;
  text-decoration: none;
}

.nav-item a:hover {
  color: var(--text-main);
}

.nav-item a.active {
  color: var(--text-main);
  font-weight: 600;
}

.nav-item a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

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

/* ==========================================================================
   Buttons (Stripe / Cloudflare Precision Buttons)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-main);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-default);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 0.98rem;
  border-radius: var(--radius-sm);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
}

/* ==========================================================================
   Hero Section (Technical Engineering Grid)
   ========================================================================== */

.hero {
  position: relative;
  padding: 80px 0 60px;
  text-align: center;
  background-color: #ffffff;
  background-image: 
    linear-gradient(to right, #f1f5f9 1px, transparent 1px),
    linear-gradient(to bottom, #f1f5f9 1px, transparent 1px);
  background-size: 36px 36px;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border-default);
  color: var(--text-main);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text-main);
}

.hero-desc {
  font-size: 1.18rem;
  color: var(--text-muted);
  max-width: 840px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 44px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Stats Ribbon (Telecom Telemetry KPIs)
   ========================================================================== */

.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 40px 0 20px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 22px 20px;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-default);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.stat-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-card:hover::before {
  background: var(--primary);
}

.stat-number {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ==========================================================================
   Terminal Window (Cloudflare / Stripe CLI Theme)
   ========================================================================== */

.terminal-box {
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-width: 860px;
  margin: 0 auto 40px;
  text-align: left;
  overflow: hidden;
}

.terminal-header {
  background: var(--bg-code-header);
  border-bottom: 1px solid var(--border-code);
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  gap: 7px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.terminal-tabs {
  display: flex;
  gap: 6px;
}

.term-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}

.term-tab.active {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  font-weight: 600;
}

.terminal-body {
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.65;
  color: #f1f5f9;
  position: relative;
  overflow-x: auto;
}

.terminal-body .tab-pane {
  display: none;
}

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

.terminal-body code {
  color: #38bdf8;
}

.terminal-body .comment {
  color: #64748b;
}

.copy-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.copy-btn:hover {
  background: #334155;
  color: #ffffff;
}

.copy-btn.copied {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.4);
}

/* ==========================================================================
   Sections & Titles
   ========================================================================== */

.section {
  padding: 72px 0;
}

.section-subtle {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-wrap {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 48px;
}

.section-tag {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.section-tag::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-orange);
}

.section-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  color: var(--text-main);
}

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

/* ==========================================================================
   Grids & Data Cards
   ========================================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 28px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.card-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  margin-bottom: 18px;
  flex-shrink: 0;
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.card p {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
  flex-grow: 1;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: 18px;
  color: var(--text-main);
}

/* ==========================================================================
   Mail Delivery Topology (Telecom Routing Pipeline)
   ========================================================================== */

.pipeline-diagram {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 32px;
  margin: 32px 0;
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
}

.flow-chart {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 920px;
}

.flow-node {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px;
  flex: 1;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative;
}

.flow-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-default);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.flow-node:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.flow-node:hover::before {
  background: var(--accent-orange);
}

.flow-node-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.flow-node-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.flow-node-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ==========================================================================
   UI Mockup Windows (Network Console & Webmail SPA)
   ========================================================================== */

.ui-mockup-window {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin: 28px 0;
}

.mockup-topbar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.mockup-url-bar {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 5px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-grow: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mockup-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 380px;
}

.mockup-sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-subtle);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mockup-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.mockup-nav-item.active {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.mockup-content {
  padding: 24px;
  background: #ffffff;
}

/* --- Real MGate SPA UI Components inside Mockups --- */
.spa-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spa-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  text-decoration: none;
}

.spa-brand-icon {
  width: 26px;
  height: 26px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spa-app-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.spa-app-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.spa-app-tab.active {
  background: #ffffff;
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.spa-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.spa-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
}

.spa-breadcrumbs {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-weight: 500;
}

.spa-breadcrumbs span.sep {
  color: var(--border-strong);
  font-size: 0.7rem;
}

.spa-page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 640px) {
  .spa-page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.spa-page-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spa-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.spa-page-subtitle {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0;
}

.spa-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
}

.spa-badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.spa-badge-warning {
  background: rgba(217, 119, 6, 0.1);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.spa-badge-danger {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.25);
}

.spa-badge-neutral {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.spa-badge-primary {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.18);
}

.spa-badge-blue { background: rgba(59, 130, 246, 0.1); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.25); }
.spa-badge-emerald { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.spa-badge-amber { background: rgba(245, 158, 11, 0.1); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.25); }
.spa-badge-purple { background: rgba(168, 85, 247, 0.1); color: #9333ea; border: 1px solid rgba(168, 85, 247, 0.25); }
.spa-badge-red { background: rgba(239, 68, 68, 0.1); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.25); }

.spa-log-container {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid #1e293b;
}

.spa-log-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.1s ease;
}

.spa-log-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.spa-log-ts {
  color: #64748b;
  font-size: 0.72rem;
  white-space: nowrap;
}

.spa-log-prog {
  color: #38bdf8;
  font-weight: 600;
  white-space: nowrap;
}

.spa-log-src {
  color: #fbbf24;
  font-size: 0.72rem;
  white-space: nowrap;
}

.spa-log-msg {
  color: #cbd5e1;
  word-break: break-all;
  flex: 1;
}

.spa-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.spa-tab-btn {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.spa-tab-btn.active {
  color: var(--text-main);
  border-bottom-color: var(--text-main);
  font-weight: 600;
}

.spa-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.spa-kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.spa-kpi-card:hover {
  border-color: var(--border-default);
}

.spa-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.spa-kpi-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spa-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.spa-kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 4px;
}

.spa-kpi-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.spa-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.spa-modal-box {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-width: 620px;
  margin: 0 auto;
}

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

.spa-modal-body {
  padding: 20px;
}

.spa-modal-footer {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}


/* ==========================================================================
   Engineering Tables (Telecom Data Matrices)
   ========================================================================== */

.matrix-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.matrix-table th,
.matrix-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.matrix-table th {
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table tr:hover td {
  background: #f8fafc;
}

.col-mgate {
  background: #fcfdfe;
}

.matrix-table th.col-mgate {
  background: #f1f5f9;
  color: var(--text-main);
  border-bottom: 2px solid var(--primary);
}

.table-badge-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-emerald-light);
  border: 1px solid var(--accent-emerald-border);
  color: #065f46;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.table-badge-neutral {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
}

.table-badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-amber-light);
  border: 1px solid var(--accent-amber-border);
  color: #92400e;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ==========================================================================
   Sizing Calculator
   ========================================================================== */

.calc-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 32px;
  margin: 28px 0;
  box-shadow: var(--shadow-xs);
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
}

.calc-controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.calc-field label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.calc-val-badge {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.85rem;
}

.calc-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-subtle);
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

.calc-results {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.res-item {
  display: flex;
  flex-direction: column;
}

.res-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.res-val {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   DNS Generator
   ========================================================================== */

.dns-generator-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--shadow-xs);
}

.dns-input-group {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dns-input {
  flex-grow: 1;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  outline: none;
  transition: var(--transition);
}

.dns-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}

.dns-table-wrap {
  overflow-x: auto;
}

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-family: var(--font-mono);
}

.dns-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-subtle);
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.dns-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.dns-type-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.tag-mx { background: #eff6ff; color: #0284c7; border-color: #bae6fd; }
.tag-txt { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.tag-a { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.tag-cname { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 18px 0;
  font-size: 0.92rem;
  line-height: 1.55;
  border: 1px solid transparent;
}

.alert-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

/* ==========================================================================
   Stand Grid (Infrastructure Cluster Nodes)
   ========================================================================== */

.stand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stand-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-decoration: none;
  transition: var(--transition);
  display: block;
  box-shadow: var(--shadow-xs);
}

.stand-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stand-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stand-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.stand-ip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.stand-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Documentation Layout with Sticky Sidebar
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 40px;
  align-items: flex-start;
  margin-top: 32px;
}

.docs-sidebar {
  position: sticky;
  top: 90px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  box-shadow: var(--shadow-xs);
}

.docs-search {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 0.85rem;
  margin-bottom: 14px;
  outline: none;
  font-family: var(--font-mono);
}

.docs-search:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.docs-nav-group {
  margin-bottom: 16px;
}

.docs-nav-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.docs-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-nav-links a {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 0.86rem;
  text-decoration: none;
  transition: var(--transition);
}

.docs-nav-links a:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.docs-nav-links a.active {
  color: var(--text-main);
  background: var(--bg-subtle);
  font-weight: 600;
  border-left: 2px solid var(--primary);
}

.docs-content {
  min-width: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: #ffffff;
  padding: 52px 0 28px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-main);
}

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  flex-wrap: wrap;
  gap: 14px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .mockup-body { grid-template-columns: 1fr; }
  .mockup-sidebar { display: none; }
}

@media (max-width: 992px) {
  .hero h1 { font-size: 2.4rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
    padding: 20px;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-lg);
  }
  .nav-menu.open { display: flex; }
  .mobile-toggle { display: block; }
  .hero h1 { font-size: 2rem; }
  .hero-desc { font-size: 1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .calc-results { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Live Demo Page Components
   ========================================================================== */

.demo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 30px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.demo-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.demo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-subtle);
  transition: background 0.2s ease;
}

.demo-card.pro::before {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.demo-card.free::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.demo-card.panel::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.demo-badge-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.online {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-badge.pro {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.status-badge.panel {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.cred-group {
  margin: 18px 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.cred-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

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

.cred-row:last-child {
  margin-bottom: 0;
}

.cred-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.cred-value-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cred-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-weight: 600;
}

.demo-card-actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Keep shared demo credentials and navigation usable on narrow screens. */
.demo-card {
  min-width: 0;
}

.demo-badge-wrap {
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 768px) {
  .brand-badge { display: none; }
  .nav-container, .nav-actions { gap: 8px; }
  .nav-actions > .btn-secondary { display: none; }
  .demo-card { padding: 20px; }
  .cred-row { flex-direction: column; align-items: flex-start; }
  .cred-value-wrap { flex-wrap: wrap; }
  .demo-card-actions .btn { white-space: normal; text-align: center; }
}
