:root {
  --bg: #dfe6e7;
  --paper: #fbfaf7;
  --paper-strong: #ffffff;
  --ink: #1b2429;
  --muted: #657077;
  --line: #d9dfdf;
  --line-strong: #c6cdce;
  --green: #1d7a55;
  --green-soft: #e1f3e8;
  --amber: #d98b24;
  --amber-soft: #fff0d8;
  --red: #c94e57;
  --red-soft: #ffe3e7;
  --blue: #2f75bd;
  --blue-soft: #dfeeff;
  --teal: #356f64;
  --shadow: 0 24px 70px rgb(28 42 46 / 16%);
  --radius-lg: 22px;
  --radius-md: 14px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgb(255 255 255 / 70%), transparent 28rem),
    linear-gradient(135deg, #d8e1e1 0%, #e6eceb 46%, #d4dedf 100%);
  color: var(--ink);
  font-family: Aptos, "Avenir Next", "Trebuchet MS", sans-serif;
}

a {
  color: inherit;
}

html {
  scroll-behavior: smooth;
}

.shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  width: calc(100vw - 40px);
  min-height: calc(100vh - 40px);
  margin: 20px auto;
  border: 1px solid rgb(119 132 137 / 42%);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f2f5f4 0%, #edf1f1 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid #111c24;
  border-radius: 12px;
  background: #eaf3ff;
  font-weight: 800;
}

.brand h1,
.topbar h2,
.panel h3,
.empty-state h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.brand h1 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #7a8388;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.new-run,
.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.new-run {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  box-shadow: 0 4px 12px rgb(20 30 35 / 10%);
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-list a {
  padding: 12px 14px;
  border-radius: 11px;
  color: #576167;
  font-weight: 750;
  text-decoration: none;
}

.nav-list a.active,
.nav-list a:hover {
  background: #dfe5e6;
  color: var(--ink);
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 58%);
}

.sidebar-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.main {
  padding: 28px 30px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.topbar h2 {
  font-size: clamp(30px, 4vw, 46px);
}

.muted {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.ghost-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  padding: 0 18px;
}

.primary-button {
  border: 1px solid #12613f;
  background: linear-gradient(180deg, #238f5d, #157245);
  color: white;
  padding: 0 20px;
  box-shadow: 0 8px 20px rgb(21 114 69 / 24%);
}

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

.metric-card,
.panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 8px 28px rgb(25 35 40 / 6%);
}

.metric-card {
  min-height: 138px;
  padding: 22px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.metric-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.metric-value {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.metric-caption {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-grid.lower {
  align-items: start;
}

.span-2 {
  min-width: 0;
}

.panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h3 {
  font-size: 24px;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f0f3f3;
  color: #58636a;
  font-size: 12px;
  font-weight: 850;
}

.status-ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-warning,
.status-no_data {
  background: var(--amber-soft);
  color: #9d5f12;
}

.status-critical {
  background: var(--red-soft);
  color: var(--red);
}

.chart {
  position: relative;
  height: 360px;
  padding: 14px 8px 0;
}

.chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.grid-line {
  stroke: #dfe4e4;
  stroke-dasharray: 6 7;
}

.trend-line {
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-width: 4;
}

.trend-area {
  fill: url(#areaGradient);
}

.threshold-line {
  stroke: #b6bdbe;
  stroke-dasharray: 7 7;
  stroke-width: 2;
}

.point {
  fill: #fff;
  stroke: var(--teal);
  stroke-width: 3;
}

.point-hit {
  fill: transparent;
  cursor: crosshair;
}

.point-hit:hover + .point,
.point-hit:focus + .point {
  fill: var(--teal);
  stroke-width: 4;
}

.trend-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 210px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgb(255 255 255 / 95%);
  box-shadow: 0 16px 38px rgb(25 35 40 / 16%);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
}

.trend-tooltip strong {
  display: block;
  margin-bottom: 5px;
}

.trend-tooltip span {
  display: block;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.legend span::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

.donut-wrap {
  display: grid;
  place-items: center;
  padding: 26px 0 16px;
}

.donut {
  display: grid;
  width: 236px;
  height: 236px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, white 0 58%, transparent 59%),
    conic-gradient(var(--teal) calc(var(--value) * 1%), #edf0ef 0);
}

.donut span {
  margin-top: 48px;
  font-size: 42px;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.donut small {
  margin-top: -56px;
  color: var(--muted);
  font-weight: 750;
}

.breakdown {
  display: grid;
  gap: 9px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.breakdown-row strong {
  color: var(--ink);
}

.framework-table {
  display: grid;
  gap: 12px;
}

.framework-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 110px 110px 120px;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid #e2e6e6;
  border-radius: 16px;
  background: #fff;
}

.framework-title {
  font-weight: 900;
}

.framework-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ef;
}

.bar span {
  display: block;
  width: calc(var(--value) * 1%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f75bd, #2d8068);
}

.cell-label {
  color: var(--muted);
  font-size: 12px;
}

.cell-value {
  margin-top: 4px;
  font-weight: 900;
}

.alert-list {
  display: grid;
  gap: 12px;
}

.alert-card {
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e6e6;
}

.alert-card strong {
  display: block;
  margin-bottom: 6px;
}

.alert-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.run-history {
  margin-bottom: 10px;
}

.run-list {
  display: grid;
  gap: 10px;
}

.run-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 120px 1.8fr;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #e2e6e6;
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.run-item strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.empty-state {
  margin-bottom: 24px;
  padding: 26px;
}

.empty-state h3 {
  font-size: 26px;
}

pre {
  overflow: auto;
  padding: 16px;
  border-radius: 14px;
  background: #162126;
  color: #edf6ef;
  font-size: 13px;
}

.hidden {
  display: none;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100vw - 24px, 980px);
    min-height: calc(100vh - 24px);
    margin: 12px auto;
  }

  .sidebar {
    display: none;
  }

  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .framework-row,
  .run-item {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    padding-top: 0;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 20px 16px 32px;
  }

  .top-actions {
    display: grid;
  }

  .metric-grid {
    gap: 12px;
  }

  .framework-row,
  .run-item {
    display: grid;
    grid-template-columns: 1fr;
  }

  .chart {
    height: 260px;
  }
}
