:root {
  --color-bg: #11161b;
  --color-header-bg: #26313c;
  --color-surface: #1a2128;
  --color-text: #d0d5db;
  --color-text-dim: #88929e;
  --color-text-muted: #6b7582;
  --color-heading: #e8ebef;
  --color-link: #0073d5;
  --color-stage-1: #003d6e;
  --color-stage-2: #005298;
  --color-stage-3: #0073d5;
  --color-stage-4: #4a9eff;
  --color-stage-withdrawn: #6b7280;
  --color-tests-merged: #1f8d4a;
  --color-tests-unmerged: #d4a017;
  --color-no-tests: #c0392b;
  --color-not-testable: #6b7582;

  --gradient-stage-0: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    var(--color-stage-1) 4px,
    var(--color-stage-1) 8px
  );
  --gradient-stage-2-7: repeating-linear-gradient(
    45deg,
    var(--color-stage-2),
    var(--color-stage-2) 4px,
    var(--color-stage-3) 4px,
    var(--color-stage-3) 8px
  );
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:has(> img:only-child) {
  text-decoration: none;
}

input[type="text"],
select {
  background: var(--color-surface);
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--color-text);
  padding: 8px 12px;
}

input[type="text"]::placeholder {
  color: var(--color-text-muted);
}

input[type="text"]:focus {
  outline: 2px solid var(--color-link);
}

input[type="checkbox"] {
  accent-color: var(--color-link);
}

select {
  cursor: pointer;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--color-header-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1rem;
  white-space: nowrap;
  color: var(--color-heading);
}

main {
  padding: 20px;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.hidden {
  display: none;
}

.build-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon,
.footer-icon {
  flex-shrink: 0;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
}

.filter-input {
  width: 380px;
  max-width: 100%;
}

.sort-label {
  font-size: 0.8rem;
  color: var(--color-text);
  white-space: nowrap;
}

.sort-label select {
  margin-left: 4px;
}

.stage-filter-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.8rem;
}

.stage-filter-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--color-text);
}

.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 30px;
  background: var(--color-surface);
  font-size: 0.8rem;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-number.stage-1 {
  color: var(--color-stage-1);
}

.stat-number.stage-2 {
  color: var(--color-stage-2);
}

.stat-number.stage-3 {
  color: var(--color-stage-3);
}

.stat-number.stage-4 {
  color: var(--color-stage-4);
}

.stat-number.stat-withdrawn {
  color: var(--color-stage-withdrawn);
}

.stat-number.stage-2-7 {
  background-image: var(--gradient-stage-2-7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-number.stat-missing-tests {
  background-image: repeating-linear-gradient(
    45deg,
    var(--color-no-tests),
    var(--color-no-tests) 4px,
    var(--color-tests-unmerged) 4px,
    var(--color-tests-unmerged) 8px
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.proposals {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.proposals tr td:first-child {
  width: 240px;
  padding: 4px 20px 4px 0;
  vertical-align: middle;
  font-size: 0.8rem;
  color: var(--color-heading);
  text-align: right;
}

.proposals tr td:first-child a {
  color: var(--color-heading);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proposals tr td:last-child {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.view-toggle {
  display: inline-flex;
}

.toggle-button {
  background: var(--color-surface);
  border: none;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
}

.toggle-button:first-child {
  border-radius: 4px 0 0 4px;
}

.toggle-button:last-child {
  border-radius: 0 4px 4px 0;
}

.toggle-button:hover {
  background: color-mix(in srgb, var(--color-link) 15%, transparent);
}

.toggle-button.active {
  background: var(--color-link);
  color: #fff;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  font-size: 0.8rem;
}

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

.legend-color {
  display: inline-block;
  width: 30px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.stages {
  background: linear-gradient(
    90deg,
    var(--color-stage-1) 25%,
    var(--color-stage-2) 25%,
    var(--color-stage-2) 50%,
    var(--color-stage-3) 50%,
    var(--color-stage-3) 75%,
    var(--color-stage-4) 75%
  );
}

.legend-color.no-tests {
  background: var(--color-no-tests);
}

.legend-color.tests-unmerged {
  background: var(--color-tests-unmerged);
}

.legend-color.tests-merged {
  background: var(--color-tests-merged);
}

.legend-color.not-testable {
  background: var(--color-not-testable);
}

.table-header {
  display: none;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-dim);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-surface);
  border-radius: 3px;
}

.timeline-bar {
  position: relative;
}

.timeline-bar:nth-child(1) {
  height: 20px;
}

.timeline-bar:nth-child(2) {
  height: 10px;
}

.timeline-bar > :first-child {
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.timeline-bar > :last-child {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

.timeline-segment {
  position: absolute;
  top: 0;
  height: 100%;
}

.timeline-segment.stage-0 {
  background: var(--gradient-stage-0);
}

.timeline-segment.stage-1 {
  background: var(--color-stage-1);
}

.timeline-segment.stage-2 {
  background: var(--color-stage-2);
}

.timeline-segment.stage-2-7 {
  background: var(--gradient-stage-2-7);
}

.timeline-segment.stage-3 {
  background: var(--color-stage-3);
}

.timeline-segment.stage-4 {
  width: 24px !important;
  background: var(--color-stage-4);
}

.timeline-segment.stage-4::after {
  content: "✓";
}

.timeline-segment.withdrawn {
  width: 24px !important;
  background: var(--color-stage-withdrawn);
}

.timeline-segment.withdrawn::after {
  content: "✕";
}

.timeline-segment.stage-4::after,
.timeline-segment.withdrawn::after {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  width: 100%;
  height: 100%;
}

.timeline-segment.no-tests {
  background: var(--color-no-tests);
}

.timeline-segment.tests-unmerged {
  background: var(--color-tests-unmerged);
}

.timeline-segment.relation {
  border: 1.5px dashed rgba(255, 255, 255, 0.5);
}

.timeline-segment.tests-merged {
  background: var(--color-tests-merged);
}

.timeline-segment.not-testable {
  background: var(--color-not-testable);
}

.detail-row {
  display: none;
}

.detail-field {
  flex: 1;
}

.detail-field a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-field .no-tests {
  color: var(--color-no-tests);
}

.detail-field .tests-unmerged {
  color: var(--color-tests-unmerged);
}

.detail-field .tests-merged {
  color: var(--color-tests-merged);
}

.duration-value {
  color: var(--color-text);
  font-size: 0.8rem;
}

.details-view .timeline,
.details-view .legend,
.details-view .axis {
  display: none;
}

.details-view .detail-row,
.details-view .table-header {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.75rem;
  align-items: center;
  width: 100%;
}

.details-view .table-header span {
  flex: 1;
}

.axis {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--color-bg);
}

.axis td {
  padding-bottom: 4px;
}

.axis-ticks {
  position: relative;
  height: 24px;
  width: 100%;
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

.axis-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
}

.axis-tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 5px;
  background: var(--color-text-dim);
  margin: 0 auto 2px;
}
