:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #182033;
  --muted: #697386;
  --border: #e2e8f0;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --yellow: #ca8a04;
  --orange: #ea580c;
  --red: #dc2626;
  --critical: #7f1d1d;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.16), transparent 30%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a, #111827);
  color: white;
  padding: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4);
}

.brand h1 {
  margin: 0;
  font-size: 24px;
}

.brand p {
  margin: 3px 0 0;
  color: #cbd5e1;
  font-size: 13px;
}

.side-card {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 18px;
}

.side-label {
  color: #93c5fd;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.side-card strong {
  display: block;
  font-size: 20px;
  margin: 10px 0;
}

.side-card small {
  color: #cbd5e1;
  line-height: 1.5;
}

.side-warning {
  color: #fde68a;
  background: rgba(202, 138, 4, .15);
  border: 1px solid rgba(202, 138, 4, .35);
  padding: 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.45;
}

.main {
  padding: 32px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  font-size: 12px;
  margin: 0 0 8px;
}

.hero h2 {
  font-size: 42px;
  line-height: 1.05;
  max-width: 820px;
  margin: 0;
}

.hero-text {
  max-width: 820px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.status-pill {
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  color: var(--muted);
}

.pulse {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 0 7px rgba(22, 163, 74, 0.12);
}

.scan-panel,
.table-card,
.chart-card,
.summary-card,
.loading-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.scan-panel {
  padding: 26px;
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h3,
.table-header h3,
.chart-card h3 {
  margin: 0;
  font-size: 22px;
}

.panel-header p,
.table-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 18px;
}

.field.wide {
  grid-column: span 3;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  margin-bottom: 7px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 22px;
}

.loading-box p {
  margin: 4px 0 0;
  color: var(--muted);
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.summary-card {
  padding: 22px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 9px;
}

.summary-card strong {
  display: block;
  font-size: 24px;
}

.summary-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.risk-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.risk-row strong {
  font-size: 44px;
}

.risk-row em {
  font-style: normal;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e0f2fe;
  color: var(--blue-dark);
}

.risk-bar {
  height: 13px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
}

#riskFill {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width .4s ease;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.chart-card {
  padding: 22px;
}

#severityChart,
#stateChart {
  height: 300px;
}

.table-card {
  padding: 22px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.hidden {
  display: none !important;
}

.sev-bajo {
  color: var(--green);
  font-weight: 800;
}

.sev-medio {
  color: var(--yellow);
  font-weight: 800;
}

.sev-alto {
  color: var(--orange);
  font-weight: 800;
}

.sev-critico {
  color: var(--red);
  font-weight: 900;
}

.sev-info {
  color: var(--muted);
  font-weight: 600;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .hero {
    flex-direction: column;
  }

  .form-grid,
  .summary-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .field.wide {
    grid-column: span 1;
  }

  .hero h2 {
    font-size: 32px;
  }
}

.insights-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.insights-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
}

.insights-card ul {
  margin: 0;
  padding-left: 20px;
}

.insights-card li {
  margin-bottom: 8px;
  color: #334155;
  line-height: 1.5;
}

.finding-chip {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
  margin: 2px;
  font-size: 12px;
}

.banner-text {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #475569;
  font-family: Consolas, monospace;
}