/* The scanner UI: a dark sidebar around a light workspace. One stylesheet, no
   framework. Colours are tokens at the top; severities have their own. */

:root {
  color-scheme: light;

  /* Kallik's logo: a purple gradient (#6439B9 to #524EB4), red #FA1B1C and
     amber #FEB449. The reds and ambers here are darkened from the brand's, to
     stay readable as small text on white. */
  --chrome: #140e28;
  --chrome-2: #1d1540;
  --chrome-border: #2c2350;
  --chrome-text: #cfc9e2;
  --chrome-muted: #8d84ab;
  --chrome-hover: rgba(167, 139, 250, 0.12);

  --bg: #f4f3f9;
  --surface: #ffffff;
  --surface-muted: #f7f6fb;
  --surface-hover: #faf9fd;
  --border: #e5e3ef;
  --border-strong: #d2cfe0;
  --text: #16112b;
  --text-muted: #4b4463;
  --text-subtle: #6e6787;

  --primary: #5c3fb6;
  --primary-hover: #4b3299;
  --primary-soft: #efebfb;
  --primary-glow: rgba(92, 63, 182, 0.35);
  --ring: rgba(92, 63, 182, 0.3);

  --critical: #c41618;
  --critical-soft: #fdecec;
  --high: #d9691a;
  --high-soft: #fdf1e7;
  --medium: #a9780a;
  --medium-soft: #fdf4e2;
  --low: #5b6b82;
  --low-soft: #eef1f6;
  --low-bar: #9aa7ba;

  --success: #0e8a5f;
  --success-soft: #e5f6ee;
  --danger: #c41618;
  --danger-soft: #fdecec;
  --warning: #a9780a;
  --warning-soft: #fdf4e2;
  --neutral: #5b6474;
  --neutral-soft: #eef0f4;

  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.06);
  --shadow: 0 1px 2px rgba(11, 18, 32, 0.05), 0 4px 14px rgba(11, 18, 32, 0.05);
  --shadow-lg: 0 18px 50px rgba(11, 18, 32, 0.18);
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-width: 252px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* -------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

a {
  color: var(--primary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.eyebrow {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* -------------------------------------------------------------------------
   Loading
   ------------------------------------------------------------------------- */

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--chrome);
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

.spinner-lg {
  display: block;
  width: 30px;
  height: 30px;
  border-width: 3px;
  color: #a78bfa;
}

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #eceff4 25%, #f6f8fb 37%, #eceff4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-line {
  width: 70%;
  height: 12px;
  margin: 4px 0;
}

.skeleton-short {
  width: 110px;
}

.skeleton-title {
  width: 240px;
  height: 22px;
  margin: 4px 0;
}

.skeleton-value {
  width: 70%;
  height: 44px;
}

.skeleton-tile {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
}

.skeleton-row {
  width: 100%;
  height: 16px;
}

.skeleton-chart {
  width: 100%;
  height: 220px;
}

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

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: inherit;
  font: 600 13.5px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.2), 0 4px 14px -4px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

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

.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

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

.btn-ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.btn-lg {
  height: 46px;
  padding: 0 20px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  display: inline-flex;
}

.btn-icon .icon {
  width: 16px;
  height: 16px;
}

.btn.is-busy .spinner {
  display: block;
}

.btn.is-busy .btn-icon {
  display: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.icon-btn-dark {
  color: var(--chrome-muted);
}

.icon-btn-dark:hover {
  background: var(--chrome-hover);
  color: #ffffff;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.link .icon {
  width: 15px;
  height: 15px;
}

.link:hover {
  text-decoration: underline;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background-color 0.2s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(11, 18, 32, 0.3);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--ring);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-muted);
}

.segmented button {
  height: 28px;
  padding: 0 11px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font: 600 12.5px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* -------------------------------------------------------------------------
   Brand
   ------------------------------------------------------------------------- */

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

.brand-logo {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand-name {
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* -------------------------------------------------------------------------
   Sign in
   ------------------------------------------------------------------------- */

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

.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  padding: 48px;
  overflow: hidden;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(100, 57, 185, 0.38), transparent 70%),
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--chrome);
  color: var(--chrome-text);
}

.auth-brand-inner {
  max-width: 460px;
}

.auth-headline {
  margin: 36px 0 28px;
  color: #ffffff;
  font-size: 36px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
}

.auth-point-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  background: var(--chrome-2);
  color: #a78bfa;
  flex: none;
}

.auth-point-icon .icon {
  width: 15px;
  height: 15px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-title {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.auth-lead {
  margin: 8px 0 28px;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* -------------------------------------------------------------------------
   App shell
   ------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--chrome-border);
  background: linear-gradient(180deg, var(--chrome) 0%, #0d1526 100%);
  color: var(--chrome-text);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 18px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-heading {
  padding: 16px 10px 6px;
  color: #5d6a80;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--chrome-text);
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--chrome-hover);
  color: #ffffff;
}

.nav-item[aria-current="page"] {
  background: linear-gradient(90deg, rgba(100, 57, 185, 0.4), rgba(100, 57, 185, 0.12));
  color: #ffffff;
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #a78bfa;
  box-shadow: 0 0 12px #8b5cf6;
}

.nav-icon {
  display: inline-flex;
  color: var(--chrome-muted);
}

.nav-item[aria-current="page"] .nav-icon {
  color: #c4b5fd;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.nav-badge-live {
  background: rgba(139, 92, 246, 0.26);
  color: #ddd2ff;
  animation: glow 1.8s ease-in-out infinite;
}

.nav-badge-alert {
  background: rgba(250, 27, 28, 0.2);
  color: #ffb3b3;
}

.sidebar-schedule {
  display: flex;
  gap: 10px;
  margin: auto 4px 12px;
  padding: 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  background: rgba(17, 26, 46, 0.7);
}

.sidebar-schedule-icon {
  display: inline-flex;
  color: var(--chrome-muted);
}

.sidebar-schedule-icon .icon {
  width: 16px;
  height: 16px;
}

.sidebar-schedule-when {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-schedule-sub {
  color: var(--chrome-muted);
  font-size: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 2px 8px;
  border-top: 1px solid var(--chrome-border);
}

.sidebar-user-text {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name,
.sidebar-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-name {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user-email {
  color: var(--chrome-muted);
  font-size: 11.5px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #524eb4);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(11, 18, 32, 0.45);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}

.menu-btn {
  display: none;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.topbar-title p {
  overflow: hidden;
  color: var(--text-subtle);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.live-pill[data-state="running"] {
  border-color: rgba(92, 63, 182, 0.35);
  background: var(--primary-soft);
  color: var(--primary);
}

.live-pill[data-state="running"] .live-dot {
  background: var(--primary);
  animation: ping 1.6s ease-out infinite;
}

.live-pill[data-state="failed"] {
  border-color: rgba(196, 43, 58, 0.3);
  background: var(--danger-soft);
  color: var(--danger);
}

.live-pill[data-state="failed"] .live-dot {
  background: var(--danger);
}

.content {
  display: flex;
  flex-direction: column;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fade-in 0.2s ease-out;
}

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

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 var(--primary-glow);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
}

@keyframes glow {
  50% {
    opacity: 0.55;
  }
}

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

.card,
.status-card,
.sev-card,
.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-head-padded {
  padding: 18px 20px 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-lead {
  margin-top: 2px;
  color: var(--text-subtle);
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.section-title {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-meta {
  color: var(--text-subtle);
  font-size: 12.5px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
}

.fine-print {
  margin-top: 12px;
  color: var(--text-subtle);
  font-size: 12px;
}

/* -------------------------------------------------------------------------
   Scan status
   ------------------------------------------------------------------------- */

.status-card {
  position: relative;
  padding: 22px 22px 20px;
  overflow: hidden;
}

.status-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}

.status-card[data-state="running"]::before {
  background: linear-gradient(180deg, #8b5cf6, #524eb4, #8b5cf6);
  background-size: 100% 200%;
  box-shadow: 0 0 16px var(--primary-glow);
  animation: flow 2s linear infinite;
}

.status-card[data-state="success"]::before {
  background: var(--success);
}

.status-card[data-state="danger"]::before {
  background: var(--danger);
}

.status-body {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.status-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.status-icon .icon {
  width: 24px;
  height: 24px;
}

.status-card[data-state="success"] .status-icon {
  background: var(--success-soft);
  color: var(--success);
}

.status-card[data-state="danger"] .status-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-card[data-state="neutral"] .status-icon {
  background: var(--neutral-soft);
  color: var(--neutral);
}

.ring-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.status-text {
  flex: 1;
  min-width: 220px;
}

.status-title {
  margin-top: 1px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.status-detail {
  margin-top: 1px;
  color: var(--text-muted);
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-block {
  margin-top: 18px;
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, #524eb4, #8b5cf6);
  box-shadow: 0 0 12px var(--primary-glow);
  transition: width 0.6s ease;
}

.progress.is-indeterminate .progress-fill {
  width: 30%;
  animation: slide 1.4s ease-in-out infinite;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

@keyframes slide {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

@keyframes flow {
  to {
    background-position: 0 -200%;
  }
}

/* Steps */

.steps {
  display: grid;
  grid-template-columns: repeat(var(--steps, 3), minmax(0, 1fr));
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.steps:empty {
  display: none;
}

.step {
  position: relative;
  display: flex;
  gap: 10px;
  padding-right: 16px;
}

.step::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 8px;
  left: 34px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
}

.step:last-child::after {
  display: none;
}

.step[data-status="done"]::after {
  background: var(--success);
}

.step-marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-subtle);
  flex: none;
}

.step-marker .icon {
  width: 13px;
  height: 13px;
}

.step[data-status="done"] .step-marker {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}

.step[data-status="running"] .step-marker {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.step[data-status="running"] .step-marker::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: glow 1.2s ease-in-out infinite;
}

.step[data-status="failed"] .step-marker {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.step[data-status="stopped"] .step-marker {
  border-color: var(--warning);
  background: var(--warning);
  color: #ffffff;
}

.step[data-status="skipped"] .step-marker {
  border-style: dashed;
}

.step-text {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 2px 8px 0 0;
  background: var(--surface);
}

.step-label {
  font-size: 13px;
  font-weight: 650;
}

.step[data-status="pending"] .step-label,
.step[data-status="skipped"] .step-label {
  color: var(--text-subtle);
}

.step-meta {
  color: var(--text-subtle);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.steps-vertical {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.steps-vertical .step::after {
  top: 30px;
  right: auto;
  bottom: -12px;
  left: 11px;
  width: 2px;
  height: auto;
}

/* -------------------------------------------------------------------------
   Severity and headline figures
   ------------------------------------------------------------------------- */

.severity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.sev-card {
  position: relative;
  padding: 16px 18px 14px;
  overflow: hidden;
  border-top: 3px solid var(--sev, var(--border-strong));
}

.sev-card[data-severity="CRITICAL"] {
  --sev: var(--critical);
  --sev-soft: var(--critical-soft);
}

.sev-card[data-severity="HIGH"] {
  --sev: var(--high);
  --sev-soft: var(--high-soft);
}

.sev-card[data-severity="MEDIUM"] {
  --sev: var(--medium);
  --sev-soft: var(--medium-soft);
}

.sev-card[data-severity="LOW"] {
  --sev: var(--low);
  --sev-soft: var(--low-soft);
}

.sev-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--sev-soft, transparent), transparent 70%);
  pointer-events: none;
}

.sev-top {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--sev);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--sev);
}

.sev-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.sev-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  padding: 2px 7px 2px 5px;
  border-radius: 6px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.sev-delta .icon {
  width: 12px;
  height: 12px;
}

.sev-delta[data-trend="up"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.sev-delta[data-trend="down"] {
  background: var(--success-soft);
  color: var(--success);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.kpis:empty {
  display: none;
}

.kpi {
  padding: 12px 14px;
  box-shadow: none;
}

.kpi-label {
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 550;
}

.kpi-value {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-value[data-tone="danger"] {
  color: var(--danger);
}

.kpi-value[data-tone="success"] {
  color: var(--success);
}

/* -------------------------------------------------------------------------
   Trend chart
   ------------------------------------------------------------------------- */

.chart {
  position: relative;
  margin-top: 14px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 240px;
  overflow: visible;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--text-subtle);
  font-family: var(--mono);
  font-size: 10.5px;
}

.chart-bar[data-severity="CRITICAL"] {
  fill: var(--critical);
}

.chart-bar[data-severity="HIGH"] {
  fill: var(--high);
}

.chart-bar[data-severity="MEDIUM"] {
  fill: var(--medium);
}

.chart-bar[data-severity="LOW"] {
  fill: var(--low-bar);
}

.chart-column-hit {
  fill: transparent;
  cursor: crosshair;
}

.chart-column-hit:hover {
  fill: rgba(92, 63, 182, 0.07);
}

.chart-tip {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  min-width: 150px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--chrome);
  color: #ffffff;
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  transform: translate(calc(var(--x, 0) * 1px - 50%), calc(var(--y, 0) * 1px - 100% - 10px));
}

.chart-tip-date {
  margin-bottom: 5px;
  color: #93a3bd;
  font-family: var(--mono);
  font-size: 11px;
}

.chart-tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}

.chart-tip-row span:last-child {
  margin-left: auto;
  padding-left: 12px;
  font-family: var(--mono);
  font-weight: 700;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 220px;
  color: var(--text-subtle);
}

.legend {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  font: 600 12px/1 var(--font);
  cursor: pointer;
}

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

.legend-item[aria-pressed="false"] {
  opacity: 0.45;
}

.legend-item[aria-pressed="false"] .swatch {
  background: var(--border-strong);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--low-bar);
  flex: none;
}

.swatch[data-severity="CRITICAL"] {
  background: var(--critical);
}

.swatch[data-severity="HIGH"] {
  background: var(--high);
}

.swatch[data-severity="MEDIUM"] {
  background: var(--medium);
}

/* -------------------------------------------------------------------------
   Accounts
   ------------------------------------------------------------------------- */

.attention {
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.attention-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.attention-row:last-child {
  border-bottom: none;
}

.attention-rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.account-cell {
  min-width: 0;
}

.account-name {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-id {
  color: var(--text-subtle);
  font-family: var(--mono);
  font-size: 11.5px;
}

.sev-chips {
  display: flex;
  gap: 5px;
}

.sev-chip {
  min-width: 34px;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sev-chip[data-severity="CRITICAL"] {
  background: var(--critical-soft);
  color: var(--critical);
}

.sev-chip[data-severity="HIGH"] {
  background: var(--high-soft);
  color: var(--high);
}

.sev-chip[data-zero] {
  background: var(--surface-muted);
  color: #a3adbd;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.count {
  font-weight: 650;
}

.count[data-zero] {
  color: #b0b9c7;
  font-weight: 500;
}

.count[data-severity="CRITICAL"]:not([data-zero]) {
  color: var(--critical);
  font-weight: 800;
}

.count[data-severity="HIGH"]:not([data-zero]) {
  color: var(--high);
  font-weight: 750;
}

.risk {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.risk-bar {
  position: relative;
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.risk-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--medium), var(--high) 60%, var(--critical));
}

.risk-score {
  width: 48px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-tag[data-status="scanned"] {
  background: var(--success-soft);
  color: var(--success);
}

.status-tag[data-status="partial"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-tag[data-status="unreachable"] {
  background: var(--danger-soft);
  color: var(--danger);
}

/* -------------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  padding: 9px 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

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

.table tbody tr:hover td {
  background: var(--surface-hover);
}

.table-interactive tbody tr[data-scan] {
  cursor: pointer;
}

.table-interactive tbody tr[data-scan]:focus-visible td {
  background: var(--primary-soft);
}

.table td.num {
  font-family: var(--mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table th.num {
  text-align: right;
}

.table .center {
  text-align: center;
}

.cell-primary {
  display: block;
  font-weight: 650;
}

.cell-secondary {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
}

.row-chevron {
  display: inline-flex;
  color: var(--text-subtle);
}

.row-chevron .icon {
  width: 16px;
  height: 16px;
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.person-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.person-icon .icon {
  width: 13px;
  height: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-running {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-running .badge-dot {
  animation: glow 1.2s ease-in-out infinite;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-neutral {
  background: var(--neutral-soft);
  color: var(--neutral);
}

.emailed {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.emailed .icon {
  width: 13px;
  height: 13px;
}

.muted-dash {
  color: #b0b9c7;
}

/* -------------------------------------------------------------------------
   Reports
   ------------------------------------------------------------------------- */

.grid-2-wide {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

.reports {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}

.report {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.report:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.file-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
}

.file-green {
  background: #e3f5ec;
  color: #11794f;
}

.file-blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.file-violet {
  background: #fdf4e2;
  color: #a9780a;
}

.report-text {
  flex: 1;
  min-width: 0;
}

.report-name {
  font-weight: 650;
}

.report-description {
  overflow: hidden;
  color: var(--text-subtle);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-feature {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  overflow: hidden;
  border-color: var(--chrome-border);
  background:
    radial-gradient(420px 240px at 110% -20%, rgba(100, 57, 185, 0.55), transparent 70%),
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--chrome);
}

.card-title-light {
  color: #ffffff;
}

.card-lead-light {
  margin-bottom: 14px;
  color: var(--chrome-text);
}

.fine-print-light {
  color: var(--chrome-muted);
}

.feature-art {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 48px;
  margin-bottom: 12px;
}

.feature-art span {
  width: 10px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #a78bfa, #524eb4);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.45);
}

.feature-art span:nth-child(1) {
  height: 35%;
}

.feature-art span:nth-child(2) {
  height: 60%;
}

.feature-art span:nth-child(3) {
  height: 45%;
}

.feature-art span:nth-child(4) {
  height: 80%;
}

.feature-art span:nth-child(5) {
  height: 55%;
}

.feature-art span:nth-child(6) {
  height: 95%;
  background: linear-gradient(180deg, #feb449, #d98a0b);
  box-shadow: 0 0 10px rgba(254, 180, 73, 0.45);
}

/* -------------------------------------------------------------------------
   Drawer
   ------------------------------------------------------------------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: drawer-in 0.2s ease-out;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  word-break: break-all;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px;
  overflow-y: auto;
}

.meta-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px 16px;
  margin: 0;
  font-size: 13px;
}

.meta-list dt {
  color: var(--text-subtle);
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* -------------------------------------------------------------------------
   Empty states and toasts
   ------------------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  color: var(--text-subtle);
  text-align: center;
  white-space: normal;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 6px;
  border-radius: 11px;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.empty-title {
  color: var(--text);
  font-weight: 650;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius);
  background: var(--chrome);
  color: #e6ebf3;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s ease-out;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
  margin-top: 1px;
}

.toast-success .toast-icon {
  color: #34d399;
}

.toast-danger .toast-icon {
  color: #ff6b6c;
}

.toast-message {
  flex: 1;
  font-size: 13.5px;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--chrome-muted);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--chrome-hover);
  color: #ffffff;
}

.toast-close .icon {
  width: 14px;
  height: 14px;
}

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

/* -------------------------------------------------------------------------
   Smaller screens and reduced motion
   ------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .app.nav-open .sidebar {
    transform: none;
  }

  .menu-btn {
    display: inline-grid;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 20px 16px 48px;
  }

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

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

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

  .auth-brand {
    padding: 32px 20px;
  }

  .auth-headline {
    margin: 24px 0 18px;
    font-size: 26px;
  }
}

@media (max-width: 640px) {
  .topbar .btn-label,
  .topbar-title p {
    display: none;
  }

  .status-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .step::after {
    display: none;
  }

  .sev-value {
    font-size: 26px;
  }

  .table th,
  .table td {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spinner,
  .ring-spinner {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
}
