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

:root {
  --bg: #0e0b1e;
  --bg-card: #16132d;
  --bg-card-hover: #1d1a38;
  --bg-input: #1d1a38;
  --bg-header: #0a0818;
  --border: #2d2855;
  --border-accent: #7c6bf0;
  --fg: #e0ddf0;
  --fg-muted: #9590b8;
  --fg-dim: #5e5882;
  --accent: #7c6bf0;
  --accent-hover: #8d7ff5;
  --green: #2ecc71;
  --green-bg: rgba(46, 204, 113, 0.12);
  --red: #e74c3c;
  --red-bg: rgba(231, 76, 60, 0.12);
  --yellow: #f39c12;
  --yellow-bg: rgba(243, 156, 18, 0.12);
  --blue: #3498db;
  --blue-bg: rgba(52, 152, 219, 0.12);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;

  /* Legacy mappings — keeps any leftover references working */
  --vg-bg-primary: var(--bg);
  --vg-bg-panel: var(--bg-card);
  --vg-bg-input: var(--bg-input);
  --vg-primary: var(--accent);
  --vg-accent: var(--accent-hover);
  --vg-brand-deep: #4B3F94;
  --vg-text-primary: var(--fg);
  --vg-text-secondary: var(--fg-muted);
  --vg-text-muted: var(--fg-dim);
  --vg-status-critical: var(--red);
  --vg-status-high: #ff6600;
  --vg-status-medium: var(--yellow);
  --vg-status-low: var(--green);
  --vg-status-online: var(--green);
  --vg-status-offline: var(--red);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--fg);
  margin: 0;
}

/* ---- Top Header Bar ---- */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(124, 107, 240, 0.3));
}

.dash-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.header-brand-subtitle {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-greeting {
  color: var(--fg-muted);
  font-size: 12px;
}

.user-greeting strong {
  color: var(--fg);
}

.role-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #fff;
}

.logout-btn {
  border: 1px solid var(--red);
  color: var(--red);
  background: transparent;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s;
}

.logout-btn:hover {
  background: var(--red-bg);
}

/* ---- Sidebar + Main Layout ---- */
.dash-layout {
  display: flex;
  min-height: calc(100vh - 57px);
}

.dash-sidebar {
  width: 200px;
  background: var(--bg-header);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
}

.nav-section-label {
  padding: 20px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  font-weight: 600;
  font-family: var(--font-body);
}

.nav-item {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.1s, color 0.1s;
  font-family: var(--font-body);
  border-right: 2px solid transparent;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(124, 107, 240, 0.08);
  border-right-color: var(--accent);
}

[data-icon] {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

[data-icon] svg {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.dash-main {
  flex: 1;
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}

/* ---- Page Sections ---- */
.page-section {
  display: none;
  animation: fadeIn 0.2s ease-in;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Stat Summary Cards (new) ---- */
.stat-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-summary-label {
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-summary-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-summary-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ---- Dashboard Cards (general) ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.dashboard-card h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-card-full {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.threat-compact-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.threat-compact-item:last-child {
  margin-bottom: 0;
}

.threat-intel-top-row {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 16px;
  margin-bottom: 16px;
  overflow: hidden;
  align-items: stretch;
}

.threat-intel-mid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.threat-intel-globe-card {
  min-height: 480px;
  min-width: 0;
  overflow: hidden;
}

.threat-intel-threats-card {
  overflow: hidden;
}

.threat-intel-threats-card #threat-list {
  max-height: 390px;
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .threat-intel-top-row,
  .threat-intel-mid-row {
    grid-template-columns: 1fr;
  }
}

/* ---- Logs Page Tabs ---- */
.logs-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.logs-tab {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.logs-tab:first-child {
  border-radius: 6px 0 0 6px;
}

.logs-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.logs-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.logs-tab-content {
  display: none;
}

.logs-tab-content.active {
  display: block;
}

/* ---- Sensor Activity Layout ---- */
.logs-sensor-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 500px;
}

.logs-sensor-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  overflow-y: auto;
  max-height: 600px;
}

.logs-sensor-list-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
}

.sensor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

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

.sensor-item:hover {
  background: rgba(124, 107, 240, 0.08);
}

.sensor-item.active {
  background: rgba(124, 107, 240, 0.15);
  border-left: 3px solid var(--accent);
}

.sensor-item .sensor-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 500;
}

.sensor-item .sensor-host {
  font-size: 11px;
  font-weight: 400;
  color: var(--fg-dim);
  margin-top: 2px;
}

.sensor-item .sensor-os-icon {
  width: 20px;
  height: 20px;
  color: var(--fg-dim);
}

.sensor-item .sensor-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sensor-status-dot.online {
  background: #2ecc71;
}

.sensor-status-dot.offline {
  background: #e74c3c;
}

/* ---- Sensor Feed ---- */
.logs-sensor-feed {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logs-sensor-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(124, 107, 240, 0.04);
}

.live-dot {
  color: #2ecc71;
  font-size: 11px;
  animation: pulse 1.5s infinite;
}

.logs-sensor-feed-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
  max-height: 540px;
}

.telemetry-row {
  display: grid;
  grid-template-columns: 70px 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.telemetry-row:hover {
  background: rgba(124, 107, 240, 0.05);
}

.telemetry-time {
  color: var(--fg-dim);
  font-size: 12px;
}

.telemetry-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.telemetry-badge.process { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.telemetry-badge.file    { background: rgba(230, 126, 34, 0.15); color: #e67e22; }
.telemetry-badge.network { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.telemetry-badge.registry { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.telemetry-badge.memory   { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

.telemetry-desc {
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}

.telemetry-score {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  min-width: 72px;
}

.telemetry-score.alert {
  color: #e74c3c;
}

.telemetry-score.normal {
  color: var(--fg-dim);
}

@media (max-width: 768px) {
  .logs-sensor-layout {
    grid-template-columns: 1fr;
  }
  .logs-sensor-list {
    max-height: 200px;
  }
}

/* ---- Scrollable Panels (threats, anomalies, patterns) ---- */
#threat-list,
#anomalies-list,
#patterns-list {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

#threat-list::-webkit-scrollbar,
#anomalies-list::-webkit-scrollbar,
#patterns-list::-webkit-scrollbar {
  width: 6px;
}

#threat-list::-webkit-scrollbar-track,
#anomalies-list::-webkit-scrollbar-track,
#patterns-list::-webkit-scrollbar-track {
  background: transparent;
}

#threat-list::-webkit-scrollbar-thumb,
#anomalies-list::-webkit-scrollbar-thumb,
#patterns-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ---- Threat/Anomaly/Pattern Items ---- */
.threat-item, .anomaly-item, .pattern-item {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin: 6px 0;
  border-radius: 8px;
  transition: border-color 0.15s;
}

.threat-item:hover, .anomaly-item:hover, .pattern-item:hover {
  border-color: var(--border-accent);
}

.threat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.threat-type {
  font-weight: 600;
  font-size: 13px;
}

.threat-details {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.threat-info {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 4px;
}

.threat-origin-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-bg);
  color: var(--blue);
  margin-left: 6px;
}

/* Confidence levels */
.threat-confidence-high { color: var(--green); font-weight: 600; }
.threat-confidence-medium { color: var(--yellow); font-weight: 600; }
.threat-confidence-low { color: var(--red); font-weight: 700; }

.threat-risk { color: var(--fg-muted); }

/* Severity */
.severity-critical { color: var(--red); font-weight: bold; }
.severity-high { color: #ff6600; font-weight: 600; }
.severity-medium { color: var(--yellow); }
.severity-low { color: var(--green); }
.criticality-critical { color: var(--red); font-weight: bold; }
.criticality-high { color: #ff6600; }
.criticality-medium { color: var(--yellow); }
.criticality-low { color: var(--green); }

/* Analyst badge */
.analyst-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--blue-bg);
  border: 1px solid rgba(52, 152, 219, 0.3);
  font-size: 11px;
}

.analyst-badge-icon { font-size: 12px; }

.no-data {
  color: var(--fg-dim);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ---- P/N/F Type Badges (new) ---- */
.badge-type {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  text-align: center;
  line-height: 22px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
  flex-shrink: 0;
}

.badge-type-p { background: var(--red-bg); color: var(--red); }
.badge-type-n { background: var(--blue-bg); color: var(--blue); }
.badge-type-f { background: var(--yellow-bg); color: var(--yellow); }

/* ---- Buttons ---- */
.btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--fg);
  border-color: var(--border-accent);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-start { border-color: var(--green); color: var(--green); }
.btn-start:hover:not(:disabled) { background: var(--green-bg); }

.btn-stop { border-color: var(--red); color: var(--red); }
.btn-stop:hover:not(:disabled) { background: var(--red-bg); }

.btn-logs { border-color: var(--blue); color: var(--blue); }
.btn-logs:hover:not(:disabled) { background: var(--blue-bg); }

.btn-restart { border-color: var(--yellow); color: var(--yellow); }
.btn-restart:hover:not(:disabled) { background: var(--yellow-bg); }

.btn-review {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
}

.btn-review:hover { background: var(--accent-hover); }

.btn-approve { border-color: var(--green); color: var(--green); background: transparent; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 12px; }
.btn-approve:hover:not(:disabled) { background: var(--green-bg); }

.btn-reject { border-color: var(--red); color: var(--red); background: transparent; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 12px; }
.btn-reject:hover:not(:disabled) { background: var(--red-bg); }

.btn-falsepositive { border-color: var(--yellow); color: var(--yellow); background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 12px; }
.btn-falsepositive:hover:not(:disabled) { background: var(--yellow-bg); }

.btn-escalate { border-color: #ff6600; color: #ff6600; background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 12px; }
.btn-escalate:hover:not(:disabled) { background: rgba(255, 102, 0, 0.12); }

.btn-close { border-color: var(--red); color: var(--red); background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 12px; }
.btn-close:hover:not(:disabled) { background: var(--red-bg); }

/* ---- Pagination ---- */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--fg-dim);
}

.pagination-info { font-variant-numeric: tabular-nums; }

.btn-pagination-prev,
.btn-pagination-next {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
}

.btn-pagination-prev:hover,
.btn-pagination-next:hover {
  border-color: var(--accent);
  color: var(--fg);
}

/* ---- Tables (general) ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--fg-muted);
  font-weight: 500;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(45, 40, 85, 0.5);
  color: var(--fg);
  font-size: 13px;
  vertical-align: top;
}

tr:hover {
  background: var(--bg-card-hover);
}

/* ---- Agent Management (backend agents) ---- */
.agent-management-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.agent-card-mgmt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.agent-card-mgmt h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--fg);
}

.agent-card-mgmt .agent-role {
  color: var(--fg-muted);
  font-size: 11px;
  margin: 0;
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
  font-size: 12px;
}

.status-indicator {
  font-size: 14px;
}

.status-running { color: var(--green); }
.status-stopped { color: var(--red); }
.status-text { font-weight: 600; }

.agent-heartbeat {
  color: var(--fg-dim);
  font-size: 11px;
  margin-top: 4px;
}

.agent-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- EDR Sensor Management ---- */
.edr-divider {
  margin: 32px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.edr-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--fg);
  border-bottom: none;
  padding-bottom: 0;
}

.edr-message-container { margin-bottom: 15px; }
.edr-message-container div {
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--green);
  color: var(--green);
  background: var(--green-bg);
  font-size: 13px;
}

.edr-message-container div.error {
  color: var(--red);
  background: var(--red-bg);
  border-color: var(--red);
}

.edr-message-container div.success {
  color: var(--green);
  background: var(--green-bg);
  border-color: var(--green);
}

.edr-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  align-items: start;
}

.edr-agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.edr-agent-card h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.btn-edr-actions {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
}

.btn-edr-actions:hover { background: var(--accent-hover); }

.btn-edr-quarantine {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-edr-quarantine svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-edr-quarantine:hover { background: var(--accent-hover); }

.quarantine-badge {
  background: #8b5cf6;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.btn-edr-sm {
  background: none;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 3px 8px;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.btn-edr-sm:hover { opacity: 1; }

.quarantine-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1100;
  align-items: center;
  justify-content: center;
}
.quarantine-panel {
  background: #0e0b1e;
  border: 1px solid #2d2855;
  border-radius: 10px;
  width: min(960px, 94vw);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #e0ddf0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.quarantine-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2d2855;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #16132d;
}
.quarantine-title {
  font-size: 15px;
  font-weight: 600;
  color: #e0ddf0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quarantine-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.quarantine-subtitle {
  font-size: 11px;
  color: #8b5cf6;
  margin-top: 4px;
}
.quarantine-close {
  background: none;
  border: none;
  color: #9590b8;
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: color 0.15s;
}
.quarantine-close:hover { color: #e0ddf0; }
.quarantine-body {
  overflow-y: auto;
  padding: 16px 20px;
  flex: 1;
}
.quarantine-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.quarantine-table thead { border-bottom: 1px solid #2d2855; }
.quarantine-table th {
  padding: 10px 8px;
  text-align: left;
  color: #8b5cf6;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2d2855;
  background: transparent;
}
.quarantine-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(45, 40, 85, 0.4);
  color: #e0ddf0;
  font-size: 12px;
  vertical-align: middle;
}
.quarantine-table tr:hover { background: rgba(139, 92, 246, 0.06); }
.quarantine-table th:nth-child(1), .quarantine-table td:nth-child(1) { width: 24%; }
.quarantine-table th:nth-child(2), .quarantine-table td:nth-child(2) { width: 10%; }
.quarantine-table th:nth-child(3), .quarantine-table td:nth-child(3) { width: 8%; }
.quarantine-table th:nth-child(4), .quarantine-table td:nth-child(4) { width: 18%; }
.quarantine-table th:nth-child(5), .quarantine-table td:nth-child(5) { width: 10%; }
.quarantine-table th:nth-child(6), .quarantine-table td:nth-child(6) { width: 14%; }
.quarantine-table th:nth-child(7), .quarantine-table td:nth-child(7) { width: 16%; }

.edr-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.edr-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.edr-stat label {
  color: var(--fg-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-body);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.edr-agent-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  max-height: 200px;
  overflow-y: auto;
}

.edr-agent-list li {
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  border-left: 3px solid var(--red);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg);
  font-size: 13px;
}

.edr-agent-list li.online {
  border-left-color: var(--green);
}

.edr-agent-list li small {
  color: var(--fg-dim);
  font-size: 10px;
  display: block;
}

.edr-refresh-btn {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: transparent;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  margin-top: 12px;
  transition: all 0.15s;
}

.edr-refresh-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  color: var(--fg);
}

.edr-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--fg);
  font-size: 13px;
}

.edr-summary strong { color: var(--fg); font-weight: 700; }

.edr-detection-queue {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.edr-detection-queue h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--fg);
  margin: 0 0 12px 0;
}

/* EDR Table */
.edr-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.edr-table thead { border-bottom: 1px solid var(--border); }
.edr-table th { padding: 8px 6px; text-align: left; color: var(--fg-muted); font-weight: 500; font-size: 11px; white-space: normal; overflow-wrap: anywhere; background: transparent; border-bottom: 1px solid var(--border); }
.edr-table td { padding: 8px 6px; border-bottom: 1px solid rgba(45, 40, 85, 0.4); color: var(--fg); font-size: 12px; white-space: normal; overflow-wrap: anywhere; word-break: break-word; vertical-align: top; line-height: 1.4; }
.edr-table td small { display: block; margin-top: 2px; font-size: 11px; color: var(--fg-dim); }
.edr-table tr:hover { background: var(--bg-card-hover); }
.edr-table .loading-row td { text-align: center; padding: 20px; color: var(--fg-dim); }

.edr-table th:nth-child(1), .edr-table td:nth-child(1) { width: 14%; }
.edr-table th:nth-child(2), .edr-table td:nth-child(2) { width: 12%; }
.edr-table th:nth-child(3), .edr-table td:nth-child(3) { width: 9%; }
.edr-table th:nth-child(4), .edr-table td:nth-child(4) { width: 17%; }
.edr-table th:nth-child(5), .edr-table td:nth-child(5) { width: 22%; }
.edr-table th:nth-child(6), .edr-table td:nth-child(6) { width: 26%; }

.edr-high-conf { color: var(--red); font-weight: bold; }
.edr-review-conf { color: var(--yellow); font-weight: bold; }
.edr-low-conf { color: var(--blue); }

.edr-event-badge {
  display: inline-block;
  min-width: 16px;
  text-align: center;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--blue-bg);
  color: var(--blue);
}

/* ---- EDR Actions Modal ---- */
/* The EDR actions modal uses inline styles from agents-edr.js.
   These overrides retheme the inline colours to the new palette. */
#edr-actions-modal > div {
  background: var(--bg) !important;
  border-color: var(--border) !important;
  color: var(--fg) !important;
  font-family: var(--font-body) !important;
  border-radius: 10px !important;
}

/* ---- Agent Log Modal ---- */
#agent-logs-modal > div {
  background: #0a0a0a !important;
  border-color: var(--border) !important;
  border-radius: 10px !important;
  font-family: var(--font-mono) !important;
}

#agent-logs-modal > div > div:first-child {
  background: var(--bg-card) !important;
  border-bottom-color: var(--border) !important;
}

#agent-logs-modal > div > div:last-child {
  background: var(--bg-card) !important;
  border-top-color: var(--border) !important;
}

/* ---- Review Modal ---- */
#review-modal > div {
  background: var(--bg) !important;
  border-color: var(--border) !important;
  border-radius: 10px !important;
}

/* ---- Analytics Modal ---- */
#analytics-modal > div {
  background: var(--bg) !important;
  border-color: var(--border) !important;
  border-radius: 10px !important;
}

/* ---- Edit Analyst Modal ---- */
#edit-analyst-modal > div {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  border-radius: 10px !important;
  font-family: var(--font-body) !important;
  color: var(--fg) !important;
}

/* ---- Database Section ---- */
.database-section { margin-top: 0; }
.database-section h3 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 20px 0 10px 0;
  color: var(--fg);
}

/* ---- Logs Section ---- */
.log-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 6px 0;
}

.log-card pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- Analyst Team ---- */
.analyst-edit-cell {
  border: none !important;
  background: transparent !important;
  padding-left: 10px;
  white-space: nowrap;
}

.analyst-edit-btn {
  background: transparent !important;
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 11px;
  transition: background 0.15s;
}

.analyst-edit-btn:hover {
  background: rgba(124, 107, 240, 0.12) !important;
}

/* ---- Needs Review Section ---- */
#needs-review-section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

#needs-review-section.collapsed #needs-review-container {
  display: none;
}

.collapse-toggle {
  transition: transform 0.2s;
}

#needs-review-section.collapsed .collapse-toggle {
  transform: rotate(-90deg);
}

/* ---- Login / Auth pages (split layout) ---- */
.login-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Left hero panel */
.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  border-right: 1px solid var(--border);
  background: linear-gradient(160deg, var(--bg) 0%, rgba(124, 107, 240, 0.04) 100%);
}
.login-hero-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(124, 107, 240, 0.3));
}
.login-hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-hero-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.login-hero-tagline {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}
.login-hero-divider {
  width: 200px;
  height: 1px;
  background: var(--border);
  margin-bottom: 20px;
}

/* Terminal typing bar */
.login-prompt {
  width: 100%;
  max-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.terminal-prefix { color: var(--green); flex-shrink: 0; }
.terminal-text { color: var(--fg-muted); flex: 1; white-space: nowrap; overflow: hidden; }
.terminal-cursor {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: var(--accent);
  flex-shrink: 0;
  animation: blink-cursor 1s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink-cursor { 50% { opacity: 0; } }

/* Feature list under the terminal bar */
.login-hero-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}
.login-hero-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-muted);
}
.login-hero-feature .feat-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(124, 107, 240, 0.1);
  border: 1px solid rgba(124, 107, 240, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.login-hero-version {
  margin-top: 24px;
  font-size: 11px;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.login-hero-version .online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Right form panel */
.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}

/* Screen switching (JS toggles .active) */
.login-screen { display: none; }
.login-screen.active { display: block; }

/* Form elements (shared by all auth pages) */
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-field { display: flex; flex-direction: column; gap: 8px; }
.login-label {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
}
.login-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.login-input::placeholder { color: var(--fg-dim); }
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124, 107, 240, 0.15); }

.password-wrapper { position: relative; }
.password-wrapper .login-input { padding-right: 44px; }
.eye-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.eye-toggle svg { width: 18px; height: 18px; }
.eye-toggle:hover { color: var(--fg); }

.login-error {
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  font-size: 12px;
  padding: 10px 14px;
}
.login-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Links and dividers inside the form */
.login-link {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.login-link:hover { text-decoration: underline; }
.login-back {
  color: var(--fg-muted);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.login-back:hover { color: var(--fg); }
.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--fg-dim);
  font-size: 11px;
}
.login-or::before, .login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Success icon (reused from change-password too) */
.login-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(46, 204, 113, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  border: 2px solid var(--green);
  color: var(--green);
}
.login-info-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(124, 107, 240, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  border: 2px solid var(--accent);
}

/* Password strength bar */
.pwd-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.pwd-strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}
.pwd-strength-bar.weak { background: var(--red); }
.pwd-strength-bar.medium { background: var(--yellow); }
.pwd-strength-bar.strong { background: var(--green); }

/* Footer for standalone auth pages */
.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 11px;
  color: var(--fg-dim);
}
.login-status { display: flex; align-items: center; gap: 4px; }

/* Responsive: stack hero above form on narrow screens */
@media (max-width: 768px) {
  .login-wrapper { flex-direction: column; }
  .login-hero {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 32px 16px;
    min-height: auto;
  }
  .login-form-side { padding: 24px 16px; }
  .login-hero-features { max-width: 100%; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .dash-layout { flex-direction: column; }
  .dash-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }
  .nav-item {
    padding: 8px 12px;
    white-space: nowrap;
    border-right: none;
    border-radius: 6px;
  }
  .nav-item.active {
    border-right: none;
    background: rgba(124, 107, 240, 0.15);
  }
  .nav-section-label { display: none; }
  .dash-main { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stat-summary-grid { grid-template-columns: 1fr 1fr; }
  .edr-agents-grid { grid-template-columns: 1fr; }
  .agent-management-container { grid-template-columns: 1fr; }
}

.form-input {
  background: #1d1a38;
  border: 1px solid #2d2855;
  color: #e0ddf0;
  padding: 8px 10px;
  border-radius: 3px;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
}