/* SWAT Heatmap - reusable calendar heatmap */
.swat-heatmap {
  --shm-text: #e9f5f0;
  --shm-muted: #91aaa1;
  --shm-line: #1b3a31;
  --shm-empty: #0b1c17;
  --shm-empty-stroke: rgba(133, 242, 195, 0.05);
  --shm-l1: #123f31;
  --shm-l2: #1b6b50;
  --shm-l3: #2ea87c;
  --shm-l4: #85f2c3;
  --shm-accent: #85f2c3;
  --shm-tooltip-bg: #04100c;
  position: relative;
  color: var(--shm-text);
  font: inherit;
  min-width: 0;
}

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

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

.shm-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.shm-years {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shm-year {
  min-width: 52px;
  padding: 7px 12px;
  border: 1px solid var(--shm-line);
  border-radius: 7px;
  background: transparent;
  color: var(--shm-muted);
  font: 600 12px/1 Manrope, system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.shm-year:hover {
  color: var(--shm-text);
  border-color: #2f5a4d;
}

.shm-year.is-active {
  background: var(--shm-accent);
  border-color: transparent;
  color: #042017;
}

.shm-year:focus-visible {
  outline: 2px solid var(--shm-accent);
  outline-offset: 2px;
}

.shm-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 4px;
  scrollbar-color: #2a4c41 transparent;
}

.shm-scroll:focus-visible {
  outline: 2px solid var(--shm-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.shm-svg {
  display: block;
  max-width: none;
  overflow: visible;
}

.shm-month,
.shm-weekday {
  fill: var(--shm-muted);
  font: 400 10px/1 "DM Mono", ui-monospace, monospace;
  pointer-events: none;
  user-select: none;
}

.shm-day {
  fill: var(--shm-empty);
  stroke: var(--shm-empty-stroke);
  stroke-width: 1;
  transition: fill 0.12s ease, stroke 0.12s ease;
}

.shm-day.is-level-1 {
  fill: var(--shm-l1);
}

.shm-day.is-level-2 {
  fill: var(--shm-l2);
}

.shm-day.is-level-3 {
  fill: var(--shm-l3);
}

.shm-day.is-level-4 {
  fill: var(--shm-l4);
}

.shm-day.is-outside {
  fill: transparent;
  stroke: none;
}

.shm-day[data-key] {
  cursor: default;
}

.shm-day.is-clickable {
  cursor: pointer;
}

.shm-day:hover,
.shm-day:focus-visible {
  stroke: var(--shm-accent);
  stroke-width: 1.5;
  outline: none;
}

.shm-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-top: 10px;
  color: var(--shm-muted);
  font-size: 12px;
  line-height: 1.4;
}

.shm-meta {
  min-height: 17px;
}

.shm-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.shm-legend span:first-child {
  margin-right: 2px;
}

.shm-legend span:last-child {
  margin-left: 2px;
}

.shm-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--shm-empty);
  box-shadow: inset 0 0 0 1px var(--shm-empty-stroke);
}

.shm-swatch.is-level-1 {
  background: var(--shm-l1);
}

.shm-swatch.is-level-2 {
  background: var(--shm-l2);
}

.shm-swatch.is-level-3 {
  background: var(--shm-l3);
}

.shm-swatch.is-level-4 {
  background: var(--shm-l4);
}

.shm-tooltip {
  position: absolute;
  z-index: 40;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--shm-line);
  border-radius: 8px;
  background: var(--shm-tooltip-bg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  color: var(--shm-text);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.shm-tooltip.is-visible {
  opacity: 1;
}

.shm-tooltip strong {
  display: block;
  color: var(--shm-accent);
  font-size: 13px;
  font-weight: 700;
}

.shm-tooltip > span {
  display: block;
  color: var(--shm-muted);
}

.shm-tooltip-list {
  margin: 7px 0 0;
  padding: 7px 0 0;
  border-top: 1px solid var(--shm-line);
  list-style: none;
}

.shm-tooltip-list li {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--shm-text);
}

.shm-tooltip-list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shm-tooltip-list li em {
  flex: 0 0 auto;
  color: var(--shm-muted);
  font-style: normal;
}

@media (max-width: 620px) {
  .shm-head {
    align-items: flex-start;
  }

  .shm-title {
    font-size: 14px;
  }

  .shm-year {
    min-width: 44px;
    padding: 6px 9px;
  }

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

@media (prefers-reduced-motion: reduce) {
  .shm-day,
  .shm-tooltip,
  .shm-year {
    transition: none;
  }
}
