.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.metric {
  --metric-color: var(--brand);
  --metric-soft: #e7f1ef;
  position: relative;
  min-height: 84px;
  overflow: hidden;
  background: linear-gradient(120deg, var(--metric-soft) -90%, #fff 58%);
  border: 1px solid #d9dfda;
  border-radius: 10px;
  padding: 0.9rem 1rem 0.85rem 1.1rem;
  box-shadow: 0 2px 7px rgba(27, 39, 36, 0.07);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color);
}

.metric-copy {
  min-width: 0;
}

.metric strong {
  display: block;
  color: #172a2d;
  font-size: 1.72rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric small {
  display: block;
  margin-top: 0.15rem;
  color: var(--metric-color);
  font-size: 0.72rem;
  font-weight: 750;
}

.metric--teal { --metric-color: #27756d; --metric-soft: #e3f1ee; }
.metric--blue { --metric-color: #3d6f9d; --metric-soft: #e7eff7; }
.metric--red { --metric-color: #b34a3e; --metric-soft: #f8e9e6; }
.metric--green { --metric-color: #3d7b50; --metric-soft: #e6f1e8; }
.metric--amber { --metric-color: #a66a22; --metric-soft: #f8eedf; }
.metric--violet { --metric-color: #6d6194; --metric-soft: #eeebf6; }
.metric--date { --metric-color: #315f59; --metric-soft: #e3efed; }

.metric--date strong {
  padding-top: 0.17rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.trend-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.15rem 0 0.85rem;
}

.trend-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.trend-heading span {
  color: var(--brand-strong);
  background: #e8f0ed;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

.trend-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.trend-zone-focus {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
}

.trend-zone-focus-title {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.trend-zone-focus-dropdown {
  position: relative;
  min-width: 0;
}

.trend-zone-focus-dropdown > summary {
  display: flex;
  min-height: 2.45rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0.52rem 0.58rem;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 400;
  list-style: none;
}

.trend-zone-focus-dropdown > summary::-webkit-details-marker {
  display: none;
}

.trend-zone-focus-dropdown > summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-0.12rem);
}

.trend-zone-focus-dropdown[open] > summary {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(35, 97, 91, 0.11);
}

.trend-zone-focus-dropdown[open] > summary::after {
  transform: rotate(225deg) translate(-0.1rem, -0.1rem);
}

.trend-zone-focus-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.3rem);
  left: 0;
  display: grid;
  width: max-content;
  min-width: 100%;
  max-width: min(300px, 80vw);
  max-height: 17rem;
  gap: 0.15rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 0.4rem;
}

.trend-zone-focus-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 5px;
  padding: 0.42rem 0.5rem;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.trend-zone-focus-option:hover,
.trend-zone-focus-option:has(input:focus-visible) {
  background: #eef4f1;
}

.trend-zone-focus-option.is-all {
  margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--line);
  border-radius: 5px 5px 0 0;
  padding-bottom: 0.55rem;
  font-weight: 700;
}

.trend-zone-focus-option input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--brand);
}

.trend-range-options {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.trend-range-options label {
  width: min(220px, 100%);
}

.trend-metrics {
  margin-top: 0;
}

.zone-performance-panel {
  margin-bottom: 0.75rem;
}

.site-comparison-panel {
  margin-bottom: 0.75rem;
}

.site-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.75rem;
}

.site-comparison-chart-block {
  margin-bottom: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid #d9dfda;
  border-radius: 9px;
  background: #f8fbfa;
}

.site-comparison-chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.site-comparison-chart-heading h3 {
  margin: 0;
  color: #263b37;
  font-size: 0.93rem;
}

.site-comparison-chart-heading p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.site-comparison-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.site-comparison-legend span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.site-comparison-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.site-comparison-chart {
  display: grid;
  gap: 0.5rem;
}

.site-chart-row {
  display: grid;
  grid-template-columns: minmax(90px, 132px) minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
}

.site-chart-row-button {
  width: 100%;
  padding: 0.46rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.site-chart-row-button:hover,
.site-chart-row-button:focus-visible {
  border-color: #b9d5cc;
  background: #edf6f2;
  box-shadow: 0 0 0 2px rgba(35, 97, 91, 0.08);
}

.site-chart-row > strong {
  overflow: hidden;
  color: #31433f;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-chart-data {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(145px, auto) minmax(110px, auto);
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.site-chart-counts {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.site-chart-latest {
  display: grid;
  gap: 0.08rem;
  min-width: 110px;
  text-align: right;
}

.site-chart-latest small {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-chart-latest strong {
  color: var(--brand-strong);
  font-size: 0.74rem;
  white-space: nowrap;
}

.site-chart-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

.site-chart-stack {
  display: flex;
  height: 100%;
  min-width: 2px;
  overflow: hidden;
  border-radius: inherit;
}

.site-chart-pass { background: #4d8b68; }
.site-chart-oos { background: #bd574a; }

.site-comparison-card {
  --pass-rate-color: #37786d;
  --pass-rate-start: #70a46e;
  min-width: 0;
  padding: 1rem;
  border: 1px solid #d9dfda;
  border-radius: 9px;
  background: linear-gradient(145deg, #f8fbfa, #fff);
}

.site-comparison-heading,
.site-comparison-stats {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.site-comparison-heading > div:first-child,
.site-pass-rate {
  display: grid;
}

.site-comparison-heading > div:first-child > strong {
  color: #263b37;
  font-size: 1.05rem;
}

.site-comparison-heading span,
.site-comparison-stats span,
.site-comparison-stats small {
  color: var(--muted);
  font-size: 0.76rem;
}

.site-pass-rate {
  text-align: right;
}

.site-pass-rate strong {
  color: var(--pass-rate-color);
  font-size: 1.35rem;
}

.site-rate-track {
  height: 7px;
  margin: 0.7rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

.site-rate-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pass-rate-start), var(--pass-rate-color));
}

.site-comparison-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.site-comparison-stats > div {
  display: grid;
  gap: 0.12rem;
  padding: 0.65rem 0.7rem;
  border-radius: 7px;
  background: #f2f6f3;
}

.site-comparison-stats strong {
  color: #283d39;
  font-size: 0.82rem;
}

.site-comparison-stats small {
  font-weight: 700;
}

.site-comparison-stats small.site-stat-alert {
  color: #a72f24;
}

.site-comparison-stats small.site-stat-clear {
  color: #287443;
}

.dashboard-calendar-panel {
  margin-bottom: 0.75rem;
  overflow: hidden;
  padding: 0.85rem;
}

.dashboard-calendar-header {
  align-items: center;
}

.dashboard-calendar-header > div:first-child {
  display: grid;
  gap: 0.15rem;
}

.dashboard-calendar-header > div:first-child span {
  color: var(--muted);
  font-size: 0.78rem;
}

.panel-title > .dashboard-calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.dashboard-calendar-controls strong {
  min-width: 132px;
  color: var(--brand-strong);
  text-align: center;
}

.dashboard-calendar-controls button {
  width: auto;
  min-height: 32px;
  padding: 0.35rem 0.65rem;
}

.dashboard-calendar-month-picker {
  width: auto;
}

.dashboard-calendar-month-picker input {
  width: 138px;
  min-height: 32px;
  padding: 0.34rem 0.5rem;
  border-color: #cbd8d1;
  background: #fff;
  font-size: 0.76rem;
}

.dashboard-calendar-controls .dashboard-calendar-nav {
  display: grid;
  width: 32px;
  min-width: 32px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  font-size: 1.2rem;
}

.dashboard-calendar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.55rem 0;
}

.dashboard-calendar-summary span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
}

.dashboard-calendar-summary b {
  font-size: 0.82rem;
}

.calendar-summary-swab {
  border-color: #b9dbd0 !important;
  background: #e9f5f1 !important;
  color: #226854 !important;
}

.calendar-summary-oos,
.calendar-summary-overdue {
  border-color: #efc0bc !important;
  background: #fff0ee !important;
  color: #a4342d !important;
}

.calendar-summary-action {
  border-color: #efd8aa !important;
  background: #fff5df !important;
  color: #8a5a10 !important;
}

.calendar-summary-scheduled {
  border-color: #c8daed !important;
  background: #edf4fb !important;
  color: #2d5f91 !important;
}

.dashboard-calendar-scroll {
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.dashboard-calendar-weekdays,
.dashboard-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  min-width: 672px;
}

.dashboard-calendar-weekdays {
  gap: 0.28rem;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.dashboard-calendar-days {
  gap: 0.28rem;
}

.dashboard-calendar-day {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: 0.38rem;
  overflow: hidden;
  border: 1px solid #dce4df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.dashboard-calendar-day:not(:disabled) {
  cursor: pointer;
}

.dashboard-calendar-day:not(:disabled):hover {
  border-color: #7fa89b;
  transform: translateY(-1px);
}

.dashboard-calendar-day:not(:disabled):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.dashboard-calendar-day:disabled {
  cursor: default;
}

.dashboard-calendar-day.outside-month {
  background: #f8faf8;
  opacity: 0.58;
}

.dashboard-calendar-day.today {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.dashboard-calendar-day.has-swabs {
  box-shadow: inset 0 3px 0 #3d8b73;
}

.dashboard-calendar-day.has-schedule {
  box-shadow: inset 0 3px 0 #4b7fad;
}

.dashboard-calendar-day.has-action {
  box-shadow: inset 0 3px 0 #c88720;
}

.dashboard-calendar-day.has-alert {
  border-color: #e4aaa5;
  background: linear-gradient(155deg, #fff5f3, #fff 58%);
  box-shadow: inset 0 3px 0 #bd4940;
}

.dashboard-calendar-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
}

.dashboard-calendar-day-heading strong {
  color: #31433f;
  font-size: 0.88rem;
}

.dashboard-calendar-day.today .dashboard-calendar-day-heading strong {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.dashboard-calendar-day-heading span {
  color: var(--brand-strong);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-calendar-events {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.dashboard-calendar-event {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.18rem 0.3rem;
  overflow: hidden;
  border-radius: 5px;
  font-size: 0.62rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-calendar-event b {
  font-size: 0.67rem;
}

.calendar-event-swab {
  background: #e5f3ee;
  color: #226854;
}

.calendar-event-oos,
.calendar-event-overdue {
  background: #fbe4e2;
  color: #a42f2a;
  font-weight: 750;
}

.calendar-event-action {
  background: #fff0d0;
  color: #8a5a10;
}

.calendar-event-scheduled {
  background: #e6f0fa;
  color: #2d5f91;
}

.dashboard-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e4eae6;
}

.dashboard-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.dashboard-calendar-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.calendar-legend-swab i { background: #3d8b73; }
.calendar-legend-oos i,
.calendar-legend-overdue i { background: #bd4940; }
.calendar-legend-action i { background: #c88720; }
.calendar-legend-scheduled i { background: #4b7fad; }

.dashboard-day-dialog {
  width: min(920px, calc(100vw - 2rem));
}

.dashboard-day-dialog-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.dashboard-day-dialog-summary span,
.dashboard-day-dialog-summary button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
}

.dashboard-oos-filter {
  width: auto;
  min-height: 30px;
  cursor: pointer;
  font-weight: 500;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.dashboard-oos-filter:hover,
.dashboard-oos-filter:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 2px 7px rgba(22, 69, 64, 0.14);
}

.dashboard-oos-filter.active {
  box-shadow: 0 0 0 2px var(--brand);
}

.dashboard-oos-month-controls,
.dashboard-oos-status-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.dashboard-oos-month-controls {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e1e8e4;
}

.dashboard-oos-month-controls > span {
  margin-right: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-oos-month-controls strong {
  min-width: 112px;
  color: var(--brand-strong);
  font-size: 0.78rem;
  text-align: center;
}

.dashboard-oos-month-controls button {
  width: auto;
  min-height: 30px;
  padding: 0.3rem 0.6rem;
}

.dashboard-oos-month-controls .dashboard-oos-month-nav {
  display: grid;
  width: 30px;
  min-width: 30px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  font-size: 1.1rem;
}

.dashboard-oos-month-picker {
  width: auto;
}

.dashboard-oos-month-picker input {
  width: 138px;
  min-height: 30px;
  padding: 0.3rem 0.5rem;
  border-color: #cbd8d1;
  background: #fff;
  font-size: 0.76rem;
}

.dashboard-oos-all-dates.active {
  border-color: var(--brand);
  background: #e7f2ed !important;
  color: var(--brand-strong) !important;
  box-shadow: 0 0 0 1px var(--brand);
}

.dashboard-day-dialog-body {
  display: grid;
  gap: 0.75rem;
  max-height: min(64vh, 620px);
  overflow-y: auto;
  padding-right: 0.2rem;
}

.dashboard-day-site-group {
  display: grid;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid #dce5e0;
  border-radius: 9px;
  background: #fafcfa;
}

.dashboard-day-site-heading,
.dashboard-day-detail-section-title,
.dashboard-day-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.dashboard-day-site-heading {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #e1e8e4;
}

.dashboard-day-site-heading h3,
.dashboard-day-detail-section-title h3 {
  margin: 0;
}

.dashboard-day-site-heading h3 {
  color: var(--brand-strong);
  font-size: 1rem;
}

.dashboard-day-site-heading > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.dashboard-day-detail-section {
  display: grid;
  gap: 0.45rem;
}

.dashboard-day-detail-section-title h3 {
  color: #344640;
  font-size: 0.86rem;
}

.dashboard-day-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.45rem;
}

.dashboard-day-detail-item {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.6rem 0.65rem;
  border: 1px solid #d8e4df;
  border-left: 3px solid #3d8b73;
  border-radius: 7px;
  background: #fff;
}

.dashboard-day-detail-item.detail-alert {
  border-color: #efc4c0;
  border-left-color: #bd4940;
  background: #fff8f7;
}

.dashboard-day-detail-item.detail-action {
  border-left-color: #c88720;
}

.dashboard-day-detail-item.detail-scheduled {
  border-left-color: #4b7fad;
}

.dashboard-day-detail-heading strong {
  overflow-wrap: anywhere;
  color: #243934;
  font-size: 0.84rem;
}

.dashboard-oos-status-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}

.dashboard-day-detail-item > span {
  color: var(--muted);
  font-size: 0.74rem;
}

.dashboard-day-detail-item > small {
  color: #566963;
  font-size: 0.68rem;
  line-height: 1.35;
}

.dashboard-day-detail-item.detail-alert > small {
  color: #a4342d;
  font-weight: 700;
}

.dashboard-detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0.15rem 0.42rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-detail-badge-clear {
  background: #e3f3e8;
  color: #25623a;
}

.dashboard-detail-badge-alert {
  background: #fbe4e2;
  color: #a42f2a;
}

.dashboard-detail-badge-action {
  background: #fff0d0;
  color: #8a5a10;
}

.dashboard-detail-badge-scheduled {
  background: #e6f0fa;
  color: #2d5f91;
}

.dashboard-day-loading,
.dashboard-day-empty {
  padding: 1.2rem;
  border: 1px dashed #cbd8d1;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.zone-pass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.zone-rate-card {
  --pass-rate-color: #3e8571;
  --pass-rate-start: #72a874;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid #d9dfda;
  border-radius: 9px;
  background: linear-gradient(145deg, #f7fbf8, #fff);
}

.zone-rate-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
}

.zone-rate-heading span {
  overflow: hidden;
  color: #31433f;
  font-size: 0.88rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-rate-heading strong {
  color: var(--pass-rate-color);
  font-size: 1.32rem;
  letter-spacing: -0.02em;
}

.zone-rate-track {
  height: 8px;
  margin: 0.7rem 0 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

.zone-rate-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pass-rate-start), var(--pass-rate-color));
}

.zone-rate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.zone-rate-card--empty {
  background: #fafbfa;
}

.zone-rate-card--empty .zone-rate-heading strong {
  color: #89938f;
}

.trend-chart-grid {
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
}

.trend-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

canvas {
  width: 100%;
  max-width: 100%;
  height: 260px;
}

.chart-tooltip {
  position: fixed;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  min-width: 150px;
  max-width: 220px;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: 7px;
  background: rgba(36, 48, 47, 0.96);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(20, 35, 32, 0.2);
  transform: translateY(5px) scale(0.98);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
}

.chart-tooltip.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

canvas.chart-interactive {
  cursor: pointer;
}

.chart-hover-highlight {
  position: fixed;
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  border: 1px solid rgba(180, 35, 24, 0.18);
  border-radius: 7px;
  background: rgba(180, 35, 24, 0.045);
  pointer-events: none;
  transform: translateY(2px) scale(0.985);
  box-shadow: 0 5px 16px rgba(36, 48, 47, 0.08);
  transition:
    left 90ms ease,
    top 90ms ease,
    width 90ms ease,
    height 90ms ease,
    opacity 120ms ease,
    transform 120ms ease,
    visibility 120ms;
}

.chart-hover-highlight.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

#trendDetailChart,
#trendBreakdownChart {
  height: 320px;
}

.trend-heatmap {
  overflow: auto;
  max-height: 560px;
}

.heatmap-limit-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.heatmap-limit-control select {
  width: auto;
  min-width: 76px;
  padding: 0.45rem 1.8rem 0.45rem 0.65rem;
}

.heatmap-limit-control input {
  width: 68px;
  padding: 0.45rem 0.55rem;
}

.heatmap-grid {
  display: grid;
  gap: 2px;
  min-width: max-content;
}

.heatmap-corner,
.heatmap-header,
.heatmap-row-label,
.heatmap-cell {
  min-height: 32px;
  border-radius: 5px;
}

.heatmap-header {
  display: grid;
  place-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.heatmap-row-label {
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 0;
  overflow: hidden;
  padding: 0 0.55rem;
  background: #eef2ed;
  color: #42504c;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heatmap-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  background: #fff;
}

.heatmap-cell {
  display: grid;
  place-items: center;
  border: 1px solid rgba(36, 48, 47, 0.05);
  font-size: 0.78rem;
  font-weight: 750;
}

.risk-item strong {
  overflow-wrap: anywhere;
}

.area-details-table {
  min-width: 980px;
}

.oos-count {
  color: var(--danger);
}

.area-rate {
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-width: 132px;
}

.area-rate-track {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #f2dfdb;
}

.area-rate-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
}

.test-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 180px;
}

.test-mix-chip {
  border-radius: 999px;
  background: #fff1d7;
  color: #7f4a08;
  padding: 0.14rem 0.42rem;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.trend-zone-test-matrix {
  min-width: 0;
}

.trend-zone-test-scroll {
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  max-height: 560px;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
}

.trend-zone-test-table {
  width: 100%;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
}

.trend-zone-test-table th,
.trend-zone-test-table td {
  min-width: 82px;
  padding: 0.55rem 0.65rem;
  border-right: 1px solid #edf1ee;
  border-bottom: 1px solid #e5ebe7;
  text-align: center;
  white-space: nowrap;
}

.trend-zone-test-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f5f8f6;
  color: #42504c;
  font-size: 0.73rem;
}

.trend-zone-test-table thead th > span,
.trend-zone-test-table thead th > small {
  display: block;
}

.trend-zone-test-table thead th > small {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 600;
}

.trend-zone-test-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 110px;
  text-align: left;
}

.trend-zone-test-table thead th:first-child {
  z-index: 4;
}

.trend-zone-test-table tbody th {
  background: #fff;
  color: var(--brand-strong);
  font-size: 0.8rem;
}

.trend-zone-test-table.site-comparison thead th:first-child,
.trend-zone-test-table.site-comparison .site-zone-site-cell {
  min-width: 140px;
}

.trend-zone-test-table.site-comparison thead th:nth-child(2),
.trend-zone-test-table.site-comparison tbody .site-zone-zone-cell {
  position: sticky;
  left: 140px;
  z-index: 2;
  min-width: 105px;
  background: #fff;
  text-align: left;
}

.trend-zone-test-table.site-comparison thead th:nth-child(2) {
  z-index: 4;
  background: #f5f8f6;
}

.site-zone-site-cell {
  vertical-align: top;
  background: #f7faf8 !important;
  font-weight: 800;
}

.site-zone-group-start > * {
  border-top: 2px solid #ccd9d2;
}

.site-zone-subtotal th,
.site-zone-subtotal td {
  background: #f0f6f2 !important;
  color: #31433f;
  font-weight: 750;
}

.trend-zone-test-table tfoot th,
.trend-zone-test-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-bottom: 0;
  background: #edf4f0;
  color: #31433f;
}

.trend-zone-test-table tfoot th:first-child {
  z-index: 4;
  background: #e7f0eb;
}

.zone-test-summary-count {
  color: #4a5d57;
  font-weight: 750;
}

.zone-test-count {
  display: inline-grid;
  min-width: 34px;
  min-height: 28px;
  padding: 0.2rem 0.45rem;
  place-items: center;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
}

.zone-test-count.has-value {
  border: 1px solid #c96860;
  background: #d77f78;
  color: #fff;
}

.zone-test-count.empty {
  background: #f3f6f4;
  color: #a1ada7;
}

@media (max-width: 920px) {
  .dashboard-calendar-header {
    display: grid;
    align-items: start;
  }

  .dashboard-calendar-controls {
    justify-content: flex-start;
  }

  .dashboard-grid,
  .trend-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-range-options {
    justify-content: flex-start;
  }

  .trend-heading {
    display: grid;
    align-items: start;
  }

  .site-comparison-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .dashboard-calendar-controls {
    width: 100%;
  }

  .dashboard-calendar-controls strong {
    min-width: 0;
    flex: 1;
  }

  .metric-grid,
  .trend-controls {
    grid-template-columns: 1fr;
  }

  .trend-range-options {
    flex-direction: column;
  }

  .trend-range-options label {
    width: 100%;
  }

  .site-comparison-grid {
    grid-template-columns: 1fr;
  }

  .site-comparison-chart-heading,
  .site-chart-row {
    grid-template-columns: 1fr;
  }

  .site-comparison-chart-heading {
    display: grid;
  }

  .site-chart-row {
    gap: 0.3rem;
  }

  .site-chart-data {
    grid-template-columns: minmax(100px, 1fr) auto;
    gap: 0.3rem;
  }

  .site-chart-latest {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }
}
