:root {
  --bg-deep: #050508;
  --bg-surface: rgba(8, 10, 18, 0.52);
  --glass: rgba(8, 12, 22, 0.45);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --text-muted: #8b92a5;
  --red: #ff2d55;
  --red-dim: rgba(255, 45, 85, 0.15);
  --red-glow: rgba(255, 45, 85, 0.45);
  --blue: #00b4ff;
  --blue-dim: rgba(0, 180, 255, 0.15);
  --blue-glow: rgba(0, 180, 255, 0.45);
  --gold: #eab308;
  --gold-dim: rgba(234, 179, 8, 0.12);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --display: 'Share Tech Mono', var(--mono);
}

html[data-theme="light"] {
  --bg-deep: #f4f5f7;
  --bg-surface: rgba(255, 255, 255, 0.65);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.09);
  --text: #141820;
  --text-muted: #5a6270;
  --red: #d91545;
  --red-dim: rgba(217, 21, 69, 0.08);
  --blue: #0088cc;
  --blue-dim: rgba(0, 136, 204, 0.08);
  --gold: #ca8a04;
  --gold-dim: rgba(202, 138, 4, 0.1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--mono);
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
  transition: color 0.35s ease;
}

html {
  background: var(--bg-deep);
  min-height: 100%;
}

#terrain-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 0, 0, 0.03) 2px, rgba(0, 0, 0, 0.03) 4px
  );
}

html[data-theme="light"] .scanlines {
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 0, 0, 0.018) 2px, rgba(0, 0, 0, 0.018) 4px
  );
}

.gradient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  transition: opacity 0.5s ease;
}

.orb-red {
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 70%);
  top: -160px; left: -120px;
}

.orb-blue {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--blue-glow) 0%, transparent 70%);
  bottom: -140px; right: -100px;
}

html[data-theme="light"] .gradient-orb { opacity: 0; }
html[data-theme="light"] #terrain-canvas { opacity: 0.7; }

.shell { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; background: transparent; }

/* ── Floating glass cards ── */
.float-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--glass-shadow);
  border-radius: 10px;
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.float-anim { animation: float-y 6s ease-in-out infinite; }
.float-anim-d1 { animation-delay: -1s; }
.float-anim-d2 { animation-delay: -2.2s; }
.float-anim-d3 { animation-delay: -3.4s; }
.float-anim-d4 { animation-delay: -4.6s; }
.float-anim-d5 { animation-delay: -0.6s; }

/* ── Hero stage (floating dashboard) ── */
.hero-stage {
  position: relative;
  min-height: 78vh;
  padding: 5.5rem 28px 2.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-title {
  text-align: center;
  margin-bottom: 0.5rem;
  pointer-events: none;
}

.kev-mega {
  font-family: var(--display);
  font-size: clamp(4.5rem, 14vw, 9rem);
  font-weight: 400;
  letter-spacing: 0.28em;
  line-height: 1;
  margin: 0;
  padding-left: 0.28em;
  background: linear-gradient(105deg, var(--red) 0%, #ff6b8a 35%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 40px rgba(255, 45, 85, 0.35)) drop-shadow(0 0 60px rgba(0, 180, 255, 0.2));
}

.kev-sub {
  margin: 0.65rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.float-deck {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: auto;
}

/* ── Table stage ── */
.table-stage {
  position: relative;
  padding: 0 28px 3rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-stage::before {
  content: "";
  display: block;
  height: 1px;
  margin: 0 0 1.5rem;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: 0.6;
}

main { background: transparent; padding: 0; max-width: none; }

/* ── Header ── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid transparent;
  background: linear-gradient(180deg, rgba(5, 5, 8, 0.75) 0%, rgba(5, 5, 8, 0) 100%);
  backdrop-filter: blur(8px);
}

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

.brand-icon {
  width: 38px; height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 180, 255, 0.35));
  flex-shrink: 0;
}

.brand-logo {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--text);
}

.brand-logo .letter {
  display: inline-block;
  animation: letter-rb 2.8s ease-in-out infinite;
}

.brand-logo .letter:nth-child(1) { color: var(--red); animation-delay: 0s; }
.brand-logo .letter:nth-child(2) { color: var(--red); animation-delay: 0.12s; }
.brand-logo .letter:nth-child(3) { color: var(--blue); animation-delay: 0.24s; }
.brand-logo .letter:nth-child(4) { color: var(--blue); animation-delay: 0.36s; }
.brand-logo .letter:nth-child(5) { color: var(--red); animation-delay: 0.48s; }
.brand-logo .letter:nth-child(6) { color: var(--blue); animation-delay: 0.6s; }

@keyframes letter-rb {
  0%, 100% { filter: drop-shadow(0 0 6px var(--red-glow)); }
  50% { filter: drop-shadow(0 0 8px var(--blue-glow)); }
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.theme-btn {
  color: var(--text-muted);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.theme-btn:hover {
  color: var(--text);
  border-color: rgba(0, 180, 255, 0.3);
  box-shadow: 0 0 16px var(--blue-dim);
}

.theme-label { display: none; }
html[data-theme="dark"] .theme-label[data-show="dark"],
html[data-theme="light"] .theme-label[data-show="light"] { display: inline; }

.hud {
  display: flex; gap: 20px; align-items: center;
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
}

.hud b { color: var(--blue); font-weight: 600; }

.hud-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
  animation: pulse 2s ease-in-out infinite;
  display: inline-block; margin-right: 6px;
}

@keyframes pulse { 50% { opacity: 0.4; } }

/* ── Sync bar ── */
.sync-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 10px 18px;
  font-size: 0.68rem; letter-spacing: 0.08em;
}

.sync-bar .label { color: var(--red); font-weight: 700; text-transform: uppercase; }
.sync-bar .ok { color: #4ade80; }
.sync-bar .fail { color: var(--red); }
.sync-bar .next { color: var(--gold); font-weight: 600; }

.sync-deltas { display: flex; gap: 10px; flex-wrap: wrap; }
.delta {
  padding: 3px 10px; border-radius: 3px;
  border: 1px solid var(--border);
  background: rgba(0, 180, 255, 0.04);
  color: #4ade80;
}
.delta b { color: var(--blue); }

.btn-ninja {
  font-family: var(--mono);
  font-size: 0.65rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent; color: var(--blue);
  cursor: pointer; transition: all 0.2s;
}
.btn-ninja:hover {
  background: rgba(0, 180, 255, 0.12);
  box-shadow: 0 0 16px rgba(0, 180, 255, 0.2);
}

/* ── Main ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  padding: 14px 16px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%; background: var(--red);
  border-radius: 10px 0 0 10px;
}
.kpi.cyan::before { background: var(--blue); }
.kpi.gold::before { background: var(--gold); }
.kpi .lbl {
  font-size: 0.6rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-muted);
}
.kpi .val {
  font-family: var(--display);
  font-size: 1.55rem; font-weight: 400;
  color: var(--blue);
  margin-top: 6px;
  letter-spacing: 0.04em;
}
.kpi.cyan .val { text-shadow: 0 0 24px rgba(0, 180, 255, 0.45); }
.kpi.gold .val { color: var(--gold); text-shadow: 0 0 24px rgba(234, 179, 8, 0.4); }
.kpi.red .val { color: var(--red); text-shadow: 0 0 24px rgba(255, 45, 85, 0.45); }
.kpi:not(.cyan):not(.gold):not(.red) .val { text-shadow: 0 0 20px rgba(0, 180, 255, 0.3); }

.top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .top-row { grid-template-columns: 1fr; } }

.panel {
  padding: 16px 18px;
}
.panel h6 {
  font-size: 0.65rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--red);
  margin: 0 0 10px;
}
.panel ul { list-style: none; padding: 0; margin: 0; }
.panel li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 0.78rem;
  border-bottom: 1px dashed rgba(136,146,168,0.12);
}
.panel li:last-child { border-bottom: 0; }
.pill {
  font-size: 0.6rem; padding: 1px 7px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--blue);
}
.pill.new {
  border-color: var(--red); color: var(--red);
  animation: pulse 1.5s ease-in-out infinite;
}

.date-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 12px 16px;
  font-size: 0.68rem; color: var(--text-muted);
}
.date-bar input[type="date"] {
  font-family: var(--mono); font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.35); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px; padding: 4px 8px;
}

/* ── DataTable overrides ── */
.table-wrap {
  padding: 18px;
  overflow: hidden;
}

table.dataTable {
  background: transparent !important;
  color: var(--text) !important;
  font-family: var(--mono); font-size: 0.75rem;
}
table.dataTable tbody tr {
  background: transparent !important;
}
table.table-bordered {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
}
table.dataTable thead { background: rgba(0,0,0,0.35) !important; }
table.dataTable thead th {
  border-color: var(--border) !important;
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.65rem; color: var(--blue) !important;
}
table.dataTable tbody td {
  border-color: rgba(136,146,168,0.08) !important;
  color: var(--text) !important;
}
table.dataTable tbody tr:hover {
  background: rgba(0, 180, 255, 0.04) !important;
}
table.dataTable tbody tr.reviewed {
  background: rgba(74,222,128,0.04) !important;
}
table.dataTable tbody tr.reviewed td:first-child {
  box-shadow: inset 3px 0 0 var(--blue);
}

thead input {
  width: 100%; font-family: var(--mono); font-size: 0.68rem;
  padding: 4px 6px; background: rgba(0, 0, 0, 0.35);
  color: var(--text); border: 1px solid var(--border);
  border-radius: 3px;
}
thead input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 8px rgba(0, 180, 255, 0.25);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-muted) !important; font-family: var(--mono); font-size: 0.72rem;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: rgba(0, 0, 0, 0.35) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 3px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--blue) !important;
  border-color: var(--border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: rgba(0, 180, 255, 0.15) !important; color: var(--text) !important;
}

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 3px;
  font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.tag-cve { color: var(--blue); border: 1px solid var(--blue); background: var(--blue-dim); }
.tag-new { color: #fff; background: var(--gold); border: 1px solid var(--gold); animation: pulse 1.4s infinite; }
.tag-ransom { color: #fff; background: var(--red); border: 1px solid var(--red); }
.tag-safe { color: #4ade80; border: 1px solid rgba(74,222,128,0.4); background: rgba(74,222,128,0.08); }
.tag-no { color: #fda4af; border: 1px solid rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }

.btn-view {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 3px;
  border: 1px solid var(--blue); background: transparent;
  color: var(--blue); cursor: pointer; text-transform: uppercase;
}
.btn-view:hover { background: var(--blue-dim); color: var(--text); }

.rev-chk {
  width: 16px; height: 16px; appearance: none;
  border: 1.5px solid var(--blue); border-radius: 3px;
  background: rgba(0,0,0,0.5); cursor: pointer; position: relative;
}
.rev-chk:checked {
  background: rgba(74,222,128,0.8); border-color: #4ade80;
}
.rev-chk:checked::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #042f1a; font-weight: 700; font-size: 11px;
}

.link-chip {
  display: inline-block; margin: 1px 2px; padding: 1px 5px;
  border-radius: 3px; font-size: 0.58rem; text-decoration: none;
  border: 1px solid var(--border); color: var(--blue);
}
.link-chip:hover { color: #fff; border-color: var(--blue); }
.link-chip.poc { border-color: rgba(255,209,102,0.5); color: var(--gold); }
.link-none { color: var(--text-muted); font-size: 0.65rem; }

.modal-content {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text); font-family: var(--mono);
  box-shadow: 0 0 40px rgba(0, 180, 255, 0.12);
}
.modal-title { color: var(--blue); font-family: var(--display); letter-spacing: 0.08em; }
.modal-body p { font-size: 0.75rem; margin: 4px 0; }
.modal-body b { color: var(--gold); font-size: 0.65rem; text-transform: uppercase; }

.footer {
  text-align: center; padding: 20px 28px 28px;
  font-size: 0.6rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-muted);
  background: transparent;
}
.footer span { color: var(--red); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  padding: 10px 16px; border-radius: 4px;
  font-family: var(--mono); font-size: 0.72rem;
  background: rgba(8,12,22,0.95); border: 1px solid var(--blue);
  color: var(--blue); opacity: 0; transform: translateY(8px);
  transition: all 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: #4ade80; color: #4ade80; }

html[data-theme="light"] .date-bar input[type="date"],
html[data-theme="light"] thead input,
html[data-theme="light"] .dataTables_wrapper .dataTables_filter input,
html[data-theme="light"] .dataTables_wrapper .dataTables_length select {
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--text) !important;
}

html[data-theme="light"] table.dataTable thead {
  background: rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] table.dataTable tbody tr:hover {
  background: rgba(0, 136, 204, 0.06) !important;
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] .rev-chk {
  background: rgba(255, 255, 255, 0.8);
}

html[data-theme="light"] .header {
  background: linear-gradient(180deg, rgba(244, 245, 247, 0.85) 0%, rgba(244, 245, 247, 0) 100%);
}

@media (max-width: 768px) {
  .hero-stage { padding: 5rem 16px 2rem; min-height: auto; }
  .table-stage { padding: 0 16px 2rem; }
  .header { padding: 12px 16px; }
  .kev-mega { letter-spacing: 0.18em; padding-left: 0.18em; }
  .hud { display: none; }
}
