:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #5b677a;
  --line: #d9e0e8;
  --blue: #1d4ed8;
  --green: #047857;
  --amber: #b45309;
  --red: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  background: #0f172a;
  color: white;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

.status {
  text-align: right;
}

.status span {
  display: block;
  font-weight: 700;
}

.status small {
  color: #cbd5e1;
}

.controls {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  display: block;
  min-width: 180px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 14px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 10px;
}

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

.section-title p {
  color: var(--muted);
  font-size: 13px;
}

.funnel-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 10px;
}

.stage {
  position: relative;
  min-height: 116px;
  padding: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 8px;
  height: 2px;
  background: var(--line);
}

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

.stage span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stage strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.stage small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.table-section {
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #eaf0f7;
  color: #263244;
  font-size: 12px;
}

th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2),
.name-cell {
  text-align: left;
}

.name-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

.risk-high {
  color: var(--red);
  font-weight: 700;
}

.risk-good {
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 980px) {
  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 620px) {
  .shell {
    width: calc(100vw - 20px);
  }

  .controls,
  .summary-grid,
  .funnel-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  select {
    width: 100%;
  }
}
