:root {
  --bg: #fbfcfb;
  --paper: #ffffff;
  --text: #111713;
  --muted: #68736b;
  --hairline: #e4ebe5;
  --accent: #176b37;
  --accent-2: #0f5130;
  --warn: #986d13;
  --cell-0: #edf1ec;
  --cell-1: #dbeedb;
  --cell-2: #aad9aa;
  --cell-3: #70bf78;
  --cell-4: #329852;
  --cell-5: #176b37;
  --fallback-0: #fff7df;
  --fallback-1: #f8e6b3;
  --fallback-2: #efcb72;
  --fallback-3: #d9a441;
  --fallback-4: #a97420;
  --fallback-5: #6f4714;
  --unknown-cell: #f1f3f1;
  --unknown-stripe: #c8d0ca;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

main {
  width: calc(100vw - 40px);
  max-width: 1180px;
  margin: 32px auto 48px;
}

header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 640;
}

h2 .material-symbols-outlined {
  margin-right: 6px;
  font-size: 18px;
  line-height: 0;
  vertical-align: -4px;
}

.app-error {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 16px 0;
  color: #9b1c1c;
}

.dek,
.updated,
.lead-note,
.axis-label,
.muted,
.tool-note,
.now-note,
.row-label span {
  color: var(--muted);
}

.dek {
  max-width: 820px;
  margin: 0;
}

.updated {
  margin-top: 5px;
  font-size: 13px;
}

.controls {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  border-radius: 8px;
}

.controls button {
  min-width: 64px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.controls button[aria-pressed="true"] {
  background: var(--text);
  color: #fff;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 6px;
}

.lead-note {
  margin: 0 0 10px;
  font-size: 13px;
}

.now-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 12px;
}

.now-measure {
  padding: 10px 0;
}

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

.now-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.now-note {
  font-size: 12px;
}

.burn-grid {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 8px;
  overflow-x: auto;
}

.row-label {
  min-height: 34px;
  border-top: 1px solid var(--hairline);
  padding-top: 7px;
  font-size: 12px;
}

.row-label strong,
.row-label span {
  display: block;
}

.weekly-label {
  min-height: 112px;
}

.trend-panel {
  width: var(--heatmap-width);
  min-width: var(--heatmap-width);
  border-top: 1px solid var(--hairline);
  padding-top: 8px;
}

.trend-panel svg {
  width: 100%;
  height: 78px;
  display: block;
}

.trend-panel path {
  fill: none;
  stroke: var(--hairline);
}

.trend-panel polyline {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.month-axis {
  display: grid;
  grid-template-columns: repeat(var(--week-count), 14px);
  gap: 5px;
  align-items: end;
  min-height: 28px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 520;
}

.month-axis span {
  text-align: center;
}

.day-matrix {
  display: grid;
  grid-template-columns: repeat(var(--week-count), 14px);
  grid-template-rows: repeat(7, 14px);
  width: var(--heatmap-width);
  min-width: var(--heatmap-width);
  gap: 5px;
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
  padding-bottom: 10px;
}

.day {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(17, 23, 19, 0.08);
  border-radius: 3px;
  padding: 0;
  background: var(--cell-0);
  cursor: default;
}

.day:not(.empty) {
  cursor: pointer;
}

.day:hover,
.day:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.day.today {
  box-shadow: inset 0 0 0 1px #fff, 0 0 0 1px var(--text);
}

.day.empty {
  opacity: 0.7;
}

.level-0 { background: var(--cell-0); }
.level-1 { background: var(--cell-1); }
.level-2 { background: var(--cell-2); }
.level-3 { background: var(--cell-3); }
.level-4 { background: var(--cell-4); }
.level-5 { background: var(--cell-5); }

.day.status-fallback.level-0 { background: var(--fallback-0); }
.day.status-fallback.level-1 { background: var(--fallback-1); }
.day.status-fallback.level-2 { background: var(--fallback-2); }
.day.status-fallback.level-3 { background: var(--fallback-3); }
.day.status-fallback.level-4 { background: var(--fallback-4); }
.day.status-fallback.level-5 { background: var(--fallback-5); }

.legend .status-fallback.level-3 {
  background: var(--fallback-3);
}

.day.status-unknown {
  border-color: #b9c4bd;
  background:
    repeating-linear-gradient(
      135deg,
      var(--unknown-cell) 0,
      var(--unknown-cell) 3px,
      var(--unknown-stripe) 3px,
      var(--unknown-stripe) 5px
    );
}

.legend .status-unknown {
  border-color: #b9c4bd;
  background:
    repeating-linear-gradient(
      135deg,
      var(--unknown-cell) 0,
      var(--unknown-cell) 3px,
      var(--unknown-stripe) 3px,
      var(--unknown-stripe) 5px
    );
}

.heatmap-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.legend {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
}

.legend i {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(17, 23, 19, 0.08);
  border-radius: 3px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.tooltip {
  position: fixed;
  z-index: 20;
  width: 310px;
  transform: translateY(-100%);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(17, 23, 19, 0.12);
  pointer-events: none;
}

.tooltip h3 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.2;
}

.tooltip-note {
  margin: -2px 0 10px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 620;
}

.tooltip dl {
  margin: 0;
}

.tooltip div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  color: var(--muted);
  font-size: 15px;
}

.tooltip dt,
.tooltip dd {
  margin: 0;
}

.tooltip dd {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.moving-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 34px;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}

.moving-card {
  min-height: 170px;
}

.moving-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.moving-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.moving-head span {
  color: var(--muted);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.moving-card svg {
  width: 100%;
  height: 110px;
  display: block;
  margin-top: 4px;
}

.spark-baseline {
  fill: none;
  stroke: var(--hairline);
  stroke-width: 1;
}

.spark-line {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spark-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.spark-hit:hover,
.spark-hit:focus {
  fill: var(--text);
}

.moving-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.metric-table,
.equivalent-table,
.breakdown-table,
.moment-table,
.recent-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}

.metric-table {
  margin-top: 28px;
}

th,
td {
  border-top: 1px solid var(--hairline);
  padding: 8px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

thead th {
  border-top: 0;
  color: var(--muted);
  font-weight: 520;
}

th:first-child,
td:first-child {
  text-align: left;
  padding-left: 0;
}

.breakdown-table {
  table-layout: fixed;
}

.breakdown-table th:first-child,
.breakdown-table td:first-child {
  width: 32%;
  white-space: normal;
}

.breakdown-table th:last-child,
.breakdown-table td:last-child,
.equivalent-table th:last-child,
.equivalent-table td:last-child,
.moment-table th:last-child,
.moment-table td:last-child {
  min-width: 280px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tool-name {
  font-weight: 640;
}

.tool-note {
  font-size: 12px;
}

.share-cell {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.share-track {
  position: relative;
  height: 18px;
  background: linear-gradient(to bottom, transparent 8px, var(--hairline) 8px, var(--hairline) 10px, transparent 10px);
}

.share-track i {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--accent);
}

.fidelity {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  text-transform: capitalize;
}

.fidelity.exact {
  border-color: rgba(23, 107, 55, 0.35);
  color: var(--accent);
}

.fidelity.estimated {
  border-color: rgba(152, 109, 19, 0.35);
  color: var(--warn);
}

.table-wrap {
  overflow-x: auto;
}

.recent-table {
  min-width: 980px;
}

@media (max-width: 760px) {
  main {
    width: calc(100vw - 24px);
    margin-top: 20px;
  }

  header,
  .section-head {
    grid-template-columns: 1fr;
  }

  header,
  .section-head {
    display: grid;
  }

  .controls {
    justify-self: stretch;
  }

  .controls button {
    min-width: 0;
  }

  .burn-grid {
    grid-template-columns: 96px minmax(0, 1fr);
    overflow-x: hidden;
  }

  .trend-panel,
  .day-matrix {
    width: 317px;
    min-width: 317px;
  }

  .day-matrix {
    grid-template-columns: repeat(var(--week-count), 5px);
    grid-template-rows: repeat(7, 6px);
    gap: 1px;
  }

  .day {
    width: 5px;
    height: 5px;
    border: 0;
    border-radius: 2px;
  }

  .month-axis {
    grid-template-columns: repeat(var(--week-count), 5px);
    gap: 1px;
    min-height: 22px;
    font-size: 12px;
  }

  .heatmap-footer {
    display: grid;
  }

  .tooltip {
    display: none;
  }

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