@import url('https://fonts.googleapis.com/css2?family=Bruno+Ace&display=swap');

/* =========================================================================
   Cybonym SOC Dashboard — Custom Stylesheet
   Dark theme: GitHub Dark (#0d1117) + Cyan accent (#00d4ff)
   ========================================================================= */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --cw-bg:          #0d1117;
  --cw-surface:     #161b22;
  --cw-surface-2:   #1c2128;
  --cw-border:      #30363d;
  --cw-border-soft: #21262d;

  --cw-cyan:        #00d4ff;
  --cw-cyan-dim:    rgba(0, 212, 255, 0.12);
  --cw-cyan-glow:   rgba(0, 212, 255, 0.35);

  --cw-red:         #ff4d4d;
  --cw-red-dim:     rgba(255, 77, 77, 0.12);
  --cw-orange:      #ff8c42;
  --cw-orange-dim:  rgba(255, 140, 66, 0.12);
  --cw-yellow:      #ffd700;
  --cw-yellow-dim:  rgba(255, 215, 0, 0.12);
  --cw-green:       #3fb950;
  --cw-green-dim:   rgba(63, 185, 80, 0.12);

  --cw-text:        #e6edf3;
  --cw-text-muted:  #7d8590;
  --cw-text-dim:    #484f58;

  --cw-font-mono:   'Courier New', 'Consolas', monospace;
  --cw-radius:      8px;
  --cw-radius-lg:   12px;
  --cw-shadow:      0 4px 24px rgba(0, 0, 0, 0.5);
  --cw-shadow-glow: 0 0 20px var(--cw-cyan-glow);

  --cw-navbar-h:    52px;
  --cw-transition:  0.2s ease;
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--cw-bg);
  color: var(--cw-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cw-surface); }
::-webkit-scrollbar-thumb { background: var(--cw-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cw-text-muted); }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.cw-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--cw-navbar-h);
  background: var(--cw-surface);
  border-bottom: 1px solid var(--cw-border);
  box-shadow: 0 2px 16px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.cw-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.cw-logo-icon {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 0 8px var(--cw-cyan-glow));
}

.cw-logo-text {
  font-family: 'Bruno Ace', sans-serif;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--cw-text);
  text-transform: uppercase;
}

/* Brand Typography */
.cybonym-brand {
  font-family: 'Bruno Ace', sans-serif;
  letter-spacing: 0.08em;
}

.cw-logo-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cw-bg);
  background: var(--cw-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.cw-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: var(--cw-border);
  vertical-align: middle;
}

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

.cw-clock {
  font-family: var(--cw-font-mono);
  font-size: 0.85rem;
  color: var(--cw-cyan);
  letter-spacing: 0.05em;
}

/* Live badge */
.cw-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cw-green);
}

.cw-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cw-green);
  animation: cw-pulse 2s ease-in-out infinite;
}

@keyframes cw-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); }
}

.cw-pulse-dot-red {
  background: var(--cw-red);
  animation: cw-pulse-red 1.5s ease-in-out infinite;
}

@keyframes cw-pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(255, 77, 77, 0); }
}

/* ── Layout wrapper (sidebar + main) ────────────────────────────────────── */
:root {
  --cw-sidebar-w: 220px;
  --cw-sidebar-w-collapsed: 52px;
}

.cw-layout {
  display: flex;
  min-height: calc(100vh - var(--cw-navbar-h));
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.cw-sidebar {
  position: sticky;
  top: var(--cw-navbar-h);
  height: calc(100vh - var(--cw-navbar-h));
  width: var(--cw-sidebar-w);
  min-width: var(--cw-sidebar-w);
  background: var(--cw-surface);
  border-right: 1px solid var(--cw-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease, min-width 0.25s ease;
  z-index: 100;
  overflow-y: auto;
}

.cw-sidebar.collapsed {
  width: var(--cw-sidebar-w-collapsed);
  min-width: var(--cw-sidebar-w-collapsed);
}

/* Toggle button */
.cw-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--cw-border-soft);
  color: var(--cw-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: color var(--cw-transition);
  width: 100%;
}
.cw-sidebar-toggle:hover { color: var(--cw-cyan); }
.cw-sidebar.collapsed .cw-sidebar-toggle { justify-content: center; }

/* Sections */
.cw-sidebar-section {
  padding: 10px 0 6px;
}

.cw-sidebar-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cw-text-dim);
  padding: 0 14px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.cw-sidebar.collapsed .cw-sidebar-label { opacity: 0; }

/* Nav items */
.cw-sidebar-nav {
  display: flex;
  flex-direction: column;
}

.cw-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--cw-text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: color var(--cw-transition), background var(--cw-transition), border-color var(--cw-transition);
  white-space: nowrap;
}
.cw-nav-item:hover {
  color: var(--cw-text);
  background: var(--cw-surface-2);
}
.cw-nav-item.active {
  color: var(--cw-cyan);
  border-left-color: var(--cw-cyan);
  background: var(--cw-cyan-dim);
}
.cw-nav-item i { min-width: 16px; text-align: center; }

/* Hide text labels when collapsed */
.cw-nav-text {
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.15s;
}
.cw-sidebar.collapsed .cw-nav-text { opacity: 0; width: 0; overflow: hidden; }

/* Divider */
.cw-sidebar-divider {
  height: 1px;
  background: var(--cw-border-soft);
  margin: 4px 0;
}

/* Action groups */
.cw-sidebar-action-group {
  padding: 6px 10px 4px;
}
.cw-sidebar-action-title {
  font-size: 0.75rem;
  color: var(--cw-text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
}
.cw-sidebar-input-group {
  display: flex;
  gap: 4px;
}
.cw-sidebar-input {
  flex: 1;
  background: var(--cw-bg);
  border: 1px solid var(--cw-border);
  border-radius: 4px;
  color: var(--cw-text);
  font-size: 0.75rem;
  padding: 4px 8px;
  font-family: var(--cw-font-mono);
  min-width: 0;
  transition: border-color var(--cw-transition);
}
.cw-sidebar-input:focus {
  outline: none;
  border-color: var(--cw-cyan);
}
.cw-sidebar-btn {
  padding: 4px 8px;
  border: 1px solid;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background var(--cw-transition);
  flex-shrink: 0;
}
.cw-sidebar-btn-danger { border-color: var(--cw-red); color: var(--cw-red); }
.cw-sidebar-btn-danger:hover { background: var(--cw-red-dim); }
.cw-sidebar-btn-success { border-color: var(--cw-green); color: var(--cw-green); }
.cw-sidebar-btn-success:hover { background: var(--cw-green-dim); }

.cw-sidebar-full-btn {
  width: calc(100% - 20px);
  margin: 4px 10px;
  padding: 6px 10px;
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  color: var(--cw-text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
  display: flex;
  align-items: center;
  transition: color var(--cw-transition), border-color var(--cw-transition);
  white-space: nowrap;
  overflow: hidden;
}
.cw-sidebar-full-btn:hover { color: var(--cw-cyan); border-color: var(--cw-cyan); }

/* Service dots row */
.cw-sidebar-services {
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  gap: 6px;
}
.cw-sidebar-svc {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cw-sidebar-svc-name {
  font-size: 0.8rem;
  color: var(--cw-text-muted);
  white-space: nowrap;
}

/* Sidebar footer */
.cw-sidebar-footer {
  margin-top: auto;
  padding: 10px 14px;
  font-size: 0.68rem;
  color: var(--cw-text-dim);
  border-top: 1px solid var(--cw-border-soft);
  white-space: nowrap;
  overflow: hidden;
}

/* ── Main Layout ─────────────────────────────────────────────────────────── */
.cw-main {
  flex: 1;
  min-width: 0;
  min-height: calc(100vh - var(--cw-navbar-h));
  padding-bottom: 2rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.cw-card {
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-lg);
  overflow: hidden;
  transition: border-color var(--cw-transition), box-shadow var(--cw-transition);
}

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

.cw-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--cw-border-soft);
  background: var(--cw-surface-2);
}

.cw-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cw-text-muted);
}

.cw-card-body {
  padding: 16px;
}

.cw-card-actions {
  display: flex;
  gap: 4px;
}

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.cw-card-kpi {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 14px;
  border-radius: var(--cw-radius-lg);
  position: relative;
  overflow: hidden;
  transition: transform var(--cw-transition), box-shadow var(--cw-transition);
}

.cw-card-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
}

.cw-card-kpi {
  cursor: pointer;
}

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

/* KPI click pulse */
.cw-kpi-clicked {
  animation: cw-kpi-click-flash 0.4s ease;
}

@keyframes cw-kpi-click-flash {
  0%   { opacity: 1; }
  40%  { opacity: 0.55; }
  100% { opacity: 1; }
}

/* Section highlight when scrolled-to */
.cw-section-highlight {
  animation: cw-section-glow 2s ease forwards;
}

@keyframes cw-section-glow {
  0%   { box-shadow: 0 0 0 2px var(--cw-cyan-glow); }
  70%  { box-shadow: 0 0 0 2px var(--cw-cyan-glow); }
  100% { box-shadow: none; }
}

.cw-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--cw-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.cw-kpi-body {
  flex: 1;
  min-width: 0;
}

.cw-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.cw-kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cw-text-muted);
  margin-top: 2px;
}

.cw-kpi-trend {
  font-size: 0.75rem;
  color: var(--cw-text-muted);
}

/* Color variants */
.cw-kpi-danger::before  { background: var(--cw-red); }
.cw-kpi-danger .cw-kpi-icon  { background: var(--cw-red-dim); color: var(--cw-red); }
.cw-kpi-danger .cw-kpi-value { color: var(--cw-red); }

.cw-kpi-warning::before { background: var(--cw-orange); }
.cw-kpi-warning .cw-kpi-icon { background: var(--cw-orange-dim); color: var(--cw-orange); }
.cw-kpi-warning .cw-kpi-value { color: var(--cw-orange); }

.cw-kpi-alert::before   { background: var(--cw-yellow); }
.cw-kpi-alert .cw-kpi-icon   { background: var(--cw-yellow-dim); color: var(--cw-yellow); }
.cw-kpi-alert .cw-kpi-value  { color: var(--cw-yellow); }

.cw-kpi-info::before    { background: #58a6ff; }
.cw-kpi-info .cw-kpi-icon    { background: rgba(88,166,255,0.12); color: #58a6ff; }
.cw-kpi-info .cw-kpi-value   { color: #58a6ff; }

.cw-kpi-cyan::before    { background: var(--cw-cyan); }
.cw-kpi-cyan .cw-kpi-icon    { background: var(--cw-cyan-dim); color: var(--cw-cyan); }
.cw-kpi-cyan .cw-kpi-value   { color: var(--cw-cyan); }

.cw-kpi-success::before { background: var(--cw-green); }
.cw-kpi-success .cw-kpi-icon { background: var(--cw-green-dim); color: var(--cw-green); }
.cw-kpi-success .cw-kpi-value { color: var(--cw-green); }

/* Alert badge on KPI */
.cw-kpi-trend-alert {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--cw-red);
  color: #fff;
  letter-spacing: 0.05em;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.cw-table-wrap {
  overflow-y: auto;
  overflow-x: auto;
  max-height: 260px;
}

.cw-table-wrap-sm {
  max-height: 240px;
}

.cw-table {
  font-size: 0.8rem;
  color: var(--cw-text);
  margin-bottom: 0;
}

.cw-table thead th {
  background: var(--cw-surface-2);
  color: var(--cw-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--cw-border);
  padding: 8px 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.cw-table tbody tr {
  border-bottom: 1px solid var(--cw-border-soft);
  transition: background var(--cw-transition);
}

.cw-table tbody tr:last-child { border-bottom: none; }

.cw-table tbody tr:hover {
  background: var(--cw-surface-2);
  cursor: pointer;
}

.cw-table td {
  padding: 8px 12px;
  vertical-align: middle;
  color: var(--cw-text);
  font-family: var(--cw-font-mono);
  font-size: 0.78rem;
}

.cw-placeholder-row td {
  color: var(--cw-text-muted);
  text-align: center;
  font-family: inherit;
}

/* ── Alerts Feed ─────────────────────────────────────────────────────────── */
.cw-alerts-feed {
  overflow-y: auto;
  max-height: 310px;
  padding: 8px 0;
}

.cw-feed-loading {
  padding: 20px;
  text-align: center;
  color: var(--cw-text-muted);
}

.cw-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--cw-border-soft);
  transition: background var(--cw-transition), opacity var(--cw-transition);
  cursor: pointer;
  animation: cw-slide-in 0.3s ease;
}

.cw-alert-item:last-child { border-bottom: none; }

.cw-alert-item:hover { background: var(--cw-surface-2); }

.cw-alert-item.cw-new-flash {
  animation: cw-flash 0.6s ease;
}

@keyframes cw-flash {
  0%, 100% { background: transparent; }
  30% { background: rgba(255, 77, 77, 0.2); }
}

@keyframes cw-slide-in {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.cw-alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.cw-alert-dot-critical { background: var(--cw-red); box-shadow: 0 0 6px var(--cw-red); }
.cw-alert-dot-high     { background: var(--cw-orange); }
.cw-alert-dot-medium   { background: var(--cw-yellow); }
.cw-alert-dot-low      { background: var(--cw-green); }
.cw-alert-dot-info     { background: var(--cw-cyan); }

.cw-alert-content { flex: 1; min-width: 0; }

.cw-alert-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.cw-alert-time {
  font-family: var(--cw-font-mono);
  font-size: 0.75rem;
  color: var(--cw-text-muted);
  flex-shrink: 0;
}

.cw-alert-source {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.cw-alert-source-fail2ban { background: rgba(255,140,66,0.2); color: var(--cw-orange); }
.cw-alert-source-ufw      { background: rgba(0,212,255,0.2);  color: var(--cw-cyan); }
.cw-alert-source-suricata { background: rgba(255,77,77,0.2);  color: var(--cw-red); }
.cw-alert-source-ssh      { background: rgba(255,215,0,0.2);  color: var(--cw-yellow); }
.cw-alert-source-system   { background: rgba(63,185,80,0.2);  color: var(--cw-green); }
.cw-alert-source-default  { background: var(--cw-surface-2);  color: var(--cw-text-muted); }

.cw-alert-msg {
  font-size: 0.84rem;
  color: var(--cw-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Severity badge */
.cw-severity {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}

.cw-severity-critical { background: var(--cw-red-dim);    color: var(--cw-red); }
.cw-severity-high     { background: var(--cw-orange-dim); color: var(--cw-orange); }
.cw-severity-medium   { background: var(--cw-yellow-dim); color: var(--cw-yellow); }
.cw-severity-low      { background: var(--cw-green-dim);  color: var(--cw-green); }
.cw-severity-info     { background: var(--cw-cyan-dim);   color: var(--cw-cyan); }

/* ── Service Status Grid ─────────────────────────────────────────────────── */
.cw-service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.cw-service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-soft);
  border-radius: var(--cw-radius);
  transition: border-color var(--cw-transition);
}

.cw-service-item:hover { border-color: var(--cw-border); }

.cw-service-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cw-service-info { flex: 1; min-width: 0; }

.cw-service-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cw-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-service-detail {
  font-size: 0.68rem;
  color: var(--cw-text-muted);
  font-family: var(--cw-font-mono);
}

.cw-service-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cw-service-running { background: var(--cw-green); animation: cw-pulse 2.5s ease-in-out infinite; }
.cw-service-warning { background: var(--cw-yellow); animation: cw-pulse-warn 2s ease-in-out infinite; }
.cw-service-stopped { background: var(--cw-red); }

@keyframes cw-pulse-warn {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,215,0,0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 0 5px rgba(255,215,0,0); }
}

.cw-service-icon-running { background: var(--cw-green-dim); color: var(--cw-green); }
.cw-service-icon-warning { background: var(--cw-yellow-dim); color: var(--cw-yellow); }
.cw-service-icon-stopped { background: var(--cw-red-dim); color: var(--cw-red); }

/* ── Threat Origin Map ───────────────────────────────────────────────────── */
.cw-threat-map {
  height: 230px;
  overflow-y: auto;
  padding: 4px 0;
}

.cw-map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--cw-text-muted);
  font-size: 0.82rem;
}

.cw-origin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: background var(--cw-transition);
  cursor: default;
}

.cw-origin-row:hover { background: var(--cw-surface-2); }

.cw-origin-flag { font-size: 1.2rem; flex-shrink: 0; width: 24px; text-align: center; }
.cw-origin-country { font-size: 0.8rem; color: var(--cw-text); flex: 1; font-weight: 500; }
.cw-origin-count { font-size: 0.78rem; font-family: var(--cw-font-mono); color: var(--cw-text-muted); min-width: 40px; text-align: right; }

.cw-origin-bar-wrap {
  flex: 2;
  height: 5px;
  background: var(--cw-border-soft);
  border-radius: 3px;
  overflow: hidden;
}

.cw-origin-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cw-red), var(--cw-orange));
  transition: width 0.6s ease;
}

/* ── Threat Categories ───────────────────────────────────────────────────── */
.cw-threat-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--cw-border-soft);
}

.cw-threat-cat-item:last-child { border-bottom: none; }

.cw-threat-cat-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.cw-threat-cat-label { flex: 1; font-size: 0.8rem; color: var(--cw-text); }
.cw-threat-cat-count { font-size: 0.78rem; font-family: var(--cw-font-mono); color: var(--cw-text-muted); font-weight: 600; }

.cw-threat-cat-bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--cw-border-soft);
  border-radius: 2px;
  overflow: hidden;
}

.cw-threat-cat-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Tab Buttons ─────────────────────────────────────────────────────────── */
.cw-tab-btn {
  background: transparent;
  border: 1px solid var(--cw-border);
  color: var(--cw-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all var(--cw-transition);
  letter-spacing: 0.04em;
}

.cw-tab-btn:hover {
  border-color: var(--cw-cyan);
  color: var(--cw-cyan);
}

.cw-tab-btn.active {
  background: var(--cw-cyan-dim);
  border-color: var(--cw-cyan);
  color: var(--cw-cyan);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.cw-btn-outline-cyan {
  background: transparent;
  border: 1px solid var(--cw-border);
  color: var(--cw-text-muted);
  transition: all var(--cw-transition);
  font-size: 0.78rem;
}

.cw-btn-outline-cyan:hover,
.cw-btn-outline-cyan:focus {
  background: var(--cw-cyan-dim);
  border-color: var(--cw-cyan);
  color: var(--cw-cyan);
  box-shadow: 0 0 10px var(--cw-cyan-glow);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.cw-badge-live {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cw-green);
  background: var(--cw-green-dim);
  border: 1px solid rgba(63,185,80,0.3);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.cw-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cw-cyan);
  background: var(--cw-cyan-dim);
  border: 1px solid rgba(0,212,255,0.25);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--cw-font-mono);
}

/* ── Utility colors ──────────────────────────────────────────────────────── */
.text-cyan    { color: var(--cw-cyan) !important; }
.text-red     { color: var(--cw-red) !important; }
.text-orange  { color: var(--cw-orange) !important; }
.text-yellow  { color: var(--cw-yellow) !important; }
.text-green   { color: var(--cw-green) !important; }

/* Connection state colors */
.cw-state-established { color: var(--cw-green); }
.cw-state-listen      { color: var(--cw-cyan); }
.cw-state-time_wait   { color: var(--cw-yellow); }
.cw-state-close_wait  { color: var(--cw-orange); }
.cw-state-syn_sent    { color: #58a6ff; }

/* ── Country tags in table ───────────────────────────────────────────────── */
.cw-country-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
}

/* ── Reason tags ─────────────────────────────────────────────────────────── */
.cw-reason-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.cw-reason-brute-force { background: var(--cw-red-dim);    color: var(--cw-red); }
.cw-reason-port-scan   { background: var(--cw-orange-dim); color: var(--cw-orange); }
.cw-reason-dos         { background: rgba(255,0,255,0.12); color: #ff69b4; }
.cw-reason-manual      { background: var(--cw-cyan-dim);   color: var(--cw-cyan); }
.cw-reason-default     { background: var(--cw-surface-2);  color: var(--cw-text-muted); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.cw-modal {
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-lg);
}

.cw-modal .modal-header { border-bottom: 1px solid var(--cw-border-soft); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.cw-toast {
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  color: var(--cw-text);
  min-width: 280px;
  font-size: 0.82rem;
  box-shadow: var(--cw-shadow);
}

.cw-toast-danger  { border-left: 3px solid var(--cw-red); }
.cw-toast-warning { border-left: 3px solid var(--cw-orange); }
.cw-toast-success { border-left: 3px solid var(--cw-green); }
.cw-toast-info    { border-left: 3px solid var(--cw-cyan); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.cw-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 4px;
  font-size: 0.72rem;
  color: var(--cw-text-dim);
  border-top: 1px solid var(--cw-border-soft);
  margin-top: 8px;
}

/* ── Chart Overrides ─────────────────────────────────────────────────────── */
canvas { display: block; }

/* ── Scan Animation (table row highlight) ───────────────────────────────── */
@keyframes cw-row-flash {
  0%   { background: rgba(0,212,255,0.15); }
  100% { background: transparent; }
}

.cw-row-new {
  animation: cw-row-flash 1.5s ease forwards;
}

/* ── Connection status dot inline ───────────────────────────────────────── */
.cw-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ── Mobile Hamburger Toggle ────────────────────────────────────────────── */
.cw-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--cw-text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px 10px;
}
.cw-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 499;
}
.cw-sidebar-overlay.active { display: block; }

/* ── Login Card (centered, max-width) ──────────────────────────────────── */
.cw-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.cw-login-card {
  width: 100%;
  max-width: 420px;
}

/* ── Responsive Tweaks ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cw-mobile-toggle { display: inline-block; }
  .cw-kpi-value { font-size: 1.3rem; }
  .cw-service-grid { grid-template-columns: repeat(2, 1fr); }
  .cw-card-header { flex-wrap: wrap; gap: 6px; }
  .cw-navbar .cw-hostname { display: none; }
  :root {
    --cw-sidebar-w: 0px;
    --cw-sidebar-w-collapsed: 0px;
  }
  .cw-sidebar {
    position: fixed;
    left: -220px;
    width: 220px;
    transition: left 0.25s ease;
    z-index: 500;
  }
  .cw-sidebar.mobile-open {
    left: 0;
  }
  .cw-layout {
    flex-direction: column;
  }
  .cw-main {
    padding: 12px;
    width: 100%;
  }
  .cw-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .cw-table-wrapper,
  .cw-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cw-card {
    padding: 12px;
  }
  .cw-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }
  .cw-modal-dialog {
    margin: 8px;
    max-width: calc(100vw - 16px);
  }
  .cw-breadcrumb {
    font-size: 0.8rem;
  }
  .apexcharts-canvas,
  .cw-chart-container {
    min-height: 140px;
  }
}

/* ── Small Mobile (≤576px) ─────────────────────────────────────────────── */
@media (max-width: 576px) {
  html { font-size: 14px; }
  .cw-logo-text { display: none; }
  .cw-logo-icon { margin-right: 0; }
  .cw-service-grid { grid-template-columns: 1fr; }
  .cw-kpi-grid { grid-template-columns: 1fr; gap: 8px; }
  .cw-kpi-value { font-size: 1.15rem; }
  .cw-kpi-icon { width: 34px; height: 34px; font-size: 0.9rem; }
  .cw-navbar { padding: 6px 10px; }
  .cw-main { padding: 8px; }
  .cw-card { margin-bottom: 10px; }
  .cw-login-card { max-width: 100%; }
}

/* ── Glow effect on critical alerts count ───────────────────────────────── */
.cw-kpi-alerts-glow .cw-kpi-value {
  text-shadow: 0 0 12px rgba(255,215,0,0.5);
}

/* ── Hardware Privacy ─────────────────────────────────────────────────────── */
.cw-hw-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s;
}
.cw-hw-item:last-child { border-bottom: none; }
.cw-hw-item:hover { background: rgba(255,255,255,0.03); }

.cw-hw-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  font-size: 1rem;
  flex-shrink: 0;
}

.cw-hw-info { flex: 1; min-width: 0; }
.cw-hw-name { font-size: .8rem; font-weight: 600; color: var(--cw-text); }
.cw-hw-detail { font-size: .72rem; color: var(--cw-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cw-hw-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.cw-hw-dot-active   { background: #ff4d4d; box-shadow: 0 0 6px #ff4d4d88; animation: cw-pulse 1.5s ease-in-out infinite; }
.cw-hw-dot-inactive { background: var(--cw-green); }
.cw-hw-dot-unknown  { background: var(--cw-text-muted); }
.cw-hw-dot-ok       { background: var(--cw-green); }
.cw-hw-dot-alert    { background: var(--cw-red); }

/* USB device list */
.cw-usb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: .77rem;
}
.cw-usb-item:last-child { border-bottom: none; }
.cw-usb-name { flex: 1; color: var(--cw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-usb-tag  { font-size: .68rem; padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.cw-usb-cam  { background: rgba(255,77,77,.15); color: #ff4d4d; }
.cw-usb-mic  { background: rgba(255,140,66,.15); color: #ff8c42; }
.cw-usb-net  { background: rgba(0,212,255,.12); color: var(--cw-cyan); }
.cw-usb-ok   { background: rgba(63,185,80,.12); color: var(--cw-green); }

/* Hardware event feed */
.cw-hw-event {
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: .75rem;
}
.cw-hw-event:last-child { border-bottom: none; }
.cw-hw-event-time { color: var(--cw-text-muted); margin-right: 6px; }
.cw-hw-event-cam  { color: #ff4d4d; }
.cw-hw-event-mic  { color: #ff8c42; }
.cw-hw-event-usb  { color: var(--cw-cyan); }

/* ── Section Panels (hidden by default, toggled via sidebar) ─────────────── */
.cw-panel {
  animation: cw-panel-enter 0.35s ease forwards;
}

@keyframes cw-panel-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Panel activation effects ────────────────────────────────────────────── */

/* 1. Neon border bloom when panel opens */
.cw-panel-flash {
  position: relative;
  animation: cw-panel-enter 0.35s ease forwards,
             cw-panel-bloom  0.9s ease forwards;
}

@keyframes cw-panel-bloom {
  0%   { box-shadow: 0 0  0px  0px rgba(0,212,255,0),   0 0  0px  0px rgba(0,212,255,0); }
  15%  { box-shadow: 0 0 12px  4px rgba(0,212,255,0.5), 0 0 30px 10px rgba(0,212,255,0.2); }
  50%  { box-shadow: 0 0 18px  6px rgba(0,212,255,0.3), 0 0 50px 16px rgba(0,212,255,0.1); }
  100% { box-shadow: 0 0  0px  0px rgba(0,212,255,0),   0 0  0px  0px rgba(0,212,255,0); }
}

/* 2. Scan-line sweep (radar effect) — overlaid pseudo-element */
.cw-panel-flash::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0,212,255,0.0)  40%,
    rgba(0,212,255,0.18) 49%,
    rgba(0,212,255,0.35) 50%,
    rgba(0,212,255,0.18) 51%,
    rgba(0,212,255,0.0)  60%,
    transparent 100%
  );
  background-size: 100% 200%;
  background-position: 0% -100%;
  animation: cw-scan-sweep 0.75s cubic-bezier(0.4,0,0.6,1) forwards;
  border-radius: inherit;
}

@keyframes cw-scan-sweep {
  0%   { background-position: 0% -100%; opacity: 1; }
  80%  { background-position: 0%  200%; opacity: 1; }
  100% { background-position: 0%  200%; opacity: 0; }
}

/* 3. Sidebar nav button: ripple ring on click */
.cw-nav-item {
  position: relative;
  overflow: hidden;
}

.cw-nav-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.25);
  transform: scale(0);
  animation: cw-ripple-expand 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes cw-ripple-expand {
  0%   { transform: scale(0);  opacity: 0.8; }
  60%  { transform: scale(4);  opacity: 0.3; }
  100% { transform: scale(6);  opacity: 0;   }
}

/* 4. Active pulse on open nav items */
.cw-nav-item[data-panel].panel-open {
  animation: cw-nav-pulse 2.5s ease-in-out infinite;
}

@keyframes cw-nav-pulse {
  0%, 100% { box-shadow: inset 2px 0 0 var(--cw-cyan), 0 0  0px rgba(0,212,255,0);   }
  50%       { box-shadow: inset 2px 0 0 var(--cw-cyan), 0 0 10px rgba(0,212,255,0.25); }
}

/* ── Pill Buttons ────────────────────────────────────────────────────────── */
.cw-tab-btn {
  border-radius: 999px !important;
  padding: 3px 12px !important;
}

.cw-btn-outline-cyan {
  border-radius: 999px !important;
}

.cw-sidebar-btn {
  border-radius: 999px !important;
}

.cw-sidebar-full-btn {
  border-radius: 999px !important;
}

/* ── Table Zebra Stripes ─────────────────────────────────────────────────── */
.cw-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

.cw-table tbody tr:nth-child(odd) {
  background: transparent;
}

/* ── Card header gradient ────────────────────────────────────────────────── */
.cw-card-header {
  background: linear-gradient(135deg, var(--cw-surface-2) 0%, var(--cw-surface) 100%) !important;
  border-bottom: 1px solid var(--cw-border) !important;
}

/* ── KPI card subtle inner gradient ─────────────────────────────────────── */
.cw-card-kpi {
  background: linear-gradient(135deg, var(--cw-surface) 60%, var(--cw-surface-2) 100%) !important;
}

/* ── Nav count badge ─────────────────────────────────────────────────────── */
.cw-nav-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  background: var(--cw-cyan-dim);
  color: var(--cw-cyan);
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.cw-nav-badge:empty { display: none; }

/* ── Nav item open indicator ─────────────────────────────────────────────── */
.cw-nav-item[data-panel].panel-open {
  color: var(--cw-cyan);
  border-left: 2px solid var(--cw-cyan);
  background: var(--cw-cyan-dim);
}

.cw-nav-item[data-panel].panel-open::after {
  content: '▾';
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--cw-cyan);
}

/* ── Sidebar input pill shape ────────────────────────────────────────────── */
.cw-sidebar-input {
  border-radius: 999px !important;
  padding: 4px 12px !important;
}

/* ── Chart container glow ────────────────────────────────────────────────── */
#trafficChart {
  filter: drop-shadow(0 0 8px rgba(0,212,255,0.08));
}

/* ── Table IP link style ─────────────────────────────────────────────────── */
.cw-table .cw-ip-link {
  color: var(--cw-cyan);
  text-decoration: none;
  cursor: pointer;
}
.cw-table .cw-ip-link:hover {
  text-decoration: underline;
  color: #fff;
}

/* ── Empty state placeholder ─────────────────────────────────────────────── */
.cw-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--cw-text-dim);
  gap: 8px;
  font-size: 0.82rem;
}
.cw-empty-state i { font-size: 1.6rem; opacity: 0.3; }

/* ── Accordion Nav Groups ─────────────────────────────────────────────────── */
.cw-nav-group {
  border-bottom: 1px solid var(--cw-border-soft);
}
.cw-nav-group:last-of-type {
  border-bottom: none;
}

.cw-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cw-text-dim);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color var(--cw-transition);
  white-space: nowrap;
  overflow: hidden;
}
.cw-nav-group-toggle:hover {
  color: var(--cw-text-muted);
}
.cw-nav-group-toggle[aria-expanded="true"] {
  color: var(--cw-text-muted);
}

.cw-nav-group-icon {
  font-size: 0.8rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Collapsed sidebar: show only the group icon */
.cw-sidebar.collapsed .cw-nav-group-toggle {
  justify-content: center;
  padding: 10px;
}

.cw-nav-chevron {
  margin-left: auto;
  font-size: 0.6rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.cw-nav-group-toggle[aria-expanded="true"] .cw-nav-chevron {
  transform: rotate(180deg);
}

.cw-nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.cw-nav-group-items.open {
  max-height: 600px;
}

/* Collapsed sidebar: hide accordion items entirely */
.cw-sidebar.collapsed .cw-nav-group-items {
  max-height: 0 !important;
  overflow: hidden;
}

/* Action block inside RESPOND group */
.cw-nav-action-block {
  padding: 4px 10px 8px;
}
.cw-nav-action-block .form-control::placeholder {
  font-size: 0.72rem;
  color: var(--cw-text-dim);
}
.cw-nav-action-block .form-control:focus {
  border-color: var(--cw-cyan) !important;
  box-shadow: none;
}

/* ── Responsive: Tablet (769px – 1024px) ─────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --cw-sidebar-w: 180px;
  }
  .cw-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cw-service-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .cw-logo-text {
    font-size: 1rem;
  }
  .cw-main {
    padding: 16px;
  }
  .cw-card {
    padding: 14px;
  }
}

/* ── Responsive: Large Desktop (1440px+) ─────────────────────────────────── */
@media (min-width: 1440px) {
  :root {
    --cw-sidebar-w: 260px;
  }
  .cw-main {
    padding: 28px 36px;
  }
  .cw-kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .cw-service-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .cw-card {
    padding: 20px;
  }
  html, body {
    font-size: 16px;
  }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .cw-navbar,
  .cw-sidebar,
  .cw-live-badge,
  .cw-btn,
  .cw-toast-container,
  #cookie-consent-banner {
    display: none !important;
  }
  .cw-main {
    padding: 0;
    margin: 0;
    width: 100%;
  }
  .cw-layout {
    display: block;
  }
  .cw-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
    background: #fff;
    color: #000;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  .cw-badge {
    border: 1px solid #ccc;
  }
}

/* ── Dark Mode preference (for light-mode users who prefer dark) ─────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --cw-bg:          #0d1117;
    --cw-surface:     #161b22;
    --cw-surface-2:   #1c2128;
    --cw-border:      #30363d;
    --cw-text:        #e6edf3;
    --cw-text-muted:  #7d8590;
    color-scheme: dark;
  }
  html, body {
    background: var(--cw-bg);
    color: var(--cw-text);
  }
  /* Ensure form inputs stay dark */
  input, select, textarea {
    background-color: var(--cw-surface-2);
    color: var(--cw-text);
    border-color: var(--cw-border);
  }
  /* Keep scrollbar dark */
  ::-webkit-scrollbar-track { background: var(--cw-surface); }
  ::-webkit-scrollbar-thumb { background: var(--cw-border); }
}
