.charts-subsection {
  margin-top: 20px;
  padding: 12px 16px 16px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.charts-subsection:first-of-type {
  margin-top: 0;
}

.charts-section-toggle {
  width: auto;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-alt);
  color: inherit;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.charts-section-toggle {
  margin: 10px 0 8px;
}

.charts-filter-shell {
  position: relative;
  flex: 1 1 100%;
  width: 100%;
}

.charts-active-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--filter-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--color-surface-alt) 86%, transparent);
}

.charts-active-filters__content {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.charts-active-filters__label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--filter-label-size);
  font-weight: 700;
}

.charts-mobile-filters__summary {
  display: none;
}

.charts-active-filter-chips,
.charts-active-filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.charts-active-filters__actions {
  justify-content: flex-end;
}

.charts-active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--filter-border);
  border-radius: 999px;
  background: var(--filter-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

button.charts-active-filter-chip {
  cursor: pointer;
}

.charts-active-filter-chip--primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.charts-active-filter-chip__reset {
  color: currentColor;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.72;
}

.charts-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 34;
  width: min(760px, 100%);
  box-shadow: var(--shadow-popover-soft);
}

.charts-filter-panel__head {
  grid-column: 1 / -1;
}

.charts-filter-panel .chart-filters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.charts-filter-panel .time-scope-control {
  padding-bottom: 2px;
  border-bottom: 1px dashed color-mix(in srgb, var(--color-border) 65%, transparent);
}

body[data-page="charts"] .section-band--trends > .section[data-section="chart"] {
  margin-bottom: 0;
}

.charts-section-toggle:hover,
.charts-section-toggle:focus-visible {
  border-color: var(--color-accent);
  outline: none;
}

.charts-section-toggle__title {
  font-weight: 700;
  line-height: 1.15;
}

.charts-section-toggle__summary {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.charts-section-toggle__loading {
  display: none;
}

.charts-section-toggle__summary::after {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.charts-section-toggle.is-expanded .charts-section-toggle__summary::after {
  transform: rotate(225deg);
}

[data-charts-section-panel][hidden],
#chartsMainFiltersPanel[hidden] {
  display: none;
}

.charts-jump-nav__label-mobile,
.charts-back-to-sections {
  display: none;
}

.charts-subsection .chart-grid {
  gap: 12px;
}

.charts-hospital-table-controls {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin: 8px 0 10px;
}

.charts-hospital-table-actions {
  justify-content: flex-end;
}

.charts-hospital-table-controls__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.charts-hospital-table-controls__field select,
.charts-hospital-table-controls__field input {
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-input-bg);
  color: var(--color-text);
  padding: 10px 12px;
  font-size: 0.95rem;
  min-height: 40px;
}

.charts-hospital-table-controls__field .search-field-wrap input[type="search"] {
  padding-left: 42px;
}

.charts-hospital-table-controls__field > span:not(.search-field-wrap) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.charts-hospital-table-hint {
  margin: 0 0 12px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.charts-hospital-table-wrapper {
  max-height: min(72vh, 640px);
}

.charts-hospital-table-wrapper th:first-child,
.charts-hospital-table-wrapper td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--color-surface);
}

.charts-hospital-table-wrapper th:first-child {
  z-index: 4;
  background: var(--color-surface-alt);
}

.charts-hospital-table-wrapper th[data-charts-hospital-sort] {
  padding: 0;
  user-select: none;
}

.charts-hospital-table-wrapper th[data-charts-hospital-sort].is-sort-active {
  color: var(--color-text);
}

.charts-hospital-sort-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.charts-hospital-sort-button__label {
  display: block;
}

.charts-hospital-sort-button__icon {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.charts-hospital-sort-button:hover,
.charts-hospital-sort-button:focus-visible {
  background: color-mix(in srgb, var(--color-accent-soft) 26%, transparent);
  color: var(--color-text);
  outline: none;
}

.charts-hospital-sort-button.is-sort-active {
  color: var(--color-text);
}

.charts-hospital-sort-button.is-sort-active .charts-hospital-sort-button__label {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.charts-hospital-sort-button:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.charts-hospital-table-wrapper td:first-child {
  font-weight: 600;
  min-width: 220px;
  box-shadow: 8px 0 16px -14px rgba(15, 23, 42, 0.45);
}

.charts-hospital-row-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.charts-hospital-row-button__label {
  font-weight: 600;
}

.charts-hospital-row-button__meta {
  font-size: 0.79rem;
  color: var(--color-text-muted);
}

.charts-hospital-row-button:hover,
.charts-hospital-row-button:focus-visible {
  background: color-mix(in srgb, var(--color-accent-soft) 22%, transparent);
  outline: none;
}

.charts-hospital-row-button:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.charts-hospital-row-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--color-accent-soft) 32%, transparent);
}

.charts-hospital-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  justify-content: center;
  min-width: 94px;
  border-radius: 8px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--color-accent-soft) var(--cell-intensity, 0%), transparent);
}

.charts-hospital-cell__count {
  font-weight: 600;
  color: var(--color-text);
}

.charts-hospital-cell__pct {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.charts-hospital-cell--unclassified {
  background: color-mix(in srgb, var(--color-warning, #d97706) var(--cell-intensity, 0%), transparent);
}

.charts-hospital-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  white-space: nowrap;
}

.charts-hospital-table-wrapper tbody tr {
  cursor: default;
}

.charts-hospital-table-wrapper tbody tr.is-department-active td {
  background: color-mix(in srgb, var(--color-accent-soft) 42%, transparent);
}

.charts-hospital-trend {
  margin-top: 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-alt);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.charts-hospital-trend__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.charts-hospital-trend__header-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.charts-hospital-trend__clear {
  flex: 0 0 auto;
  margin-left: auto;
}

.charts-hospital-trend__header h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--color-text);
}

.charts-hospital-trend__header p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--color-text-muted);
}

.charts-hospital-trend__state {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.charts-hospital-trend__state--neutral {
  border: 1px dashed color-mix(in srgb, var(--color-accent) 26%, transparent);
  background: color-mix(in srgb, var(--color-accent-soft) 18%, transparent);
  color: var(--color-text);
}

.charts-hospital-trend__state--empty {
  border: 1px solid color-mix(in srgb, var(--color-warning, #d97706) 32%, transparent);
  background: color-mix(in srgb, var(--color-warning, #d97706) 12%, transparent);
  color: var(--color-text);
}

.charts-hospital-trend canvas {
  width: 100%;
  height: clamp(260px, 32vw, 320px);
  min-height: 260px;
  max-height: 320px;
  display: block;
}

.heatmap-toolbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-card__toolbar--chart-controls {
  width: 100%;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.chart-card__control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chart-card__control-group--aggregation {
  flex: 0 1 auto;
  min-height: 34px;
}

.chart-card__toolbar--chart-controls .heatmap-toolbar__label {
  flex: 0 0 auto;
  white-space: nowrap;
}

.chart-card__toolbar--chart-controls .segmented-control {
  min-height: 34px;
}

.chart-card__toolbar--chart-controls .segmented-control__button {
  min-height: 34px;
  line-height: 34px;
  padding-block: 0;
}

.chart-card__toolbar--chart-controls :is(.export-icon-btn, .chart-copy-btn, .chart-download-btn) {
  flex: 0 0 auto;
}

.hourly-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

.hourly-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hourly-toolbar__row--actions {
  justify-content: flex-end;
}

.hourly-toolbar__actions-inline {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hourly-toolbar__field {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.hourly-toolbar__field--metric {
  min-width: 220px;
}

.hourly-toolbar__hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.hourly-compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.hourly-compare-toggle input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--color-accent);
}

.hourly-compare-toggle:hover,
.hourly-compare-toggle:focus-within {
  color: var(--color-text);
  background: var(--color-surface);
  border-color: rgba(37, 99, 235, 0.35);
}

.hourly-toolbar select,
.hourly-toolbar .chip-button,
.hourly-toolbar .segmented-control__button,
.hourly-toolbar #hourlyDepartment,
.hourly-department__toggle {
  height: 34px;
  min-height: 34px;
}

.segmented-control {
  min-height: 34px;
  align-items: stretch;
}

.segmented-control__button,
.hourly-toolbar .chip-button {
  line-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

body[data-theme="dark"] .hourly-toolbar select {
  background: rgba(15, 23, 42, 0.7);
  color: var(--color-text);
  border-color: rgba(96, 165, 250, 0.25);
}

body[data-theme="dark"] .hourly-toolbar select:hover,
body[data-theme="dark"] .hourly-toolbar select:focus-visible {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
}

.chart-card--hourly label[for="hourlyDepartment"] {
  flex: 1 1 280px;
  min-width: 220px;
}

.hourly-department {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: visible;
  position: relative;
}

.chart-card--hourly #hourlyDepartment {
  min-width: 220px;
  border: none;
  background: transparent;
  color: var(--color-text);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  min-height: 36px;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.hourly-department__toggle {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  padding: 8px 12px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.hourly-department__toggle::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.hourly-department__toggle[aria-expanded="true"]::before {
  transform: rotate(225deg);
}

.hourly-department__toggle:hover,
.hourly-department__toggle:focus-visible {
  background: var(--color-input-bg-hover);
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--color-accent);
  outline: none;
}

.chart-card--hourly #hourlyDepartment:hover,
.chart-card--hourly #hourlyDepartment:focus-visible {
  background: var(--color-input-bg-hover);
  border-color: rgba(37, 99, 235, 0.35);
  outline: none;
}

.hourly-department:focus-within {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 2px var(--state-accent-bg-12);
}

.hourly-suggestions {
  position: absolute;
  margin-top: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 12px 26px -20px rgba(15, 23, 42, 0.45);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
  min-width: 220px;
}

.hourly-department .hourly-suggestions {
  top: 100%;
  right: 0;
  left: auto;
  margin-top: 6px;
}

.hourly-suggestions__item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

.hourly-suggestions__item[aria-selected="true"],
.hourly-suggestions__item:hover {
  background: var(--state-accent-bg-12);
  color: var(--color-accent);
}

body[data-theme="dark"] .hourly-suggestions {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(96, 165, 250, 0.25);
  box-shadow: 0 16px 40px -28px rgba(15, 23, 42, 0.85);
}

.heatmap-toolbar__field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 6px 10px;
}

.heatmap-toolbar__label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.heatmap-toolbar__field--segmented {
  padding-right: 6px;
}

.heatmap-toolbar__segmented .segmented-control__button {
  min-width: 44px;
  padding-inline: 12px;
}

.heatmap-toolbar select {
  appearance: none;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 6px 28px 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}

.heatmap-toolbar select:hover,
.heatmap-toolbar select:focus-visible {
  background: var(--color-input-bg-hover);
  border-color: rgba(37, 99, 235, 0.35);
  outline: none;
}

.heatmap-toolbar__field,
.hourly-compare-toggle {
  min-height: var(--filter-height);
  font-size: var(--filter-font-size);
  padding: 0 10px;
  background: var(--color-surface-alt);
}

.hourly-compare-toggle:hover,
.hourly-compare-toggle:focus-within,
.heatmap-toolbar__field:focus-within {
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--filter-border));
}

.hourly-department {
  border: 1px solid var(--filter-border);
  border-radius: var(--filter-radius);
  background: var(--filter-bg);
  min-height: var(--filter-height);
}

.hourly-department:focus-within {
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--filter-border));
  box-shadow: var(--filter-focus-ring);
}

.chart-card--hourly #hourlyDepartment {
  border: none;
  background: transparent;
  color: var(--color-text);
  min-height: var(--filter-height);
  height: var(--filter-height);
}

@media (max-width: 640px) {
  .charts-subsection {
    padding: 12px;
  }

  .filter-panel {
    padding: 8px;
  }

  .chart-filters {
    width: 100%;
    flex-basis: 100%;
  }

  .chart-filter {
    min-width: 0;
  }

  .chart-card__toolbar--chart-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .chart-card__control-group--aggregation {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  body[data-page="charts"]:not([data-charts-ready]) [data-charts-section-panel] {
    display: none;
  }

  body[data-page="charts"] {
    --charts-jump-nav-height: 112px;
  }

  body[data-page="charts"] #chartHeading,
  body[data-page="charts"] #chartsHourlyHeading,
  body[data-page="charts"] #chartsHeatmapHeading,
  body[data-page="charts"] #chartsHospitalTableHeading {
    scroll-margin-top: calc(var(--mobile-top-bar-height, 56px) + var(--charts-jump-nav-height, 112px) + 18px);
  }

  .charts-jump-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    position: sticky;
    top: calc(var(--mobile-top-bar-height, 56px) + env(safe-area-inset-top, 0px));
    z-index: 28;
    margin: 0 -12px 10px;
    padding: 10px 12px;
    overflow: visible;
    overscroll-behavior-x: auto;
    scroll-snap-type: none;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    border-bottom: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: 0 10px 24px -22px rgba(15, 23, 42, 0.45);
    scrollbar-width: none;
  }

  .charts-jump-nav__link {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    scroll-snap-align: none;
    white-space: nowrap;
  }

  .charts-jump-nav__label-full,
  .charts-jump-nav__label-mobile {
    min-width: 0;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
  }

  .charts-jump-nav__link.active,
  .charts-jump-nav__link.is-active,
  .charts-jump-nav__link[aria-current="true"] {
    border-color: color-mix(in srgb, var(--color-accent) 48%, var(--color-border));
    background: color-mix(in srgb, var(--color-accent-soft) 54%, var(--color-surface));
    color: var(--color-accent);
  }

  .charts-jump-nav__label-full {
    display: none;
  }

  .charts-jump-nav__label-mobile {
    display: inline;
  }

  .charts-back-to-sections {
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mobile-bottom-nav-height, 72px) + env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 36;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 36%, var(--color-border));
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-accent);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 18px 38px -28px rgba(15, 23, 42, 0.85);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition:
      opacity 160ms ease,
      transform 160ms ease;
  }

  .charts-back-to-sections[data-visible="true"] {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .charts-back-to-sections:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
    outline-offset: 2px;
  }

  .charts-jump-nav__link:focus-visible,
  .charts-mobile-filters__toggle:focus-visible,
  .charts-filter-panel__close:focus-visible,
  .charts-active-filter-chip:focus-visible,
  .heatmap-scroll:focus-visible,
  .charts-hospital-table-wrapper:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
    outline-offset: 2px;
  }

  .charts-active-filters {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .charts-mobile-filters__summary {
    display: block;
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.76rem;
    line-height: 1.25;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .charts-active-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .charts-active-filter-chip {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .charts-active-filters__actions {
    justify-content: flex-start;
  }

  .charts-filter-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .charts-mobile-filters__toggle,
  .chart-period .chip-button,
  .chart-year-chips .chip-button,
  .chart-filter__segmented .segmented-control__button,
  .heatmap-toolbar__field,
  .heatmap-toolbar .chart-copy-btn,
  .heatmap-toolbar .chart-download-btn,
  .hourly-toolbar .segmented-control__button,
  .hourly-toolbar .chip-button {
    flex: 0 0 auto;
    min-height: 44px;
    scroll-snap-align: start;
  }

  #chartsMainFiltersPanel {
    width: 100%;
  }

  #chartsMainFiltersPanel[data-expanded="false"] {
    display: none;
  }

  .chart-period,
  .chart-year-chips,
  .chart-filter__segmented,
  .heatmap-toolbar,
  .hourly-toolbar__row,
  .hourly-compare-series .segmented-control {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .chart-period__more {
    flex: 0 0 auto;
  }

  .chart-controls,
  .chart-filters {
    gap: 8px;
  }

  .charts-section-toggle {
    width: 100%;
    min-height: 44px;
    margin: 12px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .charts-section-toggle[data-charts-section-toggle="overview"] {
    margin-top: 0;
  }

  .charts-section-toggle__summary {
    font-size: 0.76rem;
    line-height: 1.25;
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right;
  }

  .charts-section-toggle__title {
    font-size: 0.98rem;
  }

  body[data-page="charts"][data-charts-loading="true"]
    .charts-section-toggle[data-loading="true"]:not(.is-expanded)
    .charts-section-toggle__loading {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 32%, var(--color-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent-soft) 52%, var(--color-surface));
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 700;
  }

  .charts-subsection,
  .chart-card,
  .charts-hospital-trend {
    border-radius: 10px;
    padding: 10px;
    gap: 8px;
  }

  .charts-subsection {
    margin-top: 8px;
  }

  .charts-subsection__subtitle,
  .chart-card figcaption {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .chart-card__toolbar--actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .chart-card__canvas--chart,
  .chart-card--tall .chart-card__canvas--chart {
    min-height: 240px;
    height: clamp(240px, 48vh, 300px);
  }

  .chart-card--tall {
    min-height: 0;
  }

  .chart-card__canvas--hourly {
    min-height: 280px;
    height: clamp(280px, 52vh, 320px);
  }

  .chart-card--hourly {
    min-height: 0;
  }

  .hourly-toolbar__actions-inline {
    margin-left: 0;
    flex-wrap: nowrap;
  }

  .heatmap-toolbar {
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .heatmap-toolbar__field {
    min-width: max-content;
  }

  .heatmap-table {
    min-width: 620px;
    font-size: 0.72rem;
  }

  .charts-hospital-table-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .charts-hospital-table-controls__field select,
  .charts-hospital-table-controls__field input {
    min-height: 44px;
  }

  .charts-hospital-table-wrapper td:first-child {
    min-width: 180px;
  }

  .charts-hospital-sort-button__label,
  .charts-hospital-row-button__label {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 520px) and (prefers-reduced-motion: reduce) {
  .charts-back-to-sections {
    transition: none;
  }
}

body[data-theme="dark"] .hourly-department {
  background: var(--filter-bg);
  border-color: var(--filter-border);
}

.hourly-department.is-disabled {
  opacity: 0.55;
  filter: grayscale(0.15);
  pointer-events: none;
}

.heatmap-scroll {
  width: 100%;
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 0.8rem;
  min-width: 960px;
}

.heatmap-table thead th {
  text-align: center;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 4px 2px;
  white-space: nowrap;
}

.heatmap-table tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 6px 8px;
  white-space: nowrap;
}

.heatmap-table td {
  padding: 0;
}

.heatmap-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.1s ease;
}

.heatmap-cell:hover,
.heatmap-cell:focus-visible {
  transform: scale(1.05);
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
}

.heatmap-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.heatmap-legend {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
