:root {
  --bg-0: #050608;
  --bg-1: #080b10;
  --bg-2: #0d1118;

  --panel: rgba(15, 19, 27, 0.88);
  --panel-strong: rgba(20, 25, 35, 0.96);
  --panel-soft: rgba(14, 18, 25, 0.7);

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(154, 112, 255, 0.32);

  --text: #f4f6fa;
  --text-soft: #c7cdd8;
  --muted: #7f8998;

  --purple: #9b72ff;
  --purple-deep: #5e36c9;
  --purple-glow: rgba(139, 92, 246, 0.24);

  --teal: #47e0c0;
  --teal-glow: rgba(71, 224, 192, 0.18);

  --critical: #ff5468;
  --high: #ff9d52;
  --medium: #eacb63;
  --low: #61d395;
  --info: #69b7ff;

  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.44);
  --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.3);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 76% -10%,
      rgba(110, 71, 220, 0.2),
      transparent 34%
    ),
    radial-gradient(
      circle at 18% 105%,
      rgba(23, 126, 111, 0.12),
      transparent 32%
    ),
    linear-gradient(145deg, #050608 0%, #080a0f 48%, #06080c 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(
      90deg,
      rgba(5, 6, 8, 0.2),
      transparent 20%,
      transparent 80%,
      rgba(5, 6, 8, 0.2)
    ),
    radial-gradient(circle at center, transparent 25%, rgba(0, 0, 0, 0.32));
}

/* ---------- Application shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 30px 22px 24px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(
      180deg,
      rgba(13, 16, 23, 0.97),
      rgba(7, 9, 13, 0.97)
    );
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.22);
}

.sidebar::before {
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 180px;
  content: "";
  background: linear-gradient(
    180deg,
    transparent,
    var(--purple),
    transparent
  );
  box-shadow: 0 0 18px var(--purple);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 2px 4px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.mark {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(155, 114, 255, 0.54);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(111, 67, 218, 0.34), rgba(11, 14, 20, 0.96));
  color: #ffffff;
  font-size: 18px;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 5px rgba(155, 114, 255, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 28px var(--purple-glow);
}

.mark::after {
  position: absolute;
  width: 30px;
  height: 60px;
  content: "";
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.14),
    transparent
  );
  transform: rotate(32deg) translateX(-35px);
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 54px;
}

.nav-item,
.link-button {
  position: relative;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  padding: 13px 15px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.nav-item:hover,
.link-button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(2px);
}

.nav-item.active {
  color: #ffffff;
  border-color: rgba(155, 114, 255, 0.22);
  background:
    linear-gradient(
      90deg,
      rgba(120, 75, 232, 0.2),
      rgba(120, 75, 232, 0.055)
    );
  box-shadow:
    inset 3px 0 0 var(--purple),
    0 8px 26px rgba(0, 0, 0, 0.18);
}

.nav-item.active::after {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  content: "";
  background: var(--purple);
  box-shadow: 0 0 12px var(--purple);
  transform: translateY(-50%);
}

.agent-state {
  margin-top: auto;
  padding: 15px 16px;
  border: 1px solid rgba(71, 224, 192, 0.12);
  border-radius: 12px;
  background: rgba(71, 224, 192, 0.04);
  color: var(--text-soft);
  font-size: 12px;
}

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow:
    0 0 0 5px rgba(71, 224, 192, 0.07),
    0 0 16px var(--teal);
  animation: pulse 2.2s infinite;
}

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

  50% {
    opacity: 0.52;
  }
}

/* ---------- Main content ---------- */

main {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 48px clamp(28px, 4vw, 64px) 72px;
}

header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

header {
  margin-bottom: 34px;
}

header > div:first-child {
  max-width: 980px;
}

h1,
h2,
h3 {
  color: var(--text);
}

h1 {
  max-width: 950px;
  margin: 8px 0 0;
  font-size: clamp(32px, 4vw, 58px);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

h2 {
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.eyebrow {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.status-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(71, 224, 192, 0.18);
  border-radius: 999px;
  background: rgba(71, 224, 192, 0.055);
  color: var(--text-soft);
  padding: 9px 13px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status-chip::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  content: "";
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(
      145deg,
      rgba(20, 25, 34, 0.92),
      rgba(11, 14, 20, 0.94)
    );
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.025),
    var(--shadow-md);
  backdrop-filter: blur(16px);
}

.card::before {
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  content: "";
  background: linear-gradient(
    90deg,
    transparent,
    rgba(155, 114, 255, 0.38),
    transparent
  );
}

.card:hover {
  border-color: rgba(155, 114, 255, 0.18);
}

.scan-panel {
  padding: 30px;
  border-color: rgba(155, 114, 255, 0.18);
  background:
    radial-gradient(
      circle at 88% 0%,
      rgba(110, 67, 218, 0.16),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      rgba(22, 27, 38, 0.96),
      rgba(10, 13, 19, 0.96)
    );
}

.scan-panel h2 {
  max-width: 780px;
  font-size: clamp(21px, 2.2vw, 29px);
  line-height: 1.28;
}

.scan-panel .eyebrow {
  margin-bottom: 10px;
}

/* ---------- Scan form ---------- */

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 26px;
}

input,
button {
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 11px;
  font: inherit;
}

input {
  width: 100%;
  background: rgba(5, 8, 12, 0.86);
  color: var(--text);
  padding: 0 16px;
  box-shadow:
    inset 0 1px 8px rgba(0, 0, 0, 0.28),
    0 0 0 1px transparent;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input::placeholder {
  color: #5f6875;
}

input:hover {
  border-color: rgba(255, 255, 255, 0.13);
}

input:focus {
  outline: none;
  border-color: rgba(155, 114, 255, 0.78);
  background: rgba(8, 11, 16, 0.94);
  box-shadow:
    0 0 0 4px rgba(155, 114, 255, 0.09),
    0 0 24px rgba(155, 114, 255, 0.09);
}

button {
  position: relative;
  overflow: hidden;
  border-color: rgba(155, 114, 255, 0.72);
  background:
    linear-gradient(135deg, var(--purple-deep), var(--purple));
  color: #ffffff;
  padding: 0 21px;
  cursor: pointer;
  font-weight: 760;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 10px 28px rgba(93, 54, 201, 0.27);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.16),
    0 14px 34px rgba(93, 54, 201, 0.36),
    0 0 24px rgba(155, 114, 255, 0.16);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.48;
  cursor: wait;
  filter: saturate(0.5);
  transform: none;
}

/* Checkbox row */

.escalate {
  display: flex;
  grid-column: 1 / -1;
  gap: 10px;
  align-items: center;
  width: fit-content;
  margin-top: 2px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.escalate input {
  position: relative;
  display: grid;
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  appearance: none;
  place-content: center;
  border: 1px solid rgba(155, 114, 255, 0.45);
  border-radius: 5px;
  background: rgba(7, 9, 13, 0.9);
  cursor: pointer;
}

.escalate input::before {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  content: "";
  background: linear-gradient(135deg, var(--purple-deep), var(--purple));
  box-shadow: 0 0 10px rgba(155, 114, 255, 0.5);
  transform: scale(0);
  transition: transform 120ms ease;
}

.escalate input:checked::before {
  transform: scale(1);
}

.message {
  min-height: 20px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-error {
  margin-top: 7px;
  color: #ff8f9c;
  font-size: 12px;
}

/* ---------- Metrics ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin: 18px 0;
}

.metric {
  min-height: 126px;
  padding: 21px 22px;
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.metric:hover {
  border-color: rgba(255, 255, 255, 0.13);
  transform: translateY(-2px);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 13px;
  color: var(--text);
  font-size: clamp(32px, 3vw, 43px);
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric.critical {
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(255, 84, 104, 0.11),
      transparent 46%
    ),
    var(--panel);
}

.metric.high {
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(255, 157, 82, 0.1),
      transparent 46%
    ),
    var(--panel);
}

.metric.critical strong {
  color: var(--critical);
  text-shadow: 0 0 22px rgba(255, 84, 104, 0.2);
}

.metric.high strong {
  color: var(--high);
  text-shadow: 0 0 22px rgba(255, 157, 82, 0.16);
}

/* ---------- Dashboard grids ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
  gap: 18px;
}

.grid > .card {
  min-height: 360px;
  padding: 24px;
}

.section-head {
  min-height: 34px;
}

.section-head h2 {
  font-size: 18px;
}

.link-button {
  width: auto;
  min-height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
}

.list {
  margin-top: 18px;
}

.empty {
  display: grid;
  min-height: 255px;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.item {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.item:first-child {
  border-top: 0;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.item-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ---------- Severity badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: max-content;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.badge.critical {
  color: var(--critical);
  background: rgba(255, 84, 104, 0.06);
}

.badge.high {
  color: var(--high);
  background: rgba(255, 157, 82, 0.06);
}

.badge.medium {
  color: var(--medium);
  background: rgba(234, 203, 99, 0.055);
}

.badge.low {
  color: var(--low);
  background: rgba(97, 211, 149, 0.055);
}

/* ---------- Views and tables ---------- */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

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

.page-head {
  margin-bottom: 20px;
}

.page-head h2 {
  font-size: clamp(26px, 3vw, 38px);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(10, 13, 18, 0.78);
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 19, 27, 0.97);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

td {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(155, 114, 255, 0.035);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

/* ---------- Scrollbars ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: #353c48 transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

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

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #353c48;
  background-clip: padding-box;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 16px;
  }

  main {
    padding-inline: 28px;
  }

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

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    margin-bottom: 16px;
  }

  nav {
    display: flex;
    gap: 7px;
    margin-top: 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    width: auto;
    min-width: max-content;
  }

  .nav-item.active {
    box-shadow: inset 0 -2px 0 var(--purple);
  }

  .nav-item.active::after,
  .agent-state {
    display: none;
  }

  main {
    padding: 28px 18px 48px;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 34px;
  }

  .scan-panel {
    padding: 22px;
  }

  form {
    grid-template-columns: 1fr;
  }

  form button {
    width: 100%;
  }

  .escalate {
    grid-column: auto;
    align-items: flex-start;
    line-height: 1.4;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric {
    min-height: 110px;
    padding: 17px;
  }

  .metric strong {
    font-size: 31px;
  }

  .grid > .card {
    min-height: 310px;
    padding: 19px;
  }
}

@media (max-width: 420px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .status-chip {
    white-space: normal;
  }
}