:root {
  --bg-1: #05040a;
  --bg-2: #12071f;
  --bg-3: #040b18;
  --glass: rgba(16, 18, 34, 0.62);
  --glass-strong: rgba(16, 18, 34, 0.82);
  --border: rgba(130, 150, 255, 0.18);
  --text: #e7e9ff;
  --muted: #a9b2d4;
  --neon: #35c6ff;
  --pass: #53d479;
  --fail: #ed1111;
  --skipped: #b3bdb9;
  --runtime: #f5be47;
}

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

body {
  margin: 0;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% 10%, #22113f 0%, transparent 60%),
    radial-gradient(900px 700px at 85% 15%, #0d2c44 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-2), var(--bg-1) 40%, var(--bg-3));
  min-height: 100vh;
}

.bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(53, 198, 255, 0.15), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(83, 212, 121, 0.12), transparent 55%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 6px);
  pointer-events: none;
  mix-blend-mode: screen;
}

.app {
  position: relative;
  padding: 28px 36px 40px;
  max-width: 1400px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.app.loaded {
  opacity: 1;
  transform: translateY(0);
}

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

.title-block h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.8px;
}

.title-block p {
  margin: 0 0 10px;
  color: var(--muted);
}

.meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

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

.btn {
  border: 1px solid var(--border);
  background: rgba(23, 27, 50, 0.7);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(53, 198, 255, 0.35);
}

.btn.glow {
  background: linear-gradient(120deg, rgba(53, 198, 255, 0.2), rgba(83, 212, 121, 0.2));
  border-color: rgba(53, 198, 255, 0.45);
}

.btn.ghost {
  background: transparent;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.4px;
  background: rgba(19, 22, 42, 0.8);
  text-transform: uppercase;
}

.chip.status.ok {
  color: var(--pass);
  border-color: rgba(83, 212, 121, 0.6);
}

.chip.status.bad {
  color: var(--fail);
  border-color: rgba(237, 17, 17, 0.6);
}

.chip.mode {
  color: var(--neon);
  border-color: rgba(53, 198, 255, 0.6);
}

.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 30px rgba(3, 5, 12, 0.65), 0 0 24px rgba(53, 198, 255, 0.08);
  backdrop-filter: blur(18px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

.left,
.right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-card {
  position: relative;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-item.pass i {
  background: var(--pass);
}

.legend-item.fail i {
  background: var(--fail);
}

.legend-item.skipped i {
  background: var(--skipped);
}

.legend-item.pending i {
  background: var(--runtime);
}

.chart-wrap {
  position: relative;
  display: grid;
  place-items: center;
  margin: 16px 0;
}

#donut {
  width: 240px;
  height: 240px;
}

.donut-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 20;
}

.donut-segment {
  fill: none;
  stroke-width: 20;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  filter: url(#glow);
  transition: stroke-width 0.2s ease, filter 0.2s ease;
}

.donut-segment.active,
.donut-segment:hover {
  stroke-width: 24;
  filter: drop-shadow(0 0 12px rgba(53, 198, 255, 0.7));
}

.chart-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.center-label {
  font-size: 13px;
  color: var(--muted);
}

.center-value {
  font-size: 30px;
  margin: 4px 0;
  font-weight: 600;
}

.center-value.pass {
  color: var(--pass);
}

.center-value.fail {
  color: var(--fail);
}

.center-value.skipped {
  color: var(--skipped);
}

.center-value.pending {
  color: var(--runtime);
}

.center-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.runtime-pill {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.pill-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.pill-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(245, 190, 71, 0.4), var(--runtime));
  box-shadow: 0 0 10px rgba(245, 190, 71, 0.6);
  transition: width 0.2s ease;
}

.pill-text {
  color: var(--runtime);
  font-weight: 600;
}

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

.metric {
  background: var(--glass-strong);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.metric-value {
  font-size: 24px;
  font-weight: 600;
}

.metric.pass .metric-value {
  color: var(--pass);
}

.metric.fail .metric-value {
  color: var(--fail);
}

.metric.skipped .metric-value {
  color: var(--skipped);
}

.metric.runtime .metric-value {
  color: var(--runtime);
}

.suite-card {
  min-height: 130px;
}

.suite-list {
  color: var(--muted);
  line-height: 1.4;
  font-size: 14px;
}

.sparkline {
  display: inline-flex;
  gap: 4px;
  align-items: flex-end;
}

.sparkline i {
  width: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(53, 198, 255, 0.8), rgba(53, 198, 255, 0.2));
}

.sparkline i:nth-child(1) {
  height: 10px;
}
.sparkline i:nth-child(2) {
  height: 18px;
}
.sparkline i:nth-child(3) {
  height: 14px;
}
.sparkline i:nth-child(4) {
  height: 22px;
}
.sparkline i:nth-child(5) {
  height: 16px;
}
.sparkline i:nth-child(6) {
  height: 12px;
}

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

.table-controls {
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 14px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(20, 24, 44, 0.6);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.pill.active {
  color: var(--text);
  border-color: rgba(53, 198, 255, 0.5);
  box-shadow: 0 0 12px rgba(53, 198, 255, 0.3);
}

.pill.pass {
  color: var(--pass);
}

.pill.fail {
  color: var(--fail);
}

.pill.skipped {
  color: var(--skipped);
}

.pill.pending {
  color: var(--runtime);
}

.search input,
.source-input input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 28, 0.8);
  color: var(--text);
}

.source-control label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: inline-block;
}

.source-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.source-upload {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.upload-label {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(16, 20, 38, 0.7);
  box-shadow: inset 0 0 12px rgba(53, 198, 255, 0.18);
  cursor: pointer;
}

.source-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-name {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(10, 12, 24, 0.7);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(53, 198, 255, 0.6), rgba(83, 212, 121, 0.4));
  border-radius: 999px;
  border: 2px solid rgba(10, 12, 24, 0.8);
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10, 12, 24, 0.95);
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.row-clickable {
  cursor: pointer;
}

.details-row td {
  padding: 16px 12px 18px;
  background: rgba(9, 12, 24, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-panel {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.detail-panel .error-text {
  max-width: none;
  -webkit-line-clamp: unset;
}

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

.detail-actions a {
  color: var(--neon);
  text-decoration: none;
}

.detail-actions a:hover {
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

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

.status-pass {
  color: var(--pass);
}

.status-fail {
  color: var(--fail);
}

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

.status-pending {
  color: var(--runtime);
}

.row-pass td,
.row-passed td {
  color: var(--text);
}

.row-fail td,
.row-failed td {
  color: var(--text);
}

.row-skipped td {
  color: var(--skipped);
}

.row-pending td {
  color: var(--runtime);
}

.title-cell {
  color: var(--text);
}

.row-pass .title-cell,
.row-passed .title-cell {
  color: var(--text);
}

.row-fail .title-cell,
.row-failed .title-cell {
  color: var(--text);
}

.row-skipped .title-cell {
  color: var(--skipped);
}

.row-pending .title-cell {
  color: var(--runtime);
}

.row-failed .tag,
.row-fail .tag {
  background: rgba(237, 17, 17, 0.15);
  border-color: rgba(237, 17, 17, 0.5);
  color: var(--fail);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(53, 198, 255, 0.18);
  color: var(--text);
  font-size: 11px;
  border: 1px solid rgba(53, 198, 255, 0.3);
}

.details {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.error-block {
  display: grid;
  gap: 6px;
}

.error-text {
  max-width: 360px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.error-block.expanded .error-text {
  -webkit-line-clamp: unset;
}

.toggle {
  color: var(--neon);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
}

.details a {
  color: var(--neon);
  text-decoration: none;
}

.details a:hover {
  text-decoration: underline;
}

.tooltip {
  position: fixed;
  padding: 8px 10px;
  background: rgba(10, 12, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  transform: translate(-50%, -100%);
  backdrop-filter: blur(8px);
}

.hidden {
  display: none;
}

.error {
  border-color: rgba(237, 17, 17, 0.5);
  background: rgba(35, 8, 10, 0.7);
}

.error-meta {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.hint {
  color: rgba(255, 255, 255, 0.75);
}

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

  .table-wrap {
    max-height: 480px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  #donut {
    width: 200px;
    height: 200px;
  }
}
