.permits-lower {
  grid-template-columns: minmax(0, calc(75% - 3px)) minmax(0, calc(25% - 9px));
  gap: 12px;
  align-items: stretch;
  min-height: calc(100vh - 211px);
}
.permits-chart-panel,
.metrics-panel {
  height: 100%;
  min-height: 435px;
}
.permits-chart {
  height: calc(100% - 39px);
  min-height: 378px;
}
.metrics-panel {
  padding: 8px;
}
.metrics-panel .metric-heading {
  height: 48px;
  padding: 4px 8px 9px;
}
.metrics-panel .metric-list {
  height: 363px;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;
}
.metrics-panel .metric-card {
  height: auto;
  min-height: 0;
}
.metrics-panel .metric-heading span {
  font-size: 31px;
}
[hidden] {
  display: none !important;
}
.date-pair {
  gap: 5px;
}
@media (max-width: 1000px) {
  .permits-lower {
    grid-template-columns: minmax(0, calc(75% - 3px)) minmax(0, calc(25% - 9px));
  }
}
@media (max-width: 800px) {
  .permits-lower {
    grid-template-columns: 1fr;
  }
  .permits-chart-panel,
  .metrics-panel {
    height: auto;
  }
  .permits-chart {
    height: 360px;
  }
  .metrics-panel .metric-list {
    height: auto;
    grid-template-rows: repeat(6, 56px);
  }
}
body[data-page='permits'] main {
  padding-bottom: 9px;
}

/* Power BI canvas: 1615 x 1100, scaled as one unit to preserve the reference spacing. */
@media (min-width: 801px) {
  :root {
    --outer: 16px;
    --canvas-w: calc(100vw - 32px);
    --canvas-h: calc(var(--canvas-w) * 1100 / 1615);
    --side: calc(var(--canvas-w) * 177 / 1615);
    --header-h: calc(var(--canvas-w) * 121 / 1615);
  }
  body[data-page='permits'] {
    --canvas-h: calc(100vh - 26px);
  }
  body[data-page='plans'] {
    --canvas-h: max(calc(100vh - 26px), calc(var(--canvas-w) * 1700 / 1615));
  }
  body[data-page='inspections'] {
    --canvas-h: max(calc(100vh - 26px), calc(var(--canvas-w) * 1450 / 1615));
  }
  .sidebar {
    left: var(--outer);
    top: 13px;
    bottom: auto;
    width: var(--side);
    height: var(--canvas-h);
  }
  .seal-wrap {
    height: var(--header-h);
  }
  .seal-wrap img {
    width: calc(var(--header-h) * 0.72);
    height: calc(var(--header-h) * 0.72);
  }
  .sidebar nav {
    padding: 0 7px;
    gap: 8px;
  }
  .nav {
    height: 26px;
    padding: 0 7px;
    font-size: 8px;
  }
  .nav span {
    width: 14px;
  }
  .report-header {
    left: calc(var(--outer) + var(--side));
    right: auto;
    top: 13px;
    width: calc(var(--canvas-w) - var(--side));
    height: var(--header-h);
    padding: 8px 11px 0 3px;
  }
  .report-name h1 {
    font-size: 20px;
    margin-bottom: 5px;
  }
  .report-name p {
    font-size: 12px;
  }
  .filters {
    gap: 8px;
  }
  .filters label {
    gap: 4px;
    font-size: 8px;
  }
  .filters select,
  .filters input {
    height: 27px;
    min-width: 116px;
    border-radius: 5px;
    font-size: 8px;
  }
  .date-pair input {
    width: 72px;
    min-width: 0;
  }
  .filters button {
    height: 27px;
    min-width: 55px;
    font-size: 9px;
  }
  main {
    left: calc(var(--outer) + var(--side));
    right: auto;
    top: calc(13px + var(--header-h));
    width: calc(var(--canvas-w) - var(--side));
    height: calc(var(--canvas-h) - var(--header-h));
    min-height: 0;
    padding: 9px;
    overflow: hidden;
  }
  .kpis {
    height: 52px;
    gap: 12px;
    margin-bottom: 11px;
  }
  .card {
    height: 52px;
    grid-template-columns: 47px minmax(0, 1fr);
    grid-template-rows: 30px 18px;
  }
  .card-icon {
    width: 31px;
    height: 31px;
    margin-left: 10px;
    border-radius: 8px;
    font-size: 16px;
  }
  .card strong {
    font-size: 18px;
  }
  .card p {
    font-size: clamp(10px, 0.72vw, 13px);
    line-height: 1.2;
  }
  .permits-lower {
    height: calc(var(--canvas-h) - var(--header-h) - 81px);
    min-height: 0;
    grid-template-columns: minmax(0, calc(75% - 3px)) minmax(0, calc(25% - 9px));
    gap: 12px;
  }
  .permits-chart-panel,
  .metrics-panel {
    height: 100%;
    min-height: 0;
  }
  .visual {
    padding: 7px;
    border-radius: 5px;
  }
  .visual h2 {
    font-size: 10px;
    margin-bottom: 7px;
  }
  .legend {
    font-size: 7px;
    margin-bottom: 4px;
  }
  .permits-chart {
    height: calc(100% - 28px);
    min-height: 0;
  }
  .metrics-panel {
    padding: 7px;
  }
  .metrics-panel .metric-heading {
    height: 60px;
    padding: 6px 10px 10px;
    font-size: 20px;
    gap: 10px;
  }
  .metrics-panel .metric-heading span {
    font-size: 25px;
  }
  .metrics-panel {
    height: 100%;
    align-self: stretch;
  }
  .metrics-panel .metric-list {
    height: calc(100% - 60px);
    grid-template-rows: repeat(6, 70px);
    align-content: space-between;
    gap: 0;
  }
  .metric-card {
    height: 70px;
    padding: 8px 10px;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 7px;
    row-gap: 4px;
  }
  .metric-card .mini-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    font-size: 18px;
  }
  .metric-card strong {
    font-size: clamp(18px, 1.25vw, 24px);
    line-height: 1.1;
  }
  .metric-card p {
    font-size: clamp(9px, 0.58vw, 11px);
    line-height: 1.15;
  }
  body[data-page='plans'],
  body[data-page='inspections'] {
    overflow-y: auto;
  }
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    overflow: visible;
  }
  body[data-page='plans'] .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: calc(var(--canvas-w) * 417 / 1615) calc(var(--canvas-w) * 406 / 1615) calc(
        var(--canvas-w) * 543 / 1615
      );
    gap: 14px;
  }
  body[data-page='plans'] .plan-grid .visual {
    height: 100%;
    min-height: 0;
  }
  body[data-page='plans'] .plan-grid .chart.medium {
    height: calc(100% - 34px);
    min-height: 0;
  }
  body[data-page='plans'] .plan-grid .donut-wrap {
    height: calc(100% - 28px);
  }
  body[data-page='plans'] .plan-grid .visual.wide {
    grid-column: 1/-1;
  }
  body[data-page='inspections'] .inspection-grid .visual {
    min-height: 0;
  }
  body[data-page='inspections'] .inspection-grid .visual.wide {
    height: calc(var(--canvas-w) * 544 / 1615);
  }
  body[data-page='inspections'] .inspection-grid .visual:not(.wide) {
    height: calc(var(--canvas-w) * 596 / 1615);
  }
  body[data-page='inspections'] .inspection-grid .chart.medium,
  body[data-page='inspections'] .inspection-grid .chart.short {
    height: calc(100% - 30px);
  }
  body[data-page='inspections'] .inspection-grid .donut-wrap {
    height: calc(100% - 28px);
  }
}

/* Zoning dashboard parity: keep cache status internal and hide sidebar timestamp. */
.side-note {
  display: none !important;
}

body[data-page='permits'] .month-label-vertical {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
}

/* Zoning Dashboard visual theme */
:root {
  --navy: #2b5b9b;
  --navy-deep: #0a1526;
  --navy-side: #0f1b33;
  --blue: #2b5b9b;
  --gold: #c8a559;
  --gold-line: #c2ab45;
  --purple: #7a5fb0;
  --orange: #db7600;
  --red: #c13737;
  --ink: #1a2233;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-200: #e2e8f0;
  --gray-100: #eef2f7;
  --bg: #f2f5fa;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
}
.sidebar {
  background: var(--navy-side);
  border-right: 1px solid rgba(200, 165, 89, 0.18);
  box-shadow: 4px 0 18px rgba(10, 21, 38, 0.12);
}
.seal-wrap {
  background: var(--navy-deep);
  width: 100%;
  border-bottom: 1px solid rgba(200, 165, 89, 0.2);
}
.seal-wrap img {
  filter: drop-shadow(0 0 5px rgba(200, 165, 89, 0.25));
}
.sidebar nav {
  margin-top: 12px;
}
.nav {
  background: transparent;
  color: #a8b0cc;
  border-left: 3px solid transparent;
  border-radius: 6px;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 7px;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav span {
  width: auto;
  flex: 0 0 auto;
}
.nav b {
  line-height: 1.15;
}
.nav:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.nav.active {
  background: rgba(200, 165, 89, 0.14);
  color: #fff;
  border-left-color: var(--gold);
}
.nav.active span {
  color: var(--gold);
}
.side-note {
  color: #a8b0cc;
}
.pulse {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 165, 89, 0.14);
}

.report-header {
  background: var(--navy-deep);
  border-bottom: 3px solid var(--gold-line);
  box-shadow: 0 3px 12px rgba(10, 21, 38, 0.16);
}
.report-name h1 {
  color: #fff;
  font-family: var(--font-serif);
  letter-spacing: 0.1px;
}
.report-name p {
  color: #a8b0cc;
  font-weight: 500;
}
.filters label {
  color: #a8b0cc;
  font-weight: 800;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}
.filters select,
.filters input {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 2px rgba(10, 21, 38, 0.06);
  font-family: var(--font-sans);
  font-weight: 600;
}
.filters select:focus,
.filters input:focus {
  outline: 2px solid rgba(200, 165, 89, 0.45);
  outline-offset: 1px;
}
.filters button {
  color: var(--navy);
  border: 1px solid var(--gray-200);
  font-family: var(--font-sans);
  box-shadow: 0 1px 2px rgba(10, 21, 38, 0.06);
}
.filters button:hover {
  background: var(--gray-100);
}

main {
  background: var(--bg);
  box-shadow: none;
}
.card,
.visual,
.metric-card {
  background: #fff;
  border-color: var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 27, 51, 0.045);
}
.card strong {
  color: var(--ink) !important;
  font-family: var(--font-serif);
  font-weight: 800;
}
.card p {
  color: var(--gray-500);
}
.card-icon {
  background: #eaf1fa;
  color: var(--blue);
}
.card:nth-child(2) .card-icon {
  background: #fbf3e1;
  color: var(--gold);
}
.card:nth-child(3) .card-icon {
  background: #f0ecfa;
  color: var(--purple);
}
.card:nth-child(4) .card-icon {
  background: #fdefe0;
  color: var(--orange);
}
body[data-page='inspections'] .card:nth-child(2) .card-icon {
  background: #fff0e1;
  color: var(--orange);
}
body[data-page='inspections'] .card:nth-child(3) .card-icon {
  background: #e6f5e8;
  color: #399a52;
}
body[data-page='inspections'] .card:nth-child(4) .card-icon {
  background: #f0e9ff;
  color: #8b63d6;
}

.visual {
  overflow: hidden;
}
.visual h2 {
  color: var(--navy);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 800;
  border-bottom: 2px solid var(--gold-line);
  padding-bottom: 7px;
}
.legend,
.donut-legend {
  color: var(--gray-500);
  font-weight: 600;
}
.chart-label {
  fill: var(--gray-500);
  font-family: var(--font-sans);
}
.axis {
  stroke: var(--gray-200);
}
.donut:after {
  background: #fff;
}

.metric-heading {
  color: var(--navy);
  font-family: var(--font-serif);
}
.metric-heading span {
  color: var(--gold);
}
.metric-card .mini-icon {
  background: #eaf1fa;
  color: var(--blue);
}
.metric-card strong {
  color: var(--ink) !important;
  font-family: var(--font-serif);
  font-weight: 800;
}
.metric-card p {
  color: var(--gray-500);
}
.notice {
  background: #fbf3e1;
  color: var(--ink);
  border-color: rgba(200, 165, 89, 0.6);
  border-radius: 8px;
}
.loading-page {
  color: var(--gray-500);
}
.preview-badge {
  background: var(--navy-deep);
  color: var(--gold);
}
.bar-value-small {
  fill: var(--ink);
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 800;
}
.combined-value-label {
  fill: var(--ink);
  font-family: 'Times New Roman', Times, serif;
  font-size: 7px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2.5px;
  stroke-linejoin: round;
}
.card strong,
.metric-card strong,
.chart text[fill='#fff'],
.bar-value-small,
.donut-data-label small,
.donut-legend b,
.donut-legend small {
  font-family: 'Times New Roman', Times, serif;
}
.donut-stage {
  width: min(240px, 52%);
  aspect-ratio: 1;
  position: relative;
  flex: 0 0 auto;
}
.donut-stage .donut {
  width: 100%;
  height: 100%;
}
.donut-cross-highlight .donut-base:after {
  display: none;
}
.donut-stage .donut-highlight {
  position: absolute;
  inset: 38%;
  width: 24%;
  height: 24%;
  z-index: 1;
}
.donut-stage .donut-highlight:after {
  display: none;
}
.donut-hover-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  transform: translate(-50%, calc(-100% - 9px));
  min-width: 112px;
  padding: 6px 9px;
  border-radius: 5px;
  background: rgba(10, 21, 38, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(10, 21, 38, 0.22);
}
.donut-hover-tooltip.is-visible {
  display: block;
}
.donut-cross-highlight .donut-data-label {
  z-index: 2;
}
.donut-data-label {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 1px;
  min-width: 38px;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(10, 21, 38, 0.78);
  color: #fff;
  text-align: center;
  line-height: 1.05;
  pointer-events: none;
}
.donut-data-label b {
  font-size: 8px;
}
.donut-data-label small {
  font-size: 8px;
  font-weight: 800;
}
#tradeDonut .donut-data-label:last-child {
  margin-left: 18px;
  margin-top: -8px;
}

/* Keep donut charts clean: details remain available in the aligned legends. */
body[data-page='plans'] #planDonut .donut-data-label,
body[data-page='inspections'] #tradeDonut .donut-data-label {
  display: none;
}

.donut-legend span {
  display: grid;
  grid-template-columns: 10px minmax(65px, 1fr) auto auto;
  align-items: center;
  gap: 5px;
}
.donut-legend em {
  font-style: normal;
}
.donut-legend b {
  color: var(--ink);
  font-size: 10px;
}
.donut-legend small {
  color: var(--gray-400);
  min-width: 38px;
  text-align: right;
}
.ui-icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav .ui-icon {
  width: 14px;
  height: 14px;
}
.card-icon .ui-icon {
  width: 20px;
  height: 20px;
}
.mini-icon .ui-icon {
  width: 19px;
  height: 19px;
}
.metric-heading .ui-icon {
  width: 26px;
  height: 26px;
}
.filters button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.filters button .ui-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}
.filters button .ui-icon + span {
  margin-left: 0;
}

@media (min-width: 801px) {
  .nav {
    min-height: 34px;
    font-size: 10px;
    padding: 0 8px;
  }
  .card p {
    font-size: clamp(10px, 0.72vw, 13px);
  }
  .legend {
    font-size: 9px;
  }
}

/* Full-bleed shell: remove the white corner gutter and mismatched header seams. */
.sidebar {
  border-right: 0;
}
.seal-wrap {
  border-bottom: 3px solid var(--gold-line);
}

@media (min-width: 801px) {
  :root {
    --outer: 0px;
    --canvas-w: 100vw;
  }
  body[data-page='permits'] {
    --canvas-h: 100vh;
  }
  body[data-page='plans'] {
    --canvas-h: max(100vh, calc(var(--canvas-w) * 1700 / 1615));
  }
  body[data-page='inspections'] {
    --canvas-h: max(100vh, calc(var(--canvas-w) * 1450 / 1615));
  }
  .sidebar {
    left: 0;
    top: 0;
  }
  .report-header {
    left: var(--side);
    top: 0;
  }
  main {
    left: var(--side);
    top: var(--header-h);
  }
}

/* Planning & Zoning shell shown in the Reports & Analytics reference. */
.brand-copy {
  display: none;
}
html,
body {
  overflow-x: hidden;
}

@media (min-width: 801px) {
  :root {
    --topbar-h: 62px;
    --side: 180px;
    --page-head-h: 185px;
    --header-h: var(--page-head-h);
  }

  .seal-wrap {
    position: fixed;
    inset: 0 0 auto 0;
    width: 100vw;
    height: var(--topbar-h);
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    background: var(--navy-deep);
    border-bottom: 1px solid rgba(200, 165, 89, 0.18);
    z-index: 6;
  }
  .seal-wrap img {
    width: 46px;
    height: 46px;
  }
  .brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .brand-copy strong {
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.1;
  }
  .brand-copy span {
    color: #a8b0cc;
    font-size: 12px;
    font-weight: 600;
  }

  .sidebar {
    left: 0;
    top: var(--topbar-h);
    width: var(--side);
    height: calc(100vh - var(--topbar-h));
    padding-top: 18px;
    box-shadow: none;
  }
  .sidebar nav {
    margin-top: 0;
    padding: 0;
    gap: 2px;
  }
  .nav {
    width: 100%;
    min-height: 41px;
    padding: 0 20px;
    gap: 11px;
    border-radius: 0;
    font-size: 14px;
  }
  .nav.active {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--gold);
    padding-left: 17px;
  }
  .side-note {
    padding: 16px 12px;
    font-size: 10px;
  }

  .report-header {
    left: var(--side);
    top: var(--topbar-h);
    width: calc(100vw - var(--side));
    height: var(--page-head-h);
    display: block;
    padding: 27px 28px 18px;
    background: var(--bg);
    border: 0;
    box-shadow: none;
    color: var(--ink);
  }
  .report-name h1 {
    color: var(--navy);
    font-size: 26px;
    margin: 0 0 4px;
  }
  .report-name p {
    color: var(--gray-500);
    font-size: 15px;
  }
  .filters {
    margin-top: 30px;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 14px;
  }
  .filters label {
    color: var(--gray-500);
    font-size: 12px;
    gap: 6px;
  }
  .filters select,
  .filters input {
    height: 38px;
    min-width: 150px;
    border-radius: 8px;
    font-size: 14px;
    padding: 0 12px;
  }
  .date-pair {
    gap: 14px;
  }
  .date-pair input {
    width: 135px;
    min-width: 135px;
  }
  .filters button {
    height: 38px;
    min-width: 91px;
    border-radius: 8px;
    font-size: 14px;
  }
  .filters button span {
    font-size: 14px;
  }

  main,
  body[data-page='permits'] main,
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    left: var(--side);
    top: calc(var(--topbar-h) + var(--page-head-h));
    width: calc(100vw - var(--side));
    height: auto;
    min-height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    padding: 12px 28px 36px;
    overflow: visible;
  }
  .permits-lower {
    height: auto;
    min-height: 465px;
  }
  .permits-chart-panel,
  .metrics-panel {
    min-height: 465px;
  }

  .visual {
    padding: 7px;
  }
  .visual h2 {
    margin: -7px -7px 10px;
    padding: 11px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--gold-line);
    font-family: var(--font-sans);
    font-size: 14px;
    letter-spacing: 0.1px;
  }
  .metrics-panel .metric-heading {
    height: 50px;
    margin: -7px -7px 8px;
    padding: 11px 16px;
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--gold-line);
    font-family: var(--font-sans);
    font-size: 14px;
  }
  .metrics-panel .metric-heading span {
    color: var(--gold);
    font-size: 20px;
  }
  .metrics-panel .metric-list {
    height: calc(100% - 51px);
  }
}

/* Power BI-style title row: filters sit at the upper-right of the page. */
@media (min-width: 1200px) {
  :root {
    --page-head-h: 96px;
  }
  .report-header {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: start;
    gap: 24px;
  }
  .filters {
    margin-top: 0;
    justify-content: flex-end;
  }
  .date-pair {
    flex: 0 0 auto;
  }
  .date-pair input {
    width: 135px;
    min-width: 135px;
    flex: 0 0 135px;
    padding-left: 10px;
    padding-right: 7px;
  }
}

@media (min-width: 801px) and (max-width: 1199px) {
  :root {
    --page-head-h: 185px;
  }
  .report-header {
    display: block;
  }
  .filters {
    margin-top: 30px;
    justify-content: flex-start;
  }
  .filters select,
  .filters input {
    min-width: 126px;
  }
  .date-pair input {
    width: 112px;
    min-width: 112px;
  }
}

/* Keep filter controls legible at both the responsive and Power BI canvas sizes. */
.filters label {
  font-size: 13px;
}
.filters select,
.filters input {
  font-size: 13px;
}
.date-pair input {
  font-size: 13px;
}
.filters button,
.filters button span {
  font-size: 13px;
}

@media (min-width: 801px) {
  .filters label {
    font-size: 11px;
  }
  .filters select,
  .filters input {
    height: 30px;
    min-width: 126px;
    font-size: 12px;
  }
  .date-pair input {
    width: 96px;
    min-width: 0;
  }
  .filters button {
    height: 30px;
    min-width: 64px;
    font-size: 12px;
  }
  .filters button span {
    font-size: 12px;
  }
}

/* Screenshot mode: keep every dashboard view inside one desktop viewport. */
@media (min-width: 801px) {
  :root {
    --topbar-h: 62px;
    --side: clamp(145px, 12vw, 180px);
    --page-head-h: 96px;
    --header-h: var(--page-head-h);
  }

  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    height: calc(100vh - var(--topbar-h));
    overflow: hidden;
  }

  .report-header {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    align-items: start;
    gap: 12px;
    height: var(--page-head-h);
    padding: 22px 18px 12px;
  }

  .report-name h1 {
    font-size: clamp(22px, 2.1vw, 26px);
  }
  .filters {
    margin-top: 0;
    gap: 8px;
    justify-content: flex-end;
  }
  .filters select {
    min-width: 112px;
  }
  .date-pair {
    gap: 6px;
  }
  .date-pair input {
    width: 108px;
    min-width: 108px;
    padding-left: 9px;
    padding-right: 5px;
  }
  .filters button {
    min-width: 70px;
  }

  main,
  body[data-page='permits'] main,
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    top: calc(var(--topbar-h) + var(--page-head-h));
    height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    min-height: 0;
    padding: 12px 18px 14px;
    overflow: hidden;
  }

  #dashboardContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .kpis {
    flex: 0 0 62px;
    height: 62px;
    margin-bottom: 12px;
  }
  .card {
    height: 62px;
    grid-template-columns: 50px minmax(0, 1fr);
    grid-template-rows: 35px 21px;
  }
  .card-icon {
    width: 34px;
    height: 34px;
    margin-left: 9px;
  }
  .card strong {
    font-size: clamp(15px, 1.7vw, 21px);
  }
  .card p {
    font-size: clamp(8px, 0.72vw, 11px);
  }

  .permits-lower,
  .plan-grid,
  .inspection-grid {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .permits-chart-panel,
  .metrics-panel,
  body[data-page='plans'] .plan-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual.wide,
  body[data-page='inspections'] .inspection-grid .visual:not(.wide) {
    height: auto;
    min-height: 0;
  }

  .permits-chart {
    height: calc(100% - 38px);
    min-height: 0;
  }
  .metrics-panel .metric-heading {
    height: 45px;
    margin-bottom: 6px;
  }
  .metrics-panel .metric-list {
    height: calc(100% - 51px);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 7px;
    align-content: stretch;
  }
  .metrics-panel .metric-card {
    height: auto;
    min-height: 0;
    padding: 4px 8px;
    grid-template-columns: 39px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    row-gap: 0;
  }
  .metric-card .mini-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .metric-card strong {
    font-size: clamp(13px, 1.2vw, 19px);
  }
  .metric-card p {
    font-size: clamp(7px, 0.56vw, 10px);
  }

  body[data-page='plans'],
  body[data-page='inspections'] {
    overflow: hidden;
  }
  body[data-page='plans'] .plan-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  body[data-page='plans'] .plan-grid .visual:nth-child(-n + 3) {
    grid-column: span 2;
  }
  body[data-page='plans'] .plan-grid .visual:nth-child(4),
  body[data-page='plans'] .plan-grid .visual:nth-child(5) {
    grid-column: span 3;
  }
  body[data-page='plans'] .plan-grid .visual h2 {
    min-height: 50px;
    padding: 8px 10px;
    font-size: clamp(10px, 1.1vw, 13px);
    line-height: 1.15;
  }
  body[data-page='plans'] .plan-grid .chart.medium,
  body[data-page='plans'] .plan-grid .donut-wrap {
    height: calc(100% - 72px);
    min-height: 0;
  }

  body[data-page='inspections'] .inspection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  body[data-page='inspections'] .inspection-grid .chart.medium {
    height: calc(100% - 67px);
    min-height: 0;
  }
  body[data-page='inspections'] .inspection-grid .chart.short,
  body[data-page='inspections'] .inspection-grid .donut-wrap {
    height: calc(100% - 47px);
    min-height: 0;
  }
  .donut-wrap {
    gap: 8px;
  }
  .donut-stage {
    width: min(210px, 46%);
  }
  .donut-legend {
    gap: 5px;
    font-size: 9px;
    min-width: 0;
  }
  .donut-legend span {
    grid-template-columns: 8px minmax(42px, 1fr) auto auto;
    gap: 3px;
  }
  .donut-legend b,
  .donut-legend small {
    font-size: 8px;
  }
  .donut-legend small {
    min-width: 30px;
  }
}

/* Give the desktop dashboard more breathing room without affecting compact views. */
@media (min-width: 1200px) and (min-height: 600px) {
  :root {
    --topbar-h: 48px;
    --page-head-h: 52px;
    --header-h: var(--page-head-h);
    --dash-column-gap: 16px;
    --dash-section-gap: 14px;
    --dash-content-gap: 3px;
    --dash-tile-gap: 8px;
  }

  .report-header {
    padding: 4px 18px 3px;
    align-items: start;
  }
  .seal-wrap img {
    width: 38px;
    height: 38px;
  }
  .brand-copy strong {
    font-size: 15px;
  }
  .brand-copy span {
    font-size: 10px;
  }
  .report-name h1 {
    font-size: 22px;
    margin-bottom: 1px;
  }
  .report-name p {
    font-size: 12px;
  }
  .filters {
    gap: 18px;
    align-items: flex-end;
  }
  .filters label {
    gap: 4px;
  }
  .filters .date-pair {
    gap: 10px;
  }
  .filters button {
    margin-left: -6px;
  }

  main,
  body[data-page='permits'] main,
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    padding: 15px 18px 4px;
  }

  .kpis {
    flex-basis: 54px;
    height: 54px;
    gap: var(--dash-column-gap);
    margin-bottom: var(--dash-section-gap);
  }
  .card {
    height: 54px;
    grid-template-columns: 50px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    row-gap: var(--dash-content-gap);
    box-shadow: 0 4px 14px rgba(15, 27, 51, 0.055);
  }
  .card strong,
  .card p {
    align-self: auto;
    line-height: 1.05;
  }
  .card-icon {
    width: 32px;
    height: 32px;
    margin-left: 9px;
  }
  .card-icon .ui-icon {
    width: 19px;
    height: 19px;
  }

  .visual-grid.permits-lower {
    grid-template-columns: minmax(0, calc(75% - 4px)) minmax(0, calc(25% - 12px));
    gap: var(--dash-column-gap);
  }
  .plan-grid,
  .inspection-grid {
    gap: var(--dash-column-gap);
  }
  .visual {
    box-shadow: 0 5px 18px rgba(15, 27, 51, 0.055);
  }

  .metrics-panel {
    padding: 9px;
  }
  .metrics-panel .metric-heading {
    height: 44px;
    margin: -9px -9px 6px;
    padding: 8px 16px;
  }
  .metrics-panel .metric-list {
    height: calc(100% - 50px);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }
  .metrics-panel .metric-card {
    padding: 5px 13px;
    grid-template-columns: 50px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    row-gap: var(--dash-content-gap);
    column-gap: 9px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(15, 27, 51, 0.05);
  }
  .metric-card strong,
  .metric-card p {
    align-self: auto;
    line-height: 1.05;
  }
  .metric-card .mini-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .mini-icon .ui-icon {
    width: 21px;
    height: 21px;
  }
  .metric-card strong {
    font-size: clamp(18px, 1.3vw, 23px);
  }
  .metric-card p {
    font-size: 9px;
  }
}

/* Plan Review alignment: mirror the Building Metrics canvas rhythm without
   changing the Plan Review palette or chart colors. */
@media (min-width: 801px) {
  body[data-page='permits'] {
    --page-head-h: 72px;
    --header-h: var(--page-head-h);
  }

  body[data-page='permits'] .report-header {
    height: var(--page-head-h);
    padding-top: 8px;
    padding-right: 18px;
    padding-bottom: 0;
    align-items: start;
  }

  body[data-page='permits'] .filters {
    align-self: end;
    margin-bottom: 0;
  }

  body[data-page='permits'] main {
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  body[data-page='permits'] #dashboardContent {
    height: 100%;
    overflow: hidden;
  }

  body[data-page='permits'] .kpis {
    flex: 0 0 62px;
  }

  body[data-page='permits'] .permits-lower {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  body[data-page='permits'] .metrics-panel .metric-card {
    row-gap: 7px;
  }

  body[data-page='permits'] .metrics-panel .metric-card strong {
    line-height: 1.1;
  }

  body[data-page='permits'] .metrics-panel .metric-card p {
    line-height: 1.15;
  }

  body[data-page='plans'] {
    --page-head-h: 72px;
    --header-h: var(--page-head-h);
  }

  body[data-page='plans'] .report-header {
    height: var(--page-head-h);
    padding-top: 8px;
    padding-right: 33px;
    padding-bottom: 0;
    align-items: flex-start;
    justify-content: space-between;
  }

  body[data-page='plans'] .filters {
    align-self: flex-start;
    margin-left: auto;
    margin-top: 0;
    margin-bottom: 0;
  }
}

@media (min-width: 801px) {
  body[data-page='inspections'] {
    overflow-y: auto;
  }

  body[data-page='inspections'] .filters {
    gap: 12px;
  }

  body[data-page='inspections'] .filters .date-pair {
    gap: 8px;
  }

  body[data-page='inspections'] .filters button {
    margin-left: 0;
  }

  body[data-page='inspections'] .report-header {
    padding-right: 33px;
  }

  body[data-page='inspections'] main {
    height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    min-height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    padding-bottom: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body[data-page='inspections'] #dashboardContent {
    height: auto;
    overflow: visible;
  }

  body[data-page='inspections'] .kpis {
    flex: none;
  }

  body[data-page='inspections'] .inspection-grid {
    flex: none;
    height: auto;
    min-height: 0;
    overflow: visible;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Keep the summary chart compact, matching the Zoning dashboard panel scale. */
    grid-template-rows: clamp(320px, 18vw, 350px) 440px;
    column-gap: 14px;
    row-gap: 14px;
  }

  body[data-page='inspections'] .inspection-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual.wide,
  body[data-page='inspections'] .inspection-grid .visual:not(.wide) {
    height: 100%;
    min-height: 0;
  }

  body[data-page='inspections'] .inspection-grid .chart.medium,
  body[data-page='inspections'] .inspection-grid .chart.short,
  body[data-page='inspections'] .inspection-grid .donut-wrap {
    height: calc(100% - 62px);
    min-height: 0;
  }

  body[data-page='plans'] {
    overflow-y: auto;
  }

  body[data-page='plans'] main {
    height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    min-height: calc(100vh - var(--topbar-h) - var(--page-head-h));
    padding-bottom: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body[data-page='plans'] #dashboardContent {
    height: auto;
    overflow: visible;
  }

  body[data-page='plans'] .card p {
    padding-right: 6px;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.08;
  }

  body[data-page='plans'] .plan-grid {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: none;
    overflow: visible;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: clamp(320px, 28vw, 400px);
    column-gap: 12px;
    row-gap: 12px;
    align-items: stretch;
  }

  body[data-page='plans'] .plan-grid .visual {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
  }

  body[data-page='plans'] .plan-grid .visual:nth-child(-n + 4) {
    grid-column: auto;
  }

  body[data-page='plans'] .plan-grid .visual:nth-child(5) {
    grid-column: 1/-1;
    min-height: clamp(360px, 32vw, 470px);
  }

  body[data-page='plans'] .plan-grid .chart.medium,
  body[data-page='plans'] .plan-grid .donut-wrap {
    height: calc(100% - 62px);
    min-height: 0;
  }
}

@media (min-width: 1200px) and (min-height: 600px) {
  body[data-page='permits'] .kpis {
    flex-basis: 54px;
  }

  body[data-page='permits'] .permits-lower {
    height: auto;
    min-height: 0;
  }

  body[data-page='plans'] .plan-grid {
    column-gap: var(--dash-column-gap, 16px);
    row-gap: var(--dash-section-gap, 14px);
  }
}

@media (min-width: 1200px) {
  body[data-page='inspections'] {
    --page-head-h: 72px;
    --header-h: var(--page-head-h);
  }

  body[data-page='inspections'] .report-header {
    height: var(--page-head-h);
    padding: 8px 33px 0 18px;
    align-items: start;
  }

  body[data-page='inspections'] .filters {
    gap: 18px;
    align-self: end;
    margin-bottom: 0;
  }

  body[data-page='inspections'] #categoryLabel,
  body[data-page='inspections'] #tradeLabel {
    width: 150px;
  }

  body[data-page='inspections'] #category,
  body[data-page='inspections'] #trade {
    width: 100%;
    min-width: 150px;
  }

  body[data-page='inspections'] .filters .date-pair {
    gap: 10px;
  }

  body[data-page='inspections'] .date-pair input {
    width: 135px;
    min-width: 135px;
  }

  body[data-page='inspections'] .filters button {
    min-width: 91px;
    margin-left: -6px;
  }
}

@media (min-width: 801px) and (max-width: 1199px) {
  body[data-page='inspections'] .report-header {
    padding-right: 65px;
  }
}

/* Match the desktop typography scale used by iPZB.Zoning.Dashboard. */
@media (min-width: 801px) {
  :root {
    --side: 190px;
  }

  .brand-copy strong {
    font-size: 16.5px;
  }
  .brand-copy span {
    font-size: 12.5px;
  }
  .nav {
    font-size: 15.5px;
  }

  .report-name h1 {
    font-size: 24px;
    font-weight: 800;
  }
  .report-name p {
    font-size: 15px;
    font-weight: 500;
  }

  .filters label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    gap: 6px;
  }
  .filters select,
  .filters input,
  .date-pair input,
  .filters button,
  .filters button span {
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 600;
  }
  .filters select,
  .filters input,
  .filters button {
    height: 38px;
  }
  .filters select {
    min-width: 150px;
  }
  .date-pair input {
    width: 135px;
    min-width: 135px;
  }
  .filters button {
    min-width: 91px;
  }

  .kpis {
    flex-basis: 66px;
    height: 66px;
  }
  .card {
    height: 66px;
  }
  .card strong {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
  }
  .card p {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    line-height: normal;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .visual h2,
  body[data-page='plans'] .plan-grid .visual h2,
  .metrics-panel .metric-heading {
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 800;
  }
  .legend {
    font-size: 12.5px;
    font-weight: 600;
    gap: 9px;
  }
  .chart-label {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
  }
  .bar-value-small,
  .combined-value-label,
  .chart text[fill='#fff'] {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
  }

  .metric-card strong {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
  }
  .metric-card p {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.15;
    white-space: normal;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .metric-card:first-child p {
    display: block;
    overflow: visible;
    white-space: nowrap;
    font-size: 12.5px;
    line-height: normal;
    -webkit-line-clamp: unset;
  }
  .commercial-value-label {
    fill: var(--purple);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 800;
  }
  .donut-legend {
    font-size: 12.5px;
    font-weight: 600;
  }
  .donut-legend b,
  .donut-legend small {
    font-family: var(--font-sans);
    font-size: 12px;
  }

  /* Inspection dashboard uses the same Zoning typography scale as every Building page. */
  body[data-page='inspections'] .card strong {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 800;
  }
  body[data-page='inspections'] .card p {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    line-height: normal;
  }
  body[data-page='inspections'] .visual h2 {
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 800;
  }
  body[data-page='inspections'] .legend,
  body[data-page='inspections'] .donut-legend {
    font-size: 12.5px;
    font-weight: 600;
  }
  body[data-page='inspections'] .chart-label {
    font-size: 12px;
    font-weight: 500;
  }
  body[data-page='inspections'] .bar-value-small,
  body[data-page='inspections'] .combined-value-label,
  body[data-page='inspections'] .chart text[fill='#fff'] {
    font-size: 12px;
    font-weight: 700;
  }
  body[data-page='inspections'] .donut-legend b,
  body[data-page='inspections'] .donut-legend small {
    font-size: 12px;
  }
  body[data-page='inspections'] .donut-data-label b,
  body[data-page='inspections'] .donut-data-label small {
    font-family: var(--font-sans);
    font-size: 12px;
  }
  body[data-page='inspections'] #tradeChart .combined-value-label {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
  }
}

/* Archived Power BI experiment; the previous navy-and-gold version is active. */
@media (min-width: 99999px) {
  :root {
    --pbi-teal: #08aca9;
    --pbi-orange: #ff7421;
    --pbi-navy: #123653;
    --pbi-blue: #0d69bf;
    --pbi-green: #12b765;
    --pbi-cyan: #65cad2;
    --pbi-line: #c8cdd1;
    --side: 104px;
    --topbar-h: 0px;
    --page-head-h: 78px;
    --header-h: var(--page-head-h);
  }

  html,
  body {
    background: #fff;
  }

  .sidebar {
    left: 6px;
    top: 8px;
    width: var(--side);
    height: calc(100vh - 8px);
    padding: 0;
    background: var(--pbi-teal);
    border: 0;
    box-shadow: none;
  }
  .seal-wrap {
    position: static;
    inset: auto;
    width: 100%;
    height: 76px;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--pbi-teal);
    border: 0;
  }
  .seal-wrap img {
    width: 66px;
    height: 66px;
    filter: none;
  }
  .brand-copy {
    display: none;
  }
  .sidebar nav {
    width: 100%;
    margin: 0;
    padding: 0 4px;
    display: grid;
    gap: 5px;
  }
  .nav {
    width: 100%;
    height: 31px;
    min-height: 31px;
    padding: 0 8px;
    gap: 4px;
    border: 0;
    border-left: 0;
    border-radius: 3px;
    background: var(--pbi-orange);
    color: #fff;
    font-size: 9px;
    box-shadow: none;
  }
  .nav.active,
  .nav.active:hover {
    padding-left: 8px;
    background: #fff;
    color: #0e5187;
    border-left: 0;
  }
  .nav.active span {
    color: #0e5187;
  }
  .nav:hover {
    background: #f16517;
    color: #fff;
  }
  .side-note {
    color: #fff;
    padding: 10px 5px;
    font-size: 8px;
  }
  .pulse {
    background: #fff;
    box-shadow: none;
  }

  .report-header {
    left: calc(6px + var(--side));
    right: 6px;
    top: 8px;
    width: auto;
    height: var(--page-head-h);
    padding: 10px 12px 8px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: start;
    gap: 12px;
    background: var(--pbi-teal);
    border: 0;
    box-shadow: none;
    color: #fff;
  }
  .report-name h1 {
    margin: 0 0 5px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
  }
  .report-name p {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
  }
  .filters {
    margin: 0;
    gap: 9px;
    align-items: end;
    justify-content: flex-end;
  }
  .filters label {
    gap: 4px;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }
  .filters select,
  .filters input {
    height: 34px;
    min-width: 138px;
    padding: 0 9px;
    border: 1px solid #d7d7d7;
    border-radius: 6px;
    color: #555;
    font-size: 10px;
    font-weight: 500;
    box-shadow: none;
  }
  .date-pair {
    gap: 4px;
  }
  .date-pair input {
    width: 83px;
    min-width: 83px;
    padding-left: 7px;
    padding-right: 3px;
    font-size: 8px;
  }
  .filters button {
    height: 34px;
    min-width: 64px;
    padding: 0 8px;
    border: 1px solid #d7d7d7;
    border-radius: 6px;
    color: #222;
    font-size: 9px;
    box-shadow: none;
  }
  .filters button span {
    margin-left: 4px;
    font-size: 9px;
  }

  main,
  body[data-page='permits'] main,
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    left: calc(6px + var(--side));
    right: 6px;
    top: calc(8px + var(--page-head-h));
    width: auto;
    height: calc(100vh - 8px - var(--page-head-h));
    padding: 9px 8px 8px;
    background: #fafafa;
    overflow: hidden;
  }

  .kpis {
    flex: 0 0 63px;
    height: 63px;
    gap: 13px;
    margin-bottom: 12px;
  }
  .card {
    height: 63px;
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-rows: 35px 22px;
    border: 1px solid var(--pbi-line);
    border-radius: 6px;
    box-shadow: none;
  }
  .card-icon {
    width: 34px;
    height: 34px;
    margin-left: 10px;
    border-radius: 9px;
    font-size: 17px;
  }
  .card strong {
    color: var(--pbi-blue) !important;
    font-family: var(--font-sans);
    font-size: clamp(15px, 1.8vw, 20px);
    font-weight: 800;
  }
  .card:nth-child(2) strong {
    color: #f2a866 !important;
  }
  .card:nth-child(3) strong {
    color: var(--pbi-green) !important;
  }
  .card:nth-child(4) strong {
    color: var(--pbi-cyan) !important;
  }
  .card:nth-child(2) .card-icon {
    background: #fff0e5;
    color: #f2a866;
  }
  .card:nth-child(3) .card-icon {
    background: #e3f7ea;
    color: var(--pbi-green);
  }
  .card:nth-child(4) .card-icon {
    background: #ddf4f5;
    color: #39b7c2;
  }
  .card p {
    color: var(--pbi-navy);
    font-size: clamp(7px, 0.65vw, 9px);
    font-weight: 700;
  }

  .visual-grid.permits-lower {
    grid-template-columns: minmax(0, 74fr) minmax(210px, 26fr);
    gap: 9px;
  }
  .visual {
    padding: 7px;
    border: 1px solid var(--pbi-line);
    border-radius: 6px;
    box-shadow: none;
    background: #fff;
  }
  .visual h2,
  body[data-page='plans'] .plan-grid .visual h2 {
    height: auto;
    min-height: 0;
    margin: 0 0 5px;
    padding: 0;
    display: block;
    background: transparent;
    color: var(--pbi-navy);
    border: 0;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
  }
  .legend {
    margin: 0 0 4px;
    color: #5d6c78;
    font-size: 7px;
    gap: 3px;
  }
  .legend i {
    width: 6px;
    height: 6px;
  }
  .permits-chart {
    height: calc(100% - 31px);
  }

  .metrics-panel {
    padding: 7px;
  }
  .metrics-panel .metric-heading {
    height: 54px;
    margin: 0 0 6px;
    padding: 2px 9px 7px;
    background: #fff;
    color: #173c81;
    border: 0;
    font-family: var(--font-sans);
    font-size: 20px;
    gap: 10px;
  }
  .metrics-panel .metric-heading span {
    color: #4966c2;
    font-size: 31px;
  }
  .metrics-panel .metric-list {
    height: calc(100% - 60px);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }
  .metrics-panel .metric-card {
    height: auto;
    min-height: 0;
    padding: 5px 8px;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    border: 1px solid var(--pbi-line);
    border-radius: 7px;
    box-shadow: none;
  }
  .metric-card .mini-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }
  .metric-card strong {
    font-family: var(--font-sans);
    font-size: clamp(13px, 1.5vw, 20px);
    line-height: 1.05;
  }
  .metric-card p {
    color: var(--pbi-navy);
    font-size: clamp(7px, 0.6vw, 9px);
  }

  .plan-grid,
  .inspection-grid {
    gap: 9px;
  }
  .donut-wrap {
    gap: 8px;
  }
}

/* Robert's iPZB.Zoning.Dashboard typography parity.
   Typography only: no dimensions, positioning, colors, data, or behavior. */
:root {
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

html,
body,
button,
select,
input {
  font-family: var(--font-sans);
}

.brand-copy strong {
  font-family: var(--font-sans);
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: normal;
}

.brand-copy span {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: normal;
}

.nav {
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: normal;
}

.nav.active {
  font-weight: 700;
}

.report-name h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  line-height: normal;
  letter-spacing: normal;
}

.report-name p {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: normal;
  letter-spacing: normal;
}

/* WCAG 2.2 AA: maintain strong subtitle contrast on the light report canvas. */
.report-header .report-name #pageSubtitle {
  color: #43566d;
}

/* WCAG 2.2 AA: all filter labels use the same accessible secondary text. */
.report-header .filters label {
  color: #43566d;
}

/* WCAG 2.2 AA: donut percentages are non-large text on white panels. */
.donut-legend small {
  color: #43566d;
}

.filters label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  line-height: normal;
  letter-spacing: 0.6px;
}

.filters select,
.filters input,
.date-pair input {
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: normal;
}

.filters button,
.filters button span {
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

.card strong {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  /* Playfair Display extends below a 1em line box in Chromium.  The tile's
     inherited overflow clipping therefore cut off the bottoms of digits. */
  line-height: 1.2;
  letter-spacing: normal;
}

.card p {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

.visual h2,
body[data-page='plans'] .plan-grid .visual h2,
body[data-page='inspections'] .inspection-grid .visual h2,
.metrics-panel .metric-heading {
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 800;
  line-height: normal;
  letter-spacing: 0.2px;
}

.legend {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

.chart-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

.bar-value-small,
.combined-value-label,
.chart text[fill='#fff'] {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='plans'] .bar-value-small,
body[data-page='plans'] .combined-value-label,
body[data-page='plans'] .chart text[fill='#fff'] {
  font-size: 11px;
  font-weight: 700;
}

body[data-page='plans'] .plan-grid .chart rect[data-period] {
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    filter 0.15s ease;
}

body[data-page='plans'] .plan-grid .chart text {
  pointer-events: none;
}

body[data-page='plans'] .plan-grid .chart.has-selection rect[data-period]:not(.is-selected) {
  /* Keep non-selected periods visible as disabled values. */
  display: inline !important;
  visibility: visible !important;
  fill: #b5c1d2 !important;
  opacity: 1 !important;
  filter: none !important;
}

body[data-page='plans'] .plan-grid .chart.has-selection rect[data-period].is-selected {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
  filter: none !important;
}

body[data-page='plans'] .interactive-card {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}
body[data-page='plans'] .interactive-card:hover,
body[data-page='plans'] .interactive-card:focus-visible {
  border-color: #2f63a3;
  box-shadow: 0 0 0 2px rgba(47, 99, 163, 0.18);
  outline: none;
  transform: translateY(-1px);
}
body[data-page='plans'] .interactive-card.is-selected {
  border-color: #174f92;
  box-shadow: 0 0 0 3px rgba(23, 79, 146, 0.22);
}
body[data-page='plans'] .interactive-card.is-filtered-out,
body[data-page='plans'] .plan-grid .visual.is-filtered-out {
  opacity: 0.38;
}

body[data-page='permits'] .interactive-card {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}
body[data-page='permits'] .interactive-card:hover,
body[data-page='permits'] .interactive-card:focus-visible {
  border-color: #2f63a3;
  box-shadow: 0 0 0 2px rgba(47, 99, 163, 0.18);
  outline: none;
  transform: translateY(-1px);
}
body[data-page='permits'] .interactive-card.is-selected {
  border-color: #174f92;
  box-shadow: 0 0 0 3px rgba(23, 79, 146, 0.22);
}
body[data-page='permits'] .interactive-card.is-filtered-out {
  opacity: 0.38;
}
body[data-page='inspections'] .interactive-card {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}
body[data-page='inspections'] .interactive-card:hover,
body[data-page='inspections'] .interactive-card:focus-visible {
  border-color: #2f63a3;
  box-shadow: 0 0 0 2px rgba(47, 99, 163, 0.18);
  outline: none;
  transform: translateY(-1px);
}
body[data-page='inspections'] .interactive-card.is-selected {
  border-color: #174f92;
  box-shadow: 0 0 0 3px rgba(23, 79, 146, 0.22);
}
body[data-page='inspections'] .interactive-card.is-filtered-out {
  opacity: 0.38;
}

body[data-page='permits'] .interactive-metric-card {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}
body[data-page='permits'] .interactive-metric-card:hover,
body[data-page='permits'] .interactive-metric-card:focus-visible {
  border-color: #2f63a3;
  box-shadow: 0 0 0 2px rgba(47, 99, 163, 0.18);
  outline: none;
  transform: translateY(-1px);
}
body[data-page='permits'] .interactive-metric-card.is-selected {
  border-color: #174f92;
  box-shadow: 0 0 0 3px rgba(23, 79, 146, 0.22);
}
body[data-page='permits'] .interactive-metric-card.is-filtered-out {
  opacity: 0.38;
}

body[data-page='plans'] .plan-grid .chart.has-selection text[data-period]:not(.is-selected) {
  opacity: 0.58;
}

body[data-page='plans'] .plan-grid .chart .axis,
body[data-page='plans'] .plan-grid .chart .chart-label[x='2'] {
  display: none;
}

body[data-page='plans'] #planDonut [data-name] {
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    filter 0.15s ease;
}

body[data-page='plans'] #planDonut [data-name].is-selected {
  opacity: 1;
  filter: none;
}

body[data-page='plans'] #planDonut .donut {
  cursor: pointer;
}

body[data-page='plans'] #planDonut .donut-legend {
  width: 250px;
  min-width: 250px;
  gap: 9px;
}

body[data-page='plans'] #planDonut .donut-legend span {
  grid-template-columns: 10px 112px 68px 52px;
  column-gap: 6px;
  width: 100%;
}

body[data-page='plans'] #planDonut .donut-legend em {
  white-space: nowrap;
  text-align: left;
}

body[data-page='plans'] #planDonut .donut-legend b,
body[data-page='plans'] #planDonut .donut-legend small {
  min-width: 0;
  white-space: nowrap;
}

body[data-page='plans'] #planDonut .donut-legend b {
  text-align: left;
}
body[data-page='plans'] #planDonut .donut-legend small {
  text-align: right;
}

@media (min-width: 801px) {
  body[data-page='inspections'] #tradeDonut {
    justify-content: flex-start;
    gap: 38px;
    padding-left: clamp(34px, 4vw, 68px);
    padding-right: 20px;
  }

  body[data-page='inspections'] #tradeDonut .donut-stage {
    width: min(240px, 42%);
  }

  body[data-page='inspections'] #tradeDonut .donut-legend {
    width: 290px;
    min-width: 290px;
    gap: 9px;
  }

  body[data-page='inspections'] #tradeDonut .donut-legend span {
    width: 100%;
    grid-template-columns: 10px 94px 80px 56px;
    column-gap: 7px;
  }

  body[data-page='inspections'] #tradeDonut .donut-legend em,
  body[data-page='inspections'] #tradeDonut .donut-legend b,
  body[data-page='inspections'] #tradeDonut .donut-legend small {
    min-width: 0;
    white-space: nowrap;
  }

  body[data-page='inspections'] #tradeDonut .donut-legend em,
  body[data-page='inspections'] #tradeDonut .donut-legend b {
    text-align: left;
  }
  body[data-page='inspections'] #tradeDonut .donut-legend small {
    text-align: right;
  }
}

.commercial-value-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 800;
  line-height: normal;
  letter-spacing: normal;
}

.metric-card strong {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: normal;
}

.metric-card p {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

.metric-card:first-child p {
  font-size: 13px;
}

.donut-legend {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
}

.donut-legend em {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
}

.donut-legend b {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
}

.donut-legend small {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
}

.donut-data-label b,
.donut-data-label small {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
}

/* The inspection page has page-scoped chart rules above. Keep those rules
   aligned with the same Robert dashboard typography tokens. */
body[data-page='inspections'] .legend,
body[data-page='inspections'] .donut-legend {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='inspections'] .chart-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='inspections'] .bar-value-small,
body[data-page='inspections'] .combined-value-label,
body[data-page='inspections'] .chart text[fill='#fff'] {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='inspections'] .donut-legend em {
  font-size: 13px;
  font-weight: 700;
}

body[data-page='inspections'] .donut-legend b {
  font-size: 13px;
  font-weight: 800;
}

body[data-page='inspections'] .donut-legend small {
  font-size: 12.5px;
  font-weight: 600;
}

body[data-page='inspections'] .donut-data-label b,
body[data-page='inspections'] .donut-data-label small {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
}

body[data-page='inspections'] #tradeChart .axis,
body[data-page='inspections'] #tradeChart .chart-label[x='2'] {
  display: none;
}

body[data-page='inspections'] #tradeChart rect[data-period],
body[data-page='inspections'] #tradeDonut .donut,
body[data-page='inspections'] #tradeDonut .donut-legend [data-name] {
  cursor: pointer;
}

body[data-page='inspections'] #tradeChart rect[data-period],
body[data-page='inspections'] #tradeDonut .donut-legend [data-name],
body[data-page='inspections'] #inspectionCategory .permit-bar-segment {
  transition:
    filter 0.15s ease,
    opacity 0.15s ease;
}

body[data-page='inspections'] #tradeChart rect[data-period]:hover,
body[data-page='inspections'] #tradeDonut .donut-legend [data-name]:hover,
body[data-page='inspections'] #inspectionCategory .permit-bar-segment:hover {
  filter: saturate(1.15) brightness(0.94);
}

/* Keep the original category colors visible while emphasizing the selected segment. */
body[data-page='inspections'] #tradeChart.has-selection rect[data-series]:not(.is-selected) {
  /* Do not remove other trades: retain their shape as disabled gray bars. */
  display: inline !important;
  visibility: visible !important;
  fill: #b5c1d2 !important;
  opacity: 1 !important;
  filter: none !important;
}

body[data-page='inspections']
  #inspectionCategory.has-selection
  .permit-bar-segment:not(.is-selected) {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 0.48 !important;
  filter: none !important;
}

body[data-page='inspections'] #tradeChart.has-selection rect[data-series].is-selected {
  display: inline !important;
  visibility: visible !important;
  opacity: 1;
  filter: none;
}

body[data-page='inspections'] #inspectionCategory.has-selection .permit-bar-segment.is-selected {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1;
  filter: none;
}

.donut-wrap.has-selection [data-name].is-disabled {
  opacity: 0.62;
}

.donut-wrap.has-selection [data-name].is-selected {
  opacity: 1;
}

/* Group horizontal category charts by year, with clean month-only row labels. */
body[data-page='permits'] .permit-year-group,
body[data-page='inspections'] .permit-year-group {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: stretch;
  column-gap: 8px;
}

body[data-page='permits'] .permit-year-group + .permit-year-group,
body[data-page='inspections'] .permit-year-group + .permit-year-group {
  border-top: 1px solid #d7e0eb;
  padding-top: 8px;
}

body[data-page='permits'] .permit-year-label,
body[data-page='inspections'] .permit-year-label {
  align-self: center;
  justify-self: center;
  color: #52677f;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  writing-mode: horizontal-tb;
  transform: none;
  white-space: nowrap;
  letter-spacing: normal;
}

body[data-page='permits'] .permit-year-rows,
body[data-page='inspections'] .permit-year-rows {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

body[data-page='permits'] .permit-year-rows > .permit-horizontal-row,
body[data-page='inspections'] .permit-year-rows > .permit-horizontal-row {
  grid-template-columns: 38px minmax(180px, 1fr) 72px;
}

/* Permit chart: keep the original month captions and match KPI label typography. */
body[data-page='permits'] .permits-chart .chart-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='permits'] .permits-chart .chart-label[x='2'] {
  display: none;
}

body[data-page='permits'] .permits-chart text[fill='#fff'],
body[data-page='permits'] .permits-chart .commercial-value-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='permits'] .permits-chart rect {
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    filter 0.15s ease;
}

body[data-page='permits'] .permits-chart text {
  pointer-events: none;
}

body[data-page='permits'] .permits-chart.has-selection rect:not(.is-selected) {
  /* Preserve every month/category while marking non-selected data as disabled. */
  display: inline !important;
  visibility: visible !important;
  fill: #b5c1d2 !important;
  opacity: 1 !important;
  filter: none !important;
}

body[data-page='permits'] .permits-chart.has-selection rect.is-selected {
  display: inline !important;
  visibility: visible !important;
  opacity: 1;
  filter: none;
}

body[data-page='permits'] .permits-chart .bar-total-label {
  fill: #24364b;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2px;
  stroke-linejoin: round;
}

body[data-page='permits'] .permits-chart.chart-many-periods .chart-label:not([x='2']) {
  font-size: 13px;
}

body[data-page='permits']
  .permits-chart.chart-many-periods
  .chart-label:not([x='2']):not(.year-axis-label) {
  font-stretch: condensed;
  letter-spacing: -0.75px;
}

body[data-page='permits'] .permits-chart.chart-many-periods .bar-total-label {
  font-size: 8px;
}

body[data-page='permits'] .permits-chart .year-axis-label {
  fill: #24364b;
  font-size: 13px !important;
  font-weight: 700;
}

body[data-page='permits'] .permits-chart .year-divider {
  stroke: #cbd5e1;
  stroke-width: 1.25px;
}

/* Permit filters follow the Zoning dashboard: a left-aligned row below the title. */
@media (min-width: 801px) {
  body[data-page='permits'] {
    --page-head-h: 140px;
    --header-h: var(--page-head-h);
  }

  body[data-page='permits'] .report-header {
    display: block;
    height: var(--page-head-h);
    padding: 8px 18px 0;
  }

  body[data-page='permits'] .filters {
    margin-top: 18px;
    justify-content: flex-start;
    align-items: flex-end;
    align-self: auto;
    gap: 14px;
  }

  body[data-page='permits'] .filters button {
    margin-left: 0;
  }

  /* Plan Review uses the same left-aligned title/filter structure as Permits. */
  body[data-page='plans'] {
    --page-head-h: 140px;
    --header-h: var(--page-head-h);
  }

  body[data-page='plans'] .report-header {
    display: block;
    height: var(--page-head-h);
    padding: 8px 18px 0;
  }

  body[data-page='plans'] .filters {
    margin: 18px 0 0;
    justify-content: flex-start;
    align-items: flex-end;
    align-self: auto;
    gap: 14px;
  }

  body[data-page='plans'] .filters button {
    margin-left: 0;
  }

  /* Inspections follows the same left-aligned filter row. */
  body[data-page='inspections'] {
    --page-head-h: 140px;
    --header-h: var(--page-head-h);
  }

  body[data-page='inspections'] .report-header {
    display: block;
    height: var(--page-head-h);
    padding: 8px 18px 0;
  }

  body[data-page='inspections'] .filters {
    margin: 18px 0 0;
    justify-content: flex-start;
    align-items: flex-end;
    align-self: auto;
    gap: 14px;
  }

  body[data-page='inspections'] .filters button {
    margin-left: 0;
  }
}

/* Inspections by Category uses the same horizontal chart treatment as Permits. */
body[data-page='inspections'] .permit-horizontal-chart {
  height: 100%;
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
}

body[data-page='inspections'] .permit-horizontal-row {
  display: grid;
  width: 100%;
  grid-template-columns: 58px minmax(180px, 1fr) 72px;
  align-items: center;
  gap: 12px;
  min-height: 18px;
}

body[data-page='inspections'] .permit-period,
body[data-page='inspections'] .permit-row-total {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
}

body[data-page='inspections'] .permit-period {
  color: #52677f;
  text-align: right;
}

body[data-page='inspections'] .permit-row-total {
  color: #24364b;
  text-align: left;
}

body[data-page='inspections'] .permit-bar-track {
  width: 100%;
  height: 18px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 4px;
  background: #edf1f6;
}

body[data-page='inspections'] .permit-bar-segment {
  display: block;
  min-width: 2px;
  height: 100%;
  cursor: default;
}

body[data-page='inspections'] .permit-horizontal-chart--compact {
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 6px;
}

body[data-page='inspections'] .permit-horizontal-chart--compact .permit-horizontal-row {
  min-height: 16px;
}

body[data-page='inspections'] .permit-horizontal-chart--compact .permit-bar-track {
  height: 14px;
}

body[data-page='inspections'] .permit-horizontal-chart--dense {
  gap: 3px;
  padding-top: 4px;
  padding-bottom: 4px;
}

body[data-page='inspections'] .permit-horizontal-chart--dense .permit-horizontal-row {
  min-height: 13px;
}

body[data-page='inspections'] .permit-horizontal-chart--dense .permit-bar-track {
  height: 10px;
}

body[data-page='inspections'] .permit-horizontal-chart--dense .permit-period,
body[data-page='inspections'] .permit-horizontal-chart--dense .permit-row-total {
  font-size: 11px;
}

@media (min-width: 801px) {
  body[data-page='inspections'] .inspection-grid {
    grid-template-rows: 400px 650px;
    row-gap: 12px;
  }

  body[data-page='inspections'] .inspection-grid .visual.wide {
    height: 650px;
    min-height: 650px;
    overflow: hidden;
  }

  body[data-page='inspections'] #inspectionCategory {
    height: 560px !important;
    min-height: 0 !important;
    max-height: 560px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 4px 10px 0;
    scrollbar-width: thin;
    scrollbar-color: #8fa0b5 transparent;
    scrollbar-gutter: stable;
  }

  body[data-page='inspections'] #inspectionCategory::-webkit-scrollbar {
    width: 7px;
  }

  body[data-page='inspections'] #inspectionCategory::-webkit-scrollbar-track {
    background: transparent;
  }

  body[data-page='inspections'] #inspectionCategory::-webkit-scrollbar-thumb {
    background: #8fa0b5;
    border-radius: 999px;
  }

  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart {
    height: auto;
    min-height: var(--chart-content-height, 100%);
  }

  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart--compact {
    min-height: var(--chart-content-height, 100%);
  }

  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart--dense {
    min-height: var(--chart-content-height, 100%);
  }

  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart,
  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart--compact,
  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart--dense {
    gap: 7px;
    padding: 10px 14px 14px;
  }

  body[data-page='inspections'] #inspectionCategory .permit-horizontal-row,
  body[data-page='inspections']
    #inspectionCategory
    .permit-horizontal-chart--compact
    .permit-horizontal-row,
  body[data-page='inspections']
    #inspectionCategory
    .permit-horizontal-chart--dense
    .permit-horizontal-row {
    min-height: 22px;
  }

  body[data-page='inspections'] #inspectionCategory .permit-bar-track,
  body[data-page='inspections']
    #inspectionCategory
    .permit-horizontal-chart--compact
    .permit-bar-track,
  body[data-page='inspections']
    #inspectionCategory
    .permit-horizontal-chart--dense
    .permit-bar-track {
    height: 14px;
  }

  body[data-page='inspections'] #inspectionCategory .permit-period,
  body[data-page='inspections'] #inspectionCategory .permit-row-total,
  body[data-page='inspections'] #inspectionCategory .permit-horizontal-chart--dense .permit-period,
  body[data-page='inspections']
    #inspectionCategory
    .permit-horizontal-chart--dense
    .permit-row-total {
    font-size: 13px;
    line-height: 1.2;
  }
}

/* Compact horizontal Permit chart, styled to match the vertical chart. */
body[data-page='permits'] .permit-horizontal-chart {
  height: 100%;
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
}

body[data-page='permits'] .permit-horizontal-row {
  display: grid;
  width: 100%;
  grid-template-columns: 58px minmax(180px, 1fr) 72px;
  align-items: center;
  justify-content: start;
  gap: 12px;
  min-height: 18px;
}

body[data-page='permits'] .permit-period,
body[data-page='permits'] .permit-row-total {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: normal;
}

body[data-page='permits'] .permit-period {
  color: #52677f;
  text-align: right;
}

body[data-page='permits'] .permit-row-total {
  color: #24364b;
  text-align: left;
}

body[data-page='permits'] .permit-bar-track {
  width: 100%;
  height: 18px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 4px;
  background: #edf1f6;
}

body[data-page='permits'] .permit-bar-segment {
  display: block;
  min-width: 2px;
  height: 100%;
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    filter 0.15s ease;
}

body[data-page='permits'] .permits-chart.has-selection .permit-bar-segment:not(.is-selected) {
  /* Horizontal permit bars are HTML spans, so use their background color. */
  display: inline-block !important;
  visibility: visible !important;
  background: #b5c1d2 !important;
  opacity: 1 !important;
  filter: none !important;
}

body[data-page='permits'] .permits-chart.has-selection .permit-bar-segment.is-selected {
  opacity: 1;
  filter: none;
}

body[data-page='permits'] .permit-horizontal-chart--compact {
  justify-content: flex-start;
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 6px;
}

body[data-page='permits'] .permit-horizontal-chart--compact .permit-horizontal-row {
  min-height: 16px;
}

body[data-page='permits'] .permit-horizontal-chart--compact .permit-bar-track {
  height: 14px;
}

body[data-page='permits'] .permit-horizontal-chart--dense {
  justify-content: flex-start;
  gap: 3px;
  padding-top: 4px;
  padding-bottom: 4px;
}

body[data-page='permits'] .permit-horizontal-chart--dense .permit-horizontal-row {
  min-height: 13px;
}

body[data-page='permits'] .permit-horizontal-chart--dense .permit-bar-track {
  height: 10px;
}

body[data-page='permits'] .permit-horizontal-chart--dense .permit-period,
body[data-page='permits'] .permit-horizontal-chart--dense .permit-row-total {
  font-size: 11px;
}

/* Keep Permit bars horizontal and scroll only the chart rows. */
@media (min-width: 801px) {
  body[data-page='permits'] {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  body[data-page='permits'] main {
    position: absolute !important;
    left: calc(6px + var(--side)) !important;
    right: 6px !important;
    top: calc(var(--topbar-h) + var(--page-head-h)) !important;
    width: auto !important;
    margin: 0 !important;
    height: calc(100vh - var(--topbar-h) - var(--page-head-h)) !important;
    min-height: calc(100vh - var(--topbar-h) - var(--page-head-h)) !important;
    overflow: hidden !important;
    padding-bottom: 8px !important;
  }

  body[data-page='permits'] #dashboardContent {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-page='permits'] .permits-lower {
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  body[data-page='permits'] .permits-chart-panel {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-page='permits'] .permits-chart {
    height: calc(100% - 38px) !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
    scroll-padding-block: 10px 34px;
    scroll-snap-type: y proximity;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
  }

  body[data-page='permits'] .permits-chart::-webkit-scrollbar {
    width: 6px;
  }

  body[data-page='permits'] .permits-chart::-webkit-scrollbar-track {
    background: transparent;
  }

  body[data-page='permits'] .permits-chart::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
  }

  body[data-page='permits'] .permits-chart::-webkit-scrollbar-thumb:hover {
    background: #64748b;
  }

  body[data-page='permits'] .permit-horizontal-chart,
  body[data-page='permits'] .permit-horizontal-chart--compact,
  body[data-page='permits'] .permit-horizontal-chart--dense {
    height: auto !important;
    gap: 7px !important;
    padding: 10px 14px 14px !important;
  }

  body[data-page='permits'] .permit-horizontal-row,
  body[data-page='permits'] .permit-horizontal-chart--compact .permit-horizontal-row,
  body[data-page='permits'] .permit-horizontal-chart--dense .permit-horizontal-row {
    min-height: 22px !important;
    scroll-snap-align: start;
  }

  body[data-page='permits'] .permit-horizontal-chart::after {
    content: '';
    display: block;
    flex: 0 0 28px;
  }

  body[data-page='permits'] .permit-bar-track,
  body[data-page='permits'] .permit-horizontal-chart--compact .permit-bar-track,
  body[data-page='permits'] .permit-horizontal-chart--dense .permit-bar-track {
    height: 14px !important;
  }

  body[data-page='permits'] .permit-period,
  body[data-page='permits'] .permit-row-total,
  body[data-page='permits'] .permit-horizontal-chart--dense .permit-period,
  body[data-page='permits'] .permit-horizontal-chart--dense .permit-row-total {
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  body[data-page='permits'] .metrics-panel {
    height: 100% !important;
    min-height: 0 !important;
    align-self: stretch !important;
  }
}

@media (max-height: 800px) {
  body[data-page='permits'] .permit-horizontal-chart--compact {
    gap: 2px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  body[data-page='permits'] .permit-horizontal-chart--compact .permit-horizontal-row {
    min-height: 14px;
  }

  body[data-page='permits'] .permit-horizontal-chart--compact .permit-bar-track {
    height: 12px;
  }

  body[data-page='permits'] .permit-horizontal-chart--compact .permit-period,
  body[data-page='permits'] .permit-horizontal-chart--compact .permit-row-total {
    font-size: 12px;
  }

  body[data-page='permits'] .permit-horizontal-chart--dense {
    gap: 0;
    padding-top: 2px;
    padding-bottom: 2px;
  }

  body[data-page='permits'] .permit-horizontal-chart--dense .permit-horizontal-row {
    min-height: 11px;
  }

  body[data-page='permits'] .permit-horizontal-chart--dense .permit-bar-track {
    height: 8px;
  }

  body[data-page='permits'] .permit-horizontal-chart--dense .permit-period,
  body[data-page='permits'] .permit-horizontal-chart--dense .permit-row-total {
    font-size: 10px;
    line-height: 1;
  }
}

@media (max-width: 1000px) {
  body[data-page='permits'] .permit-horizontal-chart {
    gap: 10px;
    padding-inline: 6px;
  }
  body[data-page='permits'] .permit-horizontal-row {
    grid-template-columns: 52px minmax(120px, 1fr) 60px;
    gap: 8px;
  }
}

.notice,
.loading-page {
  font-family: var(--font-sans);
}

/* Phone navigation: keep all three dashboard pages visible in one compact row. */
@media (max-width: 800px) {
  /* The phone header is navy, so its supporting text must remain light. */
  .report-header .report-name #pageSubtitle,
  .report-header .filters label {
    color: #eaf1fa;
  }

  .sidebar {
    height: 72px;
    min-height: 72px;
    align-items: stretch;
  }

  .seal-wrap {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
  }

  .seal-wrap img {
    width: 62px;
    height: 62px;
  }

  .sidebar nav {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 3px;
    padding: 0 3px;
  }

  .nav {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0 3px;
    gap: 0;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
  }

  .nav span {
    display: none;
  }
  .nav b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .side-note {
    display: none;
  }
}

/* Phone portrait: give the ring and its legend separate rows so neither is
   squeezed beyond the chart panel. Use content height for long legends. */
@media (max-width: 600px) {
  .report-header .filters {
    flex-wrap: wrap;
    gap: 10px;
  }

  .report-header #dateRangeLabel {
    flex: 0 0 100%;
    min-width: 0;
    order: 2;
  }

  .report-header .date-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 8px;
    width: 100%;
  }

  .report-header .date-pair input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 8px;
    font-size: 14px;
    box-sizing: border-box;
  }

  .report-header #clear {
    order: 3;
  }

  .kpis .card {
    height: auto;
    min-height: 88px;
    padding: 10px;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 6px;
    align-content: start;
  }

  .kpis .card .card-icon {
    grid-row: 1;
    width: 28px;
    height: 28px;
    margin: 0;
  }

  .kpis .card strong {
    align-self: center;
    font-size: clamp(18px, 5vw, 24px);
  }

  .kpis .card p {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    display: block;
    -webkit-line-clamp: unset;
    line-height: 1.3;
  }

  body[data-page='plans'] #planDonut,
  body[data-page='inspections'] #tradeDonut {
    flex-direction: column;
    height: auto;
    min-height: 0;
    padding: 16px 8px;
    gap: 18px;
  }

  body[data-page='plans'] #planDonut .donut-stage,
  body[data-page='inspections'] #tradeDonut .donut-stage {
    width: min(220px, 100%);
    max-width: 100%;
    flex: none;
  }

  body[data-page='plans'] #planDonut .donut-legend,
  body[data-page='inspections'] #tradeDonut .donut-legend {
    width: 100%;
    max-width: 340px;
    min-width: 0;
    gap: 10px;
  }

  body[data-page='plans'] #planDonut .donut-legend span,
  body[data-page='inspections'] #tradeDonut .donut-legend span {
    width: 100%;
    min-width: 0;
    grid-template-columns: 10px minmax(0, 1fr) max-content max-content;
    column-gap: 6px;
  }

  body[data-page='plans'] #planDonut .donut-legend em,
  body[data-page='inspections'] #tradeDonut .donut-legend em {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Permit KPI cards start at the dashboard content boundary. Keep this final
   override after the fixed-height desktop rules so their hover/focus/selected
   ring can paint into main's existing top padding without changing layout. */
body[data-page='permits'] #dashboardContent {
  overflow: visible !important;
}

/* Browser zoom / compact desktop support.
   At 125% zoom a typical desktop reports a CSS viewport below 1200px. Keep the
   desktop navigation, but let dashboard content reflow and scroll instead of
   squeezing four tiles and two visual panels into clipped fixed-height rows. */
@media (min-width: 801px) and (max-width: 1199px) {
  html,
  body,
  body[data-page='permits'],
  body[data-page='plans'],
  body[data-page='inspections'] {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  main,
  body[data-page='permits'] main,
  body[data-page='plans'] main,
  body[data-page='inspections'] main {
    height: calc(100vh - var(--topbar-h) - var(--page-head-h)) !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  #dashboardContent,
  body[data-page='permits'] #dashboardContent,
  body[data-page='plans'] #dashboardContent,
  body[data-page='inspections'] #dashboardContent {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
  }

  .kpis,
  body[data-page='permits'] .kpis,
  body[data-page='plans'] .kpis,
  body[data-page='inspections'] .kpis {
    flex: none !important;
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card {
    height: 72px !important;
    min-width: 0;
  }

  .card strong,
  .card p {
    min-width: 0;
  }

  .permits-lower,
  body[data-page='permits'] .permits-lower {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    overflow: visible !important;
  }

  body[data-page='permits'] .permits-chart-panel {
    height: 560px !important;
    min-height: 560px !important;
  }

  body[data-page='permits'] .permits-chart {
    height: calc(100% - 38px) !important;
  }

  body[data-page='permits'] .metrics-panel {
    height: auto !important;
    min-height: 0 !important;
  }

  body[data-page='permits'] .metrics-panel .metric-list {
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(72px, auto));
    gap: 10px;
  }

  body[data-page='permits'] .metrics-panel .metric-card {
    min-height: 72px !important;
  }

  body[data-page='plans'] .plan-grid,
  body[data-page='inspections'] .inspection-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(400px, auto);
    overflow: visible !important;
  }

  body[data-page='plans'] .plan-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual.wide,
  body[data-page='inspections'] .inspection-grid .visual:not(.wide) {
    grid-column: auto !important;
    width: 100%;
    min-width: 0;
  }

  body[data-page='inspections'] .inspection-grid .visual.wide {
    height: 650px !important;
    min-height: 650px !important;
  }
}

/* A 1920px Chrome window reports about 1280 CSS pixels at 150% zoom. At that
   width, the permits Key Metrics labels and the inspections donut legend no
   longer fit safely in the narrow right-hand column. Reflow only these two
   pages before either panel can clip; Plan Review keeps its existing layout. */
@media (min-width: 1200px) and (max-width: 1350px) {
  body[data-page='permits'],
  body[data-page='inspections'] {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  body[data-page='permits'] main,
  body[data-page='inspections'] main {
    height: calc(100vh - var(--topbar-h) - var(--page-head-h)) !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  body[data-page='permits'] #dashboardContent,
  body[data-page='inspections'] #dashboardContent {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
  }

  body[data-page='permits'] .kpis,
  body[data-page='inspections'] .kpis {
    flex: none !important;
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body[data-page='permits'] .card,
  body[data-page='inspections'] .card {
    height: 72px !important;
    min-width: 0;
  }

  body[data-page='permits'] .permits-lower {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    overflow: visible !important;
  }

  body[data-page='permits'] .permits-chart-panel {
    height: 560px !important;
    min-height: 560px !important;
  }

  body[data-page='permits'] .permits-chart {
    height: calc(100% - 38px) !important;
  }

  body[data-page='permits'] .metrics-panel {
    height: auto !important;
    min-height: 0 !important;
  }

  body[data-page='permits'] .metrics-panel .metric-list {
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(72px, auto));
    gap: 10px;
  }

  body[data-page='permits'] .metrics-panel .metric-card {
    min-height: 72px !important;
  }

  body[data-page='inspections'] .inspection-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(400px, auto);
    overflow: visible !important;
  }

  body[data-page='inspections'] .inspection-grid .visual,
  body[data-page='inspections'] .inspection-grid .visual.wide,
  body[data-page='inspections'] .inspection-grid .visual:not(.wide) {
    grid-column: auto !important;
    width: 100%;
    min-width: 0;
  }

  body[data-page='inspections'] .inspection-grid .visual.wide {
    height: 650px !important;
    min-height: 650px !important;
  }
}

@media (min-width: 801px) and (max-width: 1000px) {
  :root {
    --side: 150px;
  }

  body[data-page='permits'],
  body[data-page='plans'],
  body[data-page='inspections'] {
    --page-head-h: 190px;
    --header-h: var(--page-head-h);
  }

  .report-header,
  body[data-page='permits'] .report-header,
  body[data-page='plans'] .report-header,
  body[data-page='inspections'] .report-header {
    height: var(--page-head-h);
  }

  .filters,
  body[data-page='permits'] .filters,
  body[data-page='plans'] .filters,
  body[data-page='inspections'] .filters {
    flex-wrap: wrap;
    row-gap: 10px;
  }
}

/* Tablet side navigation must fit the narrower sidebar without hiding labels. */
@media (min-width: 801px) and (max-width: 1199px) {
  .sidebar .nav,
  .sidebar .nav.active {
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 10px;
    gap: 8px;
    white-space: normal;
  }

  .sidebar .nav b {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
    text-align: left;
  }
}
