:root {
  --bg: #f5f8f4;
  --bg-strong: #e8f1e3;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --border: rgba(33, 63, 38, 0.12);
  --text: #17301b;
  --muted: #5f7362;
  --green: #1e7b34;
  --green-dark: #125324;
  --green-soft: rgba(30, 123, 52, 0.12);
  --success: #0f8a49;
  --warning: #bc7a00;
  --danger: #c53d2f;
  --shadow: 0 18px 40px rgba(20, 52, 27, 0.08);
  --font-scale: 0.9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(30, 123, 52, 0.16), transparent 32%),
    linear-gradient(180deg, #f0f6eb 0%, #f7faf5 100%);
  color: var(--text);
  font-family: "Montserrat", "Avenir Next", "Segoe UI", sans-serif;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 123, 52, 0.55) rgba(18, 83, 36, 0.18);
  font-size: calc(16px * var(--font-scale));
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
  background: rgba(18, 83, 36, 0.12);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(95, 166, 70, 0.9), rgba(30, 123, 52, 0.92));
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(118, 209, 137, 0.96), rgba(30, 123, 52, 1));
}

button,
input,
summary {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  background: rgba(17, 44, 22, 0.94);
  color: #eff8ee;
}

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

.brand-logo {
  width: 72px;
  height: auto;
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(239, 248, 238, 0.72);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
}

.overview-button,
.run-link {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-align: left;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.overview-button {
  padding: 12px 14px;
  font-weight: 700;
  margin-bottom: 18px;
}

.overview-button:hover,
.run-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.overview-button.active,
.run-link.active {
  background: rgba(118, 209, 137, 0.16);
  border-color: rgba(118, 209, 137, 0.45);
}

.sidebar-meta {
  margin-bottom: 14px;
  color: rgba(239, 248, 238, 0.72);
  font-size: 11px;
}

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

.run-item {
  position: relative;
}

.run-link {
  padding: 12px 48px 10px 12px;
}

.run-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(239, 248, 238, 0.78);
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.run-delete:hover {
  background: rgba(197, 61, 47, 0.18);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.run-delete svg {
  width: 16px;
  height: 16px;
}

.run-link-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.run-link-title {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.35;
}

.run-link-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(239, 248, 238, 0.72);
  font-size: 10px;
}

.content {
  padding: 28px;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.05;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 900px;
  font-size: 12px;
}

.meta-line,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.chip {
  padding: 6px 10px;
  font-size: 11px;
}

.status-pill {
  padding: 4px 9px;
  font-size: 10px;
  text-transform: capitalize;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status-passed {
  color: var(--success);
}

.status-failed,
.status-timedout,
.status-interrupted {
  color: var(--danger);
}

.status-flaky {
  color: var(--warning);
}

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

.metrics-grid,
.panel-grid,
.three-up,
.browser-grid,
.type-grid,
.insight-grid {
  display: grid;
  gap: 18px;
}

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

.panel-grid {
  grid-template-columns: 1.45fr 1fr;
  margin-bottom: 24px;
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
}

.browser-grid,
.type-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.insight-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
}

.panel,
.metric-card,
.list-card,
.test-card,
.empty-state {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.metric-card,
.list-card,
.empty-state {
  padding: 18px;
}

.metric-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.metric-support {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.panel-title,
.list-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.panel-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.chart-frame {
  width: 100%;
  overflow: auto hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 123, 52, 0.04), transparent);
  border: 1px solid rgba(30, 123, 52, 0.08);
  padding: 14px;
}

.chart-frame svg {
  width: 100%;
  min-height: 260px;
  overflow: visible;
}

.chart-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.donut {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
  background: var(--donut-background);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  background: var(--surface-strong);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(23, 48, 27, 0.05);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 1;
}

.donut-value {
  font-size: 28px;
  font-weight: 800;
}

.donut-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-list,
.insight-list,
.attempt-list,
.attachment-list,
.step-list {
  display: grid;
  gap: 10px;
}

.stat-row,
.insight-item,
.attachment-item,
.attempt-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  padding: 14px 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-row strong {
  font-size: 13px;
}

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

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 100px;
  gap: 14px;
  align-items: center;
}

.bar-label {
  font-weight: 700;
  font-size: 12px;
}

.bar-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(30, 123, 52, 0.08);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #67b54f);
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.list-card ul,
.panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.insight-item-title {
  margin: 0 0 5px;
  font-weight: 800;
}

.insight-item-support {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.run-section-title {
  margin: 32px 0 14px;
  font-size: 18px;
}

.test-card {
  overflow: hidden;
  margin-bottom: 14px;
}

.test-card summary {
  list-style: none;
  padding: 18px 22px;
  cursor: pointer;
}

.test-card summary::-webkit-details-marker {
  display: none;
}

.test-card summary:hover {
  background: rgba(30, 123, 52, 0.05);
}

.test-card[open] summary {
  background: rgba(30, 123, 52, 0.08);
}

.test-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.test-title {
  margin: 0;
  font-size: 14px;
}

.test-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.test-card-body {
  padding: 0 22px 22px;
}

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

.failure-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 42%);
  gap: 16px;
  margin-bottom: 18px;
}

.failure-column {
  min-width: 0;
}

.detail-cell {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(30, 123, 52, 0.05);
}

.detail-cell-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.error-block,
.log-block,
.attachment-block {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #17241a;
  color: #f5f8f4;
  overflow: auto;
}

.error-block {
  background: #311714;
  margin-top: 0;
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.failure-shot-card,
.attachment-preview {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.failure-shot-label {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.failure-shot-image,
.attachment-preview img {
  display: block;
  width: 100%;
  height: auto;
  background: #f4f4f4;
}

.attachment-preview {
  margin-top: 12px;
}

.empty-state-inline {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.attempt-card h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.step-list {
  margin-top: 12px;
}

.step-item {
  border-left: 3px solid rgba(30, 123, 52, 0.18);
  padding-left: 12px;
  margin-left: calc(var(--step-level, 0) * 14px);
}

.step-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.step-title {
  font-weight: 700;
  font-size: 12px;
}

.empty-state {
  text-align: center;
  padding: 52px 24px;
}

@media (min-width: 2200px) {
  :root {
    --font-scale: 0.82;
  }

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

  .content {
    padding: 24px;
  }
}

@media (max-width: 1200px) {
  .metrics-grid,
  .detail-grid,
  .three-up,
  .insight-grid,
  .failure-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .content {
    padding: 22px;
  }

  .metrics-grid,
  .detail-grid,
  .three-up,
  .insight-grid,
  .failure-split {
    grid-template-columns: 1fr;
  }

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

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