.dow-heatmaps {
  --dow-heat-border: #d4d6ca;
  --dow-heat-size: clamp(1.625rem, 2.1vw, 2.1rem);
  min-width: 0;
  container: dow-heatmap / inline-size;
}
.dow-heat-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: .75rem;
  align-items: end;
}
.dow-heat-controls label {
  display: grid;
  min-width: 0;
  gap: .25rem;
  color: var(--muted, #62655d);
  font-size: .875rem;
  font-weight: 700;
}
.dow-heat-controls :is(input, select),
.dow-heatmaps > button,
.dow-heat-date-nav button {
  min-height: 2.65rem;
  min-width: 0;
  max-width: 100%;
  padding: .37rem .55rem;
  border: 1px solid var(--dow-heat-border);
  border-radius: .3rem;
  background: #fff;
  color: var(--ink, #151715);
  font-size: .875rem;
  font-weight: 600;
}
.dow-heat-controls select {
  appearance: none;
  padding-right: 1.8rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%235b6f3a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .55rem center;
  text-overflow: ellipsis;
}
.dow-heat-date-nav {
  display: flex;
  gap: .35rem;
}
.dow-heat-date-nav button { flex: 1; }
.dow-heat-instructions,
.dow-heat-status {
  margin-block: .8rem .55rem;
  color: var(--muted, #62655d);
  font-size: .9rem;
}
.dow-heat-status:empty { display: none; }
.dow-heat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .95rem;
  margin: .55rem 0 .85rem;
  padding: 0;
  list-style: none;
  color: var(--muted, #62655d);
  font-size: .86rem;
}
.dow-heat-legend li {
  display: inline-flex;
  align-items: center;
  gap: .33rem;
}
.dow-heat-legend li span:last-child:not(:empty) { font-variant-numeric: tabular-nums; }
.dow-heat-legend .dow-heat-cell {
  width: 1.08rem;
  min-width: 1.08rem;
  height: 1.08rem;
  font-size: .8rem;
  cursor: default;
}
.dow-heat-gradient {
  width: 2.2rem;
  height: .76rem;
  border-radius: .18rem;
  background: linear-gradient(90deg, #dbe3cb 25%, #b2c28e 25%, #b2c28e 50%, #819957 50%, #819957 75%, #4f6732 75%);
}
.dow-heat-scroll {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: #a6ad97 #eeeeea;
  border: 1px solid var(--dow-heat-border);
  border-radius: .45rem;
  background: #fff;
}
.dow-heat-scroll[aria-busy="true"] { opacity: .68; }
.dow-heat-scroll table {
  width: max-content;
  min-width: 100%;
  padding: .45rem;
  border-collapse: separate;
  border-spacing: .2rem;
  table-layout: auto;
}
.dow-heat-scroll caption {
  position: sticky;
  left: 0;
  max-width: 100%;
  padding: .6rem .75rem 0;
  text-align: left;
  font-weight: 700;
}
.dow-heat-scroll th {
  min-width: 0;
  padding: .1rem .2rem;
  border: 0;
  color: var(--muted, #62655d);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}
.dow-heat-scroll th:first-child {
  position: sticky;
  z-index: 1;
  left: 0;
  width: max-content;
  padding-inline: .3rem;
  background: white;
  color: var(--ink, #151715);
  text-align: left;
  white-space: nowrap;
}
.dow-heat-scroll td {
  min-width: var(--dow-heat-size);
  padding: 0;
  border: 0;
}
.dow-heat-scroll table[data-view="annual"] {
  width: 100%;
  table-layout: fixed;
  border-spacing: .16rem;
}
.dow-heat-scroll [data-view="annual"] th { padding-inline: 0; }
.dow-heat-scroll [data-view="annual"] th:first-child {
  position: static;
  width: 3.15rem;
  padding-inline: .25rem;
}
.dow-heat-scroll [data-view="annual"] :is(td, button) { min-width: 0; }
.dow-heat-cell {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: var(--dow-heat-size);
  height: var(--dow-heat-size);
  padding: 0;
  border: 1px solid transparent;
  border-radius: .24rem;
  background: var(--dow-heat-fill, #dbe3cb);
  color: #20251b;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.dow-heat-cell[data-state="zero"] {
  border-color: #abb79b;
  background: #eef1e9;
}
.dow-heat-cell[data-state="partial"] {
  border-color: #827045;
  background: repeating-linear-gradient(135deg, transparent 0 3px, #765d311f 3px 6px), var(--dow-heat-fill, #eee3cb);
  color: #1c1c16;
}
.dow-heat-cell[data-state="partial"] span {
  display: grid;
  place-items: center;
  min-width: .9em;
  min-height: .9em;
  border-radius: .15em;
  background: #fffdf2;
}
.dow-heat-cell[data-state="unavailable"],
.dow-heat-cell[data-state="not-reporting"] {
  border-color: #d3d0c8;
  background: #eeece6;
  color: #4b4b44;
}
.dow-heat-cell[data-state="missing"] {
  border: 1px dashed #9a785c;
  background: #f5eae0;
  color: #5d3d25;
}
.dow-heat-cell[data-state="future"] {
  border: 1px dashed #aeb8c1;
  background: #f5f7f9;
  color: #384750;
}
.dow-heat-cell[data-state="clock-gap"] {
  border-color: #c2b2cf;
  background: #f0eaf6;
  color: #483458;
}
.dow-heat-cell[data-state="outside"] {
  border-color: #eeeee9;
  background: #fbfaf8;
}
.dow-heat-cell:is(:hover, [aria-pressed="true"]) { border-color: #27361d; }
.dow-heat-cell:focus-visible {
  outline: 2px solid #27361d;
  outline-offset: 1px;
}
.dow-heat-inspect {
  display: grid;
  gap: .15rem;
  margin-top: .65rem;
  padding: .65rem .8rem;
  border-left: .2rem solid var(--green, #5b6f3a);
  background: #f0f1ea;
  color: #383c31;
  font-size: .9rem;
}
.dow-heat-inspect:empty { display: none; }
@container dow-heatmap (max-width: 56rem) {
  .dow-heat-scroll table[data-view="annual"] {
    --dow-compact-days: 7;
    display: block;
    padding: .6rem;
  }
  .dow-heat-scroll [data-view="annual"] caption {
    display: block;
    padding: .15rem .15rem .65rem;
  }
  .dow-heat-scroll [data-view="annual"] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .dow-heat-scroll [data-view="annual"] tbody {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: .65rem;
  }
  .dow-heat-scroll [data-view="annual"] tbody tr {
    display: grid;
    grid-template-columns: repeat(var(--dow-compact-days), minmax(0, 1fr));
    align-content: start;
    gap: .2rem;
    padding: .35rem;
    border: 1px solid var(--dow-heat-border);
    border-radius: .3rem;
  }
  .dow-heat-scroll [data-view="annual"] tbody th:first-child {
    grid-column: 1 / -1;
    padding-block: .25rem;
  }
  .dow-heat-scroll [data-view="annual"] .dow-heat-empty { display: none; }
  .dow-heat-scroll [data-view="annual"] .dow-heat-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .12rem;
    height: 2.25rem;
    font-size: .75rem;
  }
  .dow-heat-scroll [data-view="annual"] .dow-heat-cell::before {
    content: attr(data-day);
    font-size: .82rem;
  }
  .dow-heat-scroll [data-view="annual"] .dow-heat-cell[data-band="3"]::before { color: #fff; }
  .dow-heat-scroll [data-view="annual"] .dow-heat-cell span:empty { display: none; }
}
@media (max-width: 560px) {
  .dow-heatmaps { --dow-heat-size: 1.75rem; }
  .dow-heat-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dow-heat-controls label { font-size: .83rem; }
}
@media (forced-colors: active) {
  .dow-heat-cell { border-color: ButtonText; }
  .dow-heat-cell[aria-pressed="true"] { border-color: Highlight; }
}
@media(max-width:520px) {
  .dow-heat-controls > label:nth-child(3) { grid-column:1/-1; }
}
