/* ═══════════════════════════════════════════════════════════════
   iKnowhy Cyber — Premium Dark Dashboard Theme  v2
   Glassmorphism · Depth · Glow · Animated Widgets · Ambient FX
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design Tokens ── */
:root {
  /* Backgrounds */
  --bg-void: #050510;
  --bg-primary: #08071A;
  --bg-secondary: #0C0B1E;
  --bg-card: rgba(12, 10, 28, 0.55);
  --bg-card-solid: #0C0A1C;
  --bg-card-hover: rgba(20, 16, 42, 0.65);
  --bg-input: rgba(8, 7, 20, 0.85);
  --bg-elevated: rgba(22, 18, 48, 0.5);

  /* Borders */
  --border-subtle: rgba(139, 92, 246, 0.1);
  --border-active: rgba(139, 92, 246, 0.3);
  --border-glow: rgba(139, 92, 246, 0.5);
  --border-glass: rgba(255, 255, 255, 0.04);

  /* Accents */
  --accent-purple: #8B5CF6;
  --accent-violet: #A855F7;
  --accent-magenta: #EC4899;
  --accent-pink: #F472B6;
  --accent-cyan: #06B6D4;
  --accent-blue: #3B82F6;
  --accent-green: #10B981;
  --accent-teal: #14B8A6;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  --gradient-brand-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.06) 100%);
  --gradient-card: linear-gradient(145deg, rgba(139, 92, 246, 0.06) 0%, rgba(236, 72, 153, 0.02) 100%);
  --gradient-accent-strip: linear-gradient(90deg, #8B5CF6, #EC4899, #F472B6);
  --gradient-glow-border: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.15), rgba(6, 182, 212, 0.1));

  /* Status */
  --color-healthy: #10B981;
  --color-warning: #F59E0B;
  --color-critical: #EF4444;
  --color-info: #6B7280;
  --color-low: #3B82F6;
  --color-medium: #F59E0B;
  --color-high: #F97316;

  /* Text */
  --text-primary: #EEEDF5;
  --text-secondary: #8D88A3;
  --text-muted: #5A5670;
  --text-bright: #FFFFFF;

  /* Shape */
  --nav-height: 56px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-pill: 9999px;

  /* Shadows & Glow */
  --shadow-card: 0 6px 32px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 12px 48px rgba(139, 92, 246, 0.12), 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-glow-sm: 0 0 24px rgba(139, 92, 246, 0.1);
  --shadow-glow-md: 0 0 48px rgba(139, 92, 246, 0.1);
  --shadow-glow-lg: 0 0 100px rgba(139, 92, 246, 0.08);
  --shadow-inset-glass: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  --shadow-nav: 0 4px 40px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(139, 92, 246, 0.08);

  /* Blur */
  --blur-glass: blur(28px);
  --blur-nav: blur(24px);

  /* Transitions */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Global Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-void);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(139, 92, 246, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 85% 50%, rgba(236, 72, 153, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(6, 182, 212, 0.03) 0%, transparent 45%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(139, 92, 246, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Ambient canvas background sits behind everything */
#ambientCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

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

a:hover {
  color: var(--accent-violet);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.45);
}

/* ── Layout ── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   TOP NAVIGATION — Frosted glass with glow
   ═══════════════════════════════════════════════ */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(8, 7, 18, 0.8);
  backdrop-filter: var(--blur-nav);
  -webkit-backdrop-filter: var(--blur-nav);
  border-bottom: 1px solid rgba(139, 92, 246, 0.08);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 1000;
  gap: 16px;
}

.topnav::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.15), transparent);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  margin-right: 8px;
}

.topnav-brand svg {
  color: var(--accent-purple);
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
  animation: float 3s ease-in-out infinite;
}

.topnav-pills {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(12, 10, 24, 0.6);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-pill);
  padding: 3px;
  border: 1px solid rgba(139, 92, 246, 0.08);
  box-shadow: var(--shadow-inset-glass);
}

.nav-pill {
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-pill:hover {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.08);
}

.nav-pill.active {
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 16px rgba(139, 92, 246, 0.4), 0 0 24px rgba(139, 92, 246, 0.12);
}

.topnav-spacer {
  flex: 1;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scenario-select {
  background: rgba(12, 10, 24, 0.7);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}

.scenario-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.topnav-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.topnav-icon:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.topnav-icon svg {
  width: 15px;
  height: 15px;
}

.topnav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
  position: relative;
}

.topnav-avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(236, 72, 153, 0.2)) border-box;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* ═══════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════ */
.main-content {
  margin-top: var(--nav-height);
  padding: 20px 24px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-shadow: 0 0 80px rgba(139, 92, 246, 0.08);
}

/* ═══════════════════════════════════════════════
   GLASSMORPHISM CARDS — Deep, layered
   ═══════════════════════════════════════════════ */
.card {
  background: rgba(13, 11, 26, 0.5);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card), var(--shadow-inset-glass);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

/* Top highlight shimmer */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, 0.06) 50%, transparent 80%);
}

.card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-card-hover), var(--shadow-inset-glass);
  transform: translateY(-2px);
}

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

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════
   METRIC CARDS — Premium with glow border
   ═══════════════════════════════════════════════ */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: rgba(13, 11, 26, 0.6);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--shadow-inset-glass);
  transition: all 0.2s ease;
}

/* Gradient glow border effect at top */
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent-strip);
  opacity: 0.8;
}

/* Subtle background gradient */
.metric-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.metric-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-card-hover), var(--shadow-inset-glass);
  transform: translateY(-3px);
}

/* Stagger */
.metric-card:nth-child(1) {
  animation: fadeInUp 0.5s ease-out 0.05s both;
}

.metric-card:nth-child(2) {
  animation: fadeInUp 0.5s ease-out 0.1s both;
}

.metric-card:nth-child(3) {
  animation: fadeInUp 0.5s ease-out 0.15s both;
}

.metric-card:nth-child(4) {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.metric-card:nth-child(5) {
  animation: fadeInUp 0.5s ease-out 0.25s both;
}

.metric-card .metric-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}

.metric-card .metric-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.1;
  position: relative;
  z-index: 1;
}

.metric-card .metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.metric-change {
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.metric-change.up {
  color: var(--color-critical);
}

.metric-change.down {
  color: var(--color-healthy);
}

.metric-change.neutral {
  color: var(--text-muted);
}

.metric-sparkline {
  width: 64px;
  height: 40px;
}

/* ═══════════════════════════════════════════════
   GRIDS
   ═══════════════════════════════════════════════ */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.grid-2x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
}

.full-width {
  margin-bottom: 16px;
}

.metrics-row {
  gap: 12px;
}

/* ═══════════════════════════════════════════════
   DATA TABLES
   ═══════════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(139, 92, 246, 0.08);
  white-space: nowrap;
  background: transparent;
}

.data-table tbody tr {
  transition: all var(--transition);
  cursor: pointer;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(139, 92, 246, 0.015);
}

.data-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.06);
}

.data-table tbody td {
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(139, 92, 246, 0.04);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.table-search {
  flex: 1;
  max-width: 300px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.table-search:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1), 0 0 24px rgba(139, 92, 246, 0.06);
}

.table-search::placeholder {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   BADGES — Glow variants
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

.badge-critical {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.12);
  animation: pulseBadge 2s infinite;
}

.badge-high {
  background: rgba(249, 115, 22, 0.15);
  color: #F97316;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.08);
}

.badge-medium {
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
}

.badge-low {
  background: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
}

.badge-info {
  background: rgba(107, 114, 128, 0.1);
  color: #9CA3AF;
}

.badge-healthy {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.08);
}

.badge-open {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.badge-resolved {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
}

.badge-inprogress {
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
}

/* ═══════════════════════════════════════════════
   RISK BAR & EFF BAR
   ═══════════════════════════════════════════════ */
.risk-bar {
  display: flex;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  width: 80px;
  background: rgba(255, 255, 255, 0.03);
}

.risk-bar .seg {
  height: 100%;
}

.risk-bar .seg-critical {
  background: #EF4444;
}

.risk-bar .seg-high {
  background: #F97316;
}

.risk-bar .seg-medium {
  background: #F59E0B;
}

.risk-bar .seg-low {
  background: #3B82F6;
}

.eff-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  overflow: hidden;
}

.eff-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-brand);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════
   TOGGLE GROUP
   ═══════════════════════════════════════════════ */
.toggle-group {
  display: flex;
  background: rgba(12, 10, 24, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-inset-glass);
}

.toggle-btn {
  padding: 5px 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.06);
}

.toggle-btn.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  transition: all var(--transition);
}

.btn:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select {
  background: rgba(12, 10, 24, 0.6);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.filter-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

/* ═══════════════════════════════════════════════
   HEATMAP
   ═══════════════════════════════════════════════ */
.heatmap-grid {
  display: grid;
  gap: 3px;
  font-size: 10px;
}

.heatmap-cell {
  border-radius: 4px;
  width: 28px;
  height: 28px;
  transition: all 0.2s ease;
}

.heatmap-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
  z-index: 2;
  position: relative;
}

/* ═══════════════════════════════════════════════
   SLIDE PANEL
   ═══════════════════════════════════════════════ */
.slide-panel {
  position: fixed;
  top: var(--nav-height);
  right: -420px;
  width: 420px;
  height: calc(100vh - var(--nav-height));
  background: rgba(8, 7, 18, 0.94);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 48px rgba(0, 0, 0, 0.5);
  z-index: 900;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 24px;
}

.slide-panel.open {
  right: 0;
}

.slide-panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.slide-panel-close:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.tab-btn {
  padding: 8px 18px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-purple);
  border-image: var(--gradient-brand) 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ═══════════════════════════════════════════════
   CALLOUT
   ═══════════════════════════════════════════════ */
.callout {
  background: rgba(139, 92, 246, 0.04);
  backdrop-filter: blur(4px);
  border-left: 3px solid var(--accent-purple);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.callout-warn {
  background: rgba(245, 158, 11, 0.04);
  border-left-color: var(--color-warning);
}

.callout-critical {
  background: rgba(239, 68, 68, 0.04);
  border-left-color: var(--color-critical);
}

/* ═══════════════════════════════════════════════
   MITRE FLOW
   ═══════════════════════════════════════════════ */
.mitre-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 14px;
}

.mitre-flow-box {
  flex-shrink: 0;
  padding: 10px 16px;
  background: rgba(139, 92, 246, 0.06);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-purple);
  text-align: center;
  min-width: 100px;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.05);
}

.mitre-flow-box:hover {
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.12);
  transform: translateY(-2px);
}

.mitre-flow-arrow {
  flex-shrink: 0;
  color: var(--accent-magenta);
  font-size: 14px;
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════
   IDENTITY STRIP
   ═══════════════════════════════════════════════ */
.identity-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(139, 92, 246, 0.03);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow-x: auto;
  font-size: 12px;
  box-shadow: var(--shadow-inset-glass);
}

.identity-node {
  padding: 5px 12px;
  background: rgba(12, 10, 24, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
}

.identity-node:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.12);
}

.identity-arrow {
  color: var(--accent-magenta);
}

/* ═══════════════════════════════════════════════
   VERTICAL TIMELINE
   ═══════════════════════════════════════════════ */
.vtimeline {
  position: relative;
  padding-left: 24px;
}

.vtimeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-purple), rgba(139, 92, 246, 0.05));
  border-radius: 1px;
}

.vtimeline-item {
  position: relative;
  padding: 8px 0 14px 18px;
  animation: fadeInUp 0.3s ease-out both;
}

.vtimeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-purple);
  border: 2px solid var(--bg-card-solid);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.vtimeline-item.sev-critical::before {
  background: var(--color-critical);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.vtimeline-item.sev-high::before {
  background: var(--color-high);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

.vtimeline-item.sev-medium::before {
  background: var(--color-medium);
}

.vtimeline-item.sev-low::before {
  background: var(--color-low);
}

/* ═══════════════════════════════════════════════
   GAUGE ARC (SVG)
   ═══════════════════════════════════════════════ */
.gauge-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gauge-label {
  position: absolute;
  text-align: center;
}

.gauge-label .gauge-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gauge-label .gauge-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   COLLAPSIBLE
   ═══════════════════════════════════════════════ */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: color var(--transition);
}

.collapsible-header:hover {
  color: var(--text-primary);
}

.collapsible-body {
  display: none;
  padding: 10px 0;
}

.collapsible-body.open {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* ═══════════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════════ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(16px);
  background: #fff;
}

/* ═══════════════════════════════════════════════
   HORIZONTAL TIMELINE
   ═══════════════════════════════════════════════ */
.h-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 22px 0;
  position: relative;
}

.h-timeline-line {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), rgba(236, 72, 153, 0.25), rgba(139, 92, 246, 0.08));
}

.h-timeline-event {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all var(--transition);
}

.h-timeline-event:hover {
  transform: translateY(-2px);
}

.h-timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--bg-card-solid);
  margin-bottom: 8px;
  box-shadow: 0 0 10px currentColor;
  transition: all var(--transition);
}

.h-timeline-event:hover .h-timeline-dot {
  transform: scale(1.3);
}

.h-timeline-label {
  font-size: 10px;
  text-align: center;
  color: var(--text-secondary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h-timeline-badge {
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════
   SOURCE ICONS
   ═══════════════════════════════════════════════ */
.source-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.source-icon.email {
  background: linear-gradient(135deg, #6366F1, #818CF8);
}

.source-icon.endpoint {
  background: linear-gradient(135deg, #EC4899, #F472B6);
}

.source-icon.network {
  background: linear-gradient(135deg, #06B6D4, #22D3EE);
}

.source-icon.identity {
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
}

.source-icon.cloud {
  background: linear-gradient(135deg, #8B5CF6, #A855F7);
}

.source-icon.default {
  background: linear-gradient(135deg, #6B7280, #9CA3AF);
}

/* ═══════════════════════════════════════════════
   ARC GAUGE / COMPLEXITY
   ═══════════════════════════════════════════════ */
.arc-gauge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.arc-gauge-value {
  position: absolute;
  font-size: 14px;
  font-weight: 700;
}

.complexity {
  display: flex;
  gap: 3px;
}

.complexity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.12);
  transition: all var(--transition);
}

.complexity-dot.filled {
  background: var(--accent-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* ═══════════════════════════════════════════════
   KPI ROW (Executive)
   ═══════════════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--shadow-inset-glass);
  transition: all var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent-strip);
  opacity: 0.6;
}

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

.kpi-card .kpi-value {
  font-size: 30px;
  font-weight: 800;
}

.kpi-card .kpi-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════
   vis-network / CHART CONTAINERS
   ═══════════════════════════════════════════════ */
.graph-container {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 500px;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: rgba(6, 5, 16, 0.8);
  box-shadow: inset 0 2px 24px rgba(0, 0, 0, 0.35);
}

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

.chart-container canvas {
  width: 100% !important;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════
   EXECUTIVE LAYOUT
   ═══════════════════════════════════════════════ */
.exec-layout .card {
  padding: 24px;
}

.exec-layout .metrics-row {
  grid-template-columns: repeat(4, 1fr);
}

/* ═══════════════════════════════════════════════
   SPEEDOMETER GAUGE WIDGET
   ═══════════════════════════════════════════════ */
.speedometer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speedometer svg {
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.15));
}

.speedometer .needle {
  transform-origin: 50% 86.67%;
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speedometer .center-readout {
  position: absolute;
  text-align: center;
  bottom: 18%;
}

.speedometer .readout-value {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.speedometer .readout-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.speedometer .readout-grade {
  font-size: 16px;
  font-weight: 800;
  margin-top: 4px;
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

/* ═══════════════════════════════════════════════
   THREAT RING WIDGET
   ═══════════════════════════════════════════════ */
.threat-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.threat-ring svg {
  filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.1));
}

.threat-ring .ring-center {
  position: absolute;
  text-align: center;
}

.threat-ring .ring-value {
  font-size: 36px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.threat-ring .ring-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Ring arcs animate in */
.threat-ring .ring-arc {
  stroke-dasharray: 0;
  animation: ringDraw 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ═══════════════════════════════════════════════
   ATTACK FLOW (Sankey-style)
   ═══════════════════════════════════════════════ */
.attack-flow svg {
  width: 100%;
  height: auto;
}

.attack-flow .flow-path {
  fill: none;
  stroke-width: 3;
  opacity: 0.5;
}

.attack-flow .flow-node {
  rx: 8;
  ry: 8;
}

.attack-flow .flow-node-label {
  font-size: 10px;
  fill: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.attack-flow .flow-particle {
  r: 3;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════
   PLACEHOLDER
   ═══════════════════════════════════════════════ */
.placeholder-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-size: 14px;
  border: 2px dashed rgba(139, 92, 246, 0.1);
  border-radius: var(--radius);
  background: rgba(139, 92, 246, 0.01);
}

/* ═══════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════ */
@media print {
  .topnav {
    display: none;
  }

  .main-content {
    margin-top: 0;
    padding: 10px;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11px;
  }

  body::before,
  #ambientCanvas {
    display: none;
  }

  .card {
    border: 1px solid #ddd;
    box-shadow: none;
    background: #fff;
    backdrop-filter: none;
  }

  .btn-print {
    display: none;
  }
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes glowPulse {

  0%,
  100% {
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.15);
  }

  50% {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
  }
}

@keyframes pulseBadge {

  0%,
  100% {
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.12);
  }

  50% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
  }
}

@keyframes ringDraw {
  from {
    stroke-dashoffset: var(--ring-circumference);
  }

  to {
    stroke-dashoffset: var(--ring-offset);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  100% {
    left: 200%;
  }
}

@keyframes particleFloat {

  0%,
  100% {
    transform: translate(0, 0);
    opacity: 0.4;
  }

  25% {
    transform: translate(10px, -15px);
    opacity: 0.7;
  }

  50% {
    transform: translate(-5px, -30px);
    opacity: 0.5;
  }

  75% {
    transform: translate(15px, -15px);
    opacity: 0.6;
  }
}

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */
.glass {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-inset-glass);
}

.glow-border {
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.1), var(--shadow-card);
}

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.animate-in {
  animation: fadeInUp 0.5s ease-out both;
}

.animate-in:nth-child(1) {
  animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
  animation-delay: 0.1s;
}

.animate-in:nth-child(3) {
  animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
  animation-delay: 0.2s;
}

.animate-in:nth-child(5) {
  animation-delay: 0.25s;
}

.animate-in:nth-child(6) {
  animation-delay: 0.3s;
}

/* ═══════════════════════════════════════════════
   RISK HEAT BARS (Fortexo-style tiny blocks)
   ═══════════════════════════════════════════════ */
.risk-heat-bar {
  display: flex;
  gap: 1px;
  align-items: center;
}

.risk-heat-bar .heat-block {
  width: 4px;
  height: 14px;
  border-radius: 1px;
}

/* ═══════════════════════════════════════════════
   AVATAR CIRCLES (Table identity columns)
   ═══════════════════════════════════════════════ */
.table-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-brand);
  border: 2px solid rgba(139, 92, 246, 0.4);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   PLATFORM ICONS (small rounded squares)
   ═══════════════════════════════════════════════ */
.platform-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

#graph-canvas canvas {
  border-radius: 0.5rem;
}

pre {
  font-family: inherit;
}

a,
button {
  transition: all 0.2s ease;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .topnav {
    padding: 0 16px;
    gap: 8px;
  }

  .topnav-pills {
    display: none;
  }

  .main-content {
    padding: 14px;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2-1,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}