:root {
  color-scheme: dark;
  --bg: #06100e;
  --surface: #0d211f;
  --surface-muted: #102a27;
  --surface-soft: #0a1a18;
  --text: #eef8f1;
  --muted: #9caea8;
  --line: #244640;
  --green: #55e278;
  --green-soft: #173d2e;
  --amber: #d7b56c;
  --red: #ff746f;
  --blue: #7fb5ff;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -10%, rgba(51, 226, 122, 0.13), transparent 34rem),
    radial-gradient(circle at 96% 8%, rgba(37, 92, 71, 0.25), transparent 28rem),
    linear-gradient(180deg, #050c0b 0%, var(--bg) 52%, #030806 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(16px, 4vw, 56px) 20px;
  border-bottom: 1px solid rgba(85, 226, 120, 0.16);
  background: rgba(4, 12, 10, 0.28);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.12rem;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subtitle {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.45;
}

.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.refresh-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  color: var(--green);
  background: rgba(85, 226, 120, 0.1);
  border: 1px solid rgba(85, 226, 120, 0.32);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.source,
.chart-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-ok {
  color: var(--green);
  background: rgba(85, 226, 120, 0.1);
  border-color: rgba(85, 226, 120, 0.34);
}

.status-warning {
  color: var(--amber);
  background: rgba(215, 181, 108, 0.12);
  border-color: rgba(215, 181, 108, 0.36);
}

.status-alert {
  color: var(--red);
  background: rgba(255, 116, 111, 0.12);
  border-color: rgba(255, 116, 111, 0.34);
}

.status-loading {
  color: var(--muted);
  background: var(--surface-muted);
  border-color: var(--line);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

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

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

.metric,
.panel {
  background: linear-gradient(180deg, rgba(16, 42, 39, 0.86), rgba(9, 25, 23, 0.92));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.metric {
  min-width: 0;
  min-height: 150px;
  overflow: hidden;
  padding: 18px;
}

.metric-wide {
  grid-column: span 2;
}

.metric span,
.integrity-grid span,
.patch-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 14px;
  max-width: 100%;
  font-size: clamp(1.7rem, 2.15vw, 2.35rem);
  line-height: 1.02;
  white-space: nowrap;
  color: var(--green);
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric .metric-full {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.metric .metric-full + small,
.metric small:not(.metric-full) {
  margin-top: 8px;
}

.panel {
  margin-top: 16px;
  padding: 20px;
}

.plain-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.45;
}

.plain-list li::marker {
  color: var(--green);
}

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

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

.integrity-grid div,
.patch-grid div {
  min-height: 96px;
  padding: 16px;
  background: rgba(7, 20, 18, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.integrity-grid strong {
  display: block;
  margin-top: 14px;
  font-size: 1.35rem;
  color: var(--green);
  overflow-wrap: anywhere;
}

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

.patch-grid strong {
  display: block;
  margin-top: 14px;
  font-size: 1.42rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.value-detail {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.patch-grid .highlight-tile {
  background: rgba(85, 226, 120, 0.11);
  border-color: rgba(85, 226, 120, 0.38);
}

.patch-grid .highlight-tile strong {
  color: var(--green);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 31px;
  left: 16.66%;
  right: 16.66%;
  height: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  min-width: 0;
  padding: 16px;
  background: rgba(7, 20, 18, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-item::before {
  content: "";
  display: block;
  width: 13px;
  height: 13px;
  margin-bottom: 14px;
  background: var(--green);
  border: 3px solid #0b1c19;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(85, 226, 120, 0.52), 0 0 18px rgba(85, 226, 120, 0.28);
}

.timeline-item:not(:last-child)::after {
  content: "->";
  position: absolute;
  top: 20px;
  right: -16px;
  z-index: 1;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.timeline-step,
.timeline-label {
  display: block;
}

.timeline-step {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-label {
  margin-top: 10px;
  color: var(--text);
  font-weight: 800;
}

.timeline-item strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  color: var(--green);
  line-height: 1;
}

.health-ok {
  color: var(--green);
}

.health-warning {
  color: var(--amber);
}

.health-alert {
  color: var(--red);
}

.section-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

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

.method-grid div {
  min-height: 142px;
  padding: 16px;
  background: rgba(7, 20, 18, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.method-grid h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 0.98rem;
}

.method-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 420px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 22, 20, 0.95) 0%, rgba(7, 18, 16, 0.98) 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

#orchard-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.axis-text {
  fill: #9caea8;
  font-size: 12px;
}

.grid-line {
  stroke: rgba(156, 174, 168, 0.15);
  stroke-width: 1;
}

.patch-marker-line {
  stroke: var(--amber);
  stroke-dasharray: 6 5;
  stroke-width: 2;
}

.patch-marker-text {
  fill: var(--amber);
  font-size: 13px;
  font-weight: 800;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: rgba(85, 226, 120, 0.2);
}

.share-line {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.transparent-line {
  stroke: #7fb5ff;
}

.orchard-line {
  stroke: var(--green);
}

.sapling-line {
  stroke: #d7b56c;
}

.transparent-dot {
  fill: #7fb5ff;
}

.orchard-dot {
  fill: var(--green);
}

.sapling-dot {
  fill: #d7b56c;
}

.details-panel dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.details-panel div {
  padding: 14px;
  background: rgba(7, 20, 18, 0.55);
  border-radius: 8px;
}

dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.site-footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.site-footer div {
  min-width: 0;
}

.site-footer span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.site-footer strong {
  display: block;
  margin-top: 6px;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .source {
    justify-content: flex-start;
    white-space: normal;
  }

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

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

  .metric-wide {
    grid-column: span 2;
  }

  .integrity-grid,
  .patch-grid,
  .timeline,
  .method-grid,
  .site-footer,
  .details-panel dl {
    grid-template-columns: 1fr;
  }

  .timeline::before,
  .timeline-item::after {
    display: none;
  }
}

@media (min-width: 901px) {
  .metric-wide strong {
    font-size: clamp(2rem, 2.8vw, 3rem);
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 1180px);
    margin-top: 12px;
  }

  .topbar {
    padding: 22px 12px 16px;
  }

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

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

  .metric-wide {
    grid-column: span 1;
  }

  .section-heading {
    flex-direction: column;
    gap: 10px;
  }

  .chart-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .chart-wrap {
    height: 320px;
  }
}
