:root {
  --bg-dark: #0a0e1a;
  --bg-card: #111827;
  --bg-card2: #1a2236;
  --accent: #00d4ff;
  --accent2: #0066cc;
  --red: #ff3b3b;
  --orange: #ff8c00;
  --yellow: #ffd700;
  --green: #00e676;
  --cyan: #00bcd4;
  --low: #1a3a5c;
  --text: #e2e8f0;
  --muted: #8892a4;
  --border: #1e2d4a;
}

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

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

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

a:hover {
  text-decoration: underline;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: #060b14;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-name span {
  color: var(--accent);
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: -2px;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.threat-level-badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid;
}

.tl-elevated {
  color: var(--orange);
  background: rgba(255, 140, 0, 0.1);
  border-color: rgba(255, 140, 0, 0.4);
}

.tl-high {
  color: var(--red);
  background: rgba(255, 59, 59, 0.1);
  border-color: rgba(255, 59, 59, 0.4);
}

.tl-medium {
  color: var(--yellow);
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.4);
}

.tl-low {
  color: var(--green);
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.4);
}

.hdr-clock {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.refresh-countdown {
  font-size: 11px;
  color: var(--accent);
  border-left: 1px solid var(--border);
  padding-left: 14px;
  font-variant-numeric: tabular-nums;
  min-width: 78px;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  height: calc(100vh - 60px);
}

.panel {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel.right {
  border-right: none;
  border-left: 1px solid var(--border);
}

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

.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
}

.subsection-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin: 14px 0 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.panel-body::-webkit-scrollbar {
  width: 4px;
}

.panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.state-panel-body {
  padding-bottom: 20px;
}

.map-container {
  position: relative;
  background: #05080f;
}

#threat-map {
  width: 100%;
  height: calc(100% - 36px);
}

.map-overlay-title {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(6, 11, 20, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 20px;
  text-align: center;
  backdrop-filter: blur(6px);
}

.map-overlay-title h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.map-overlay-title p {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.feed-item {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.15s;
}

.feed-item:hover {
  background: #1f2e48;
}

.fi-critical {
  border-left-color: var(--red);
}

.fi-high {
  border-left-color: var(--orange);
}

.fi-medium {
  border-left-color: var(--yellow);
}

.fi-low {
  border-left-color: var(--green);
}

.fi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.fi-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.fi-sev {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.sev-critical {
  background: rgba(255, 59, 59, 0.2);
  color: var(--red);
}

.sev-high {
  background: rgba(255, 140, 0, 0.2);
  color: var(--orange);
}

.sev-medium {
  background: rgba(255, 215, 0, 0.2);
  color: var(--yellow);
}

.sev-low {
  background: rgba(0, 230, 118, 0.15);
  color: var(--green);
}

.fi-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fi-cve {
  font-family: monospace;
  color: var(--accent);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: var(--bg-card2);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.state-row:hover {
  background: #1f2e48;
}

.state-row:hover .sr-name {
  color: var(--accent);
}

.sr-name {
  font-weight: 600;
}

.sr-meta {
  min-width: 42px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sr-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 10px;
  overflow: hidden;
}

.sr-fill {
  height: 100%;
  border-radius: 2px;
}

.sr-score {
  font-size: 11px;
  font-weight: 700;
  min-width: 28px;
  text-align: right;
}

.legend {
  position: absolute;
  bottom: 48px;
  left: 14px;
  z-index: 500;
  background: rgba(6, 11, 20, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 140px;
  backdrop-filter: blur(6px);
}

.legend-title {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dot-critical {
  background: var(--red);
}

.dot-high {
  background: var(--orange);
}

.dot-elevated {
  background: var(--yellow);
}

.dot-moderate {
  background: var(--cyan);
}

.dot-low {
  background: var(--low);
}

.timeline-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

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

.tl-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.tl-line {
  flex: 1;
  width: 2px;
  background: var(--border);
  margin-top: 4px;
}

.tl-content .tl-time {
  font-size: 9px;
  color: var(--muted);
}

.tl-content .tl-event {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.tl-content .tl-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.stats-strip {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.ss-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ss-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ss-critical {
  background: var(--red);
}

.ss-high {
  background: var(--orange);
}

.ss-medium {
  background: var(--yellow);
}

.loader-ring {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-ring[hidden] {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.leaflet-tooltip.state-tip {
  background: #0a0e1a !important;
  border: 1px solid #00d4ff !important;
  color: #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 6px 12px !important;
  font-family: "Segoe UI", sans-serif !important;
  font-size: 12px !important;
  box-shadow: 0 4px 14px rgba(0, 212, 255, 0.25) !important;
  pointer-events: none !important;
  white-space: nowrap;
}

.leaflet-tooltip-top.state-tip::before {
  border-top-color: #00d4ff !important;
}

.about-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.about-btn:hover,
.secondary-btn:hover {
  background: rgba(0, 212, 255, 0.18);
  border-color: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(2, 5, 12, 0.88);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #0d1526;
  border: 1px solid #1e2d4a;
  border-radius: 12px;
  padding: 36px 40px;
  max-width: 860px;
  width: min(94vw, 860px);
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-box::-webkit-scrollbar {
  width: 4px;
}

.modal-box::-webkit-scrollbar-thumb {
  background: #1e2d4a;
  border-radius: 2px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-media {
  text-align: center;
  margin-bottom: 16px;
}

.modal-hero {
  max-width: 440px;
  width: 88%;
  height: auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 28px;
}

.modal-section,
.profile-section {
  margin-bottom: 24px;
}

.modal-section h3,
.profile-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 10px;
  border-bottom: 1px solid #1e2d4a;
  padding-bottom: 6px;
}

.modal-section p,
.modal-section li,
.profile-copy,
.profile-anchor {
  font-size: 13px;
  color: #c8d3e0;
  line-height: 1.7;
  margin-bottom: 6px;
}

.modal-section ul {
  padding-left: 18px;
}

.modal-footer-note {
  font-size: 10px;
  color: #4a5568;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #1e2d4a;
}

.modal-brand-footer {
  text-align: center;
  margin-top: 20px;
}

.footer-brand {
  max-width: 220px;
  width: 60%;
  height: auto;
}

.cve-search-wrap {
  display: flex;
  align-items: center;
  margin: 8px 12px 4px;
  background: #0b1526;
  border: 1px solid #1e2d4a;
  border-radius: 6px;
  overflow: hidden;
}

.cve-search-icon {
  color: #3b4a63;
  font-size: 12px;
  padding: 0 8px;
  white-space: nowrap;
}

.cve-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #c8d6e8;
  font-size: 12px;
  padding: 7px 6px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.cve-search-input::placeholder {
  color: #3b4a63;
}

.cve-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #3b4a63;
  font-size: 14px;
  padding: 0 10px;
  line-height: 1;
  display: none;
}

.cve-search-clear:hover {
  color: #94a3b8;
}

.search-result-info {
  font-size: 11px;
  color: #64748b;
  padding: 4px 14px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nvd-lookup-btn {
  background: #0f2038;
  border: 1px solid #1e4068;
  color: #60a5fa;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.nvd-lookup-btn:hover {
  background: #1e3a5f;
}

.nvd-direct-card {
  background: #0b1526;
  border: 1px solid #1e4068;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 6px;
}

.soc-footer {
  background: #060b14;
  border-top: 1px solid #1e2d4a;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: #8892a4;
  letter-spacing: 0.5px;
}

.empty-state {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

.profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.profile-eyebrow {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.profile-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 24px;
  background: #0d1525;
  border: 1px solid #1e2d4a;
}

.score-big {
  font-size: 26px;
  font-weight: 800;
}

.score-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.cm-sector {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.threat-card {
  background: #0d1525;
  border: 1px solid #1e2d4a;
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 10px;
}

.threat-card-hdr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
}

.threat-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tt-apt {
  background: #0f1f3d;
  color: #4fc3f7;
}

.tt-ransomware {
  background: #3d0f0f;
  color: #ff6b6b;
}

.tt-phishing {
  background: #2d1a00;
  color: #ffb74d;
}

.tt-ot {
  background: #0a2a1a;
  color: #66bb6a;
}

.tt-insider {
  background: #2a1a3d;
  color: #ce93d8;
}

.tt-supply {
  background: #1a2a0f;
  color: #aed581;
}

.tt-bec {
  background: #2a2a00;
  color: #fff176;
}

.tt-iot {
  background: #0f2a2a;
  color: #4dd0e1;
}

.threat-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.threat-card-detail {
  font-size: 12px;
  color: #8892a4;
  line-height: 1.7;
  margin-top: 2px;
}

.kev-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 11px;
  background: #0d1525;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 11px;
}

.kev-cve {
  color: var(--accent);
  font-family: monospace;
  flex-shrink: 0;
  min-width: 130px;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.kev-desc {
  color: #8892a4;
  line-height: 1.55;
}

.profile-footer {
  font-size: 10px;
  color: #8892a4;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #1e2d4a;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel,
  .panel.right {
    border-left: none;
    border-right: none;
    min-height: 320px;
  }

  .map-container {
    min-height: 540px;
  }

  #threat-map {
    height: 504px;
  }

  .legend {
    bottom: 58px;
  }
}

@media (max-width: 860px) {
  header {
    height: auto;
    min-height: 60px;
    padding: 12px 16px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .status-bar {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .layout {
    height: auto;
  }

  .modal-box {
    padding: 28px 22px;
  }

  .profile-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
