body{font-family:system-ui,Segoe UI,sans-serif;margin:0;color:#24313b;background:#f5f7f9}header{background:#123e50;color:white;padding:1rem 2rem;display:flex;gap:3rem;align-items:center}nav{display:flex;gap:1.5rem}nav a{color:white}main{max-width:1250px;margin:2rem auto;padding:0 1rem}h1{font-size:1.8rem}table{border-collapse:collapse;width:100%;background:white}td,th{padding:.6rem .8rem;border-bottom:1px solid #dbe2e8;text-align:left}th{background:#e8eff3}select,input,button{padding:.5rem;margin:.3rem}footer{margin:3rem 2rem;color:#687985}.notice{padding:1rem;background:#fff3d9}.stats{display:flex;gap:1rem;flex-wrap:wrap}.stat{background:white;padding:1.5rem;min-width:180px;border-radius:.4rem}.stat strong{display:block;font-size:1.6rem}
.graph-controls { display:flex; gap:1rem; flex-wrap:wrap; margin:1rem 0; }
.graph-controls label { display:flex; flex-direction:column; gap:.3rem; }
.graph-frame { max-width:1100px; border:1px solid #d8dee5; padding:1rem; margin-bottom:1rem; }
.summary-total { background:#dcecf7; font-weight:600; }
.summary-average { background:#e2f1e4; font-weight:600; }

/* CrimeSummary ShowTotals/ShowAverages/ShowDetails parity with original ribbon controls. */
.summary-total > th, .summary-total > td {background:#dcecf7;}
.summary-average > th, .summary-average > td {background:#e2f1e4;}
.graph-series-name {font-weight:600; margin-top:-.5rem;}

/* Crime List only: presentation changes; filtering and pagination unchanged. */
.crime-list-filters details { margin: .35rem 0; padding: .45rem .65rem; border: 1px solid #dbe2e8; border-radius: .35rem; background: white; }
.crime-list-filters summary { cursor: pointer; font-weight: 600; }
.crime-list-checks { display: grid; grid-template-columns: repeat(auto-fit,minmax(245px,1fr)); gap: .35rem 1rem; margin: .65rem 0; }
.crime-list-check { display: flex; align-items: flex-start; gap: .35rem; line-height: 1.35; }
.crime-list-check input { flex: none; margin: .2rem 0 0; padding: 0; }
.crime-list-check span { overflow-wrap: anywhere; }
.crime-sort-controls { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin: 1rem 0; }
.crime-sort-field, .crime-sort-desc { display: inline-flex; align-items: center; gap: .4rem; }
.crime-sort-desc input { margin: 0; }
.crime-grid-container { max-width: 100%; overflow: auto; background: white; border: 1px solid #dbe2e8; border-radius: .35rem; }

/* FlexGrid requires a definite viewport height; without one it collapses to a thin strip. */
.crime-grid-container { height: 540px; min-height: 540px; overflow: hidden; }
.crime-grid-container > * { height: 100%; min-height: 100%; width: 100%; }

/* Stage 12: compact, searchable multi-select filter dropdowns. */
.crime-filter-dropdowns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; margin:1rem 0 1.4rem; }
.crime-filter-dropdown { position:relative; min-width:0; }
.crime-filter-dropdown > summary { display:flex; justify-content:space-between; align-items:center; gap:1rem; cursor:pointer; list-style:none; border:1px solid #cbd6df; background:#fff; border-radius:.4rem; padding:.75rem 1rem; }
.crime-filter-dropdown > summary::-webkit-details-marker { display:none; }
.crime-filter-dropdown > summary::after { content:'▾'; color:#526a78; order:3; }
.crime-filter-dropdown[open] > summary::after { content:'▴'; }
.crime-filter-title { font-weight:650; }
.crime-filter-count { margin-left:auto; color:#526a78; font-size:.9rem; white-space:nowrap; }
.crime-filter-panel { position:absolute; z-index:30; left:0; right:0; top:calc(100% + 3px); background:#fff; border:1px solid #cbd6df; box-shadow:0 8px 24px #182f4224; border-radius:.4rem; padding:.6rem; }
.crime-filter-toolbar { display:flex; gap:.5rem; }
.crime-filter-toolbar button { margin:0; }
.crime-filter-search { display:block; box-sizing:border-box; width:100%; margin:.6rem 0; }
.crime-filter-options { max-height:260px; overflow-y:auto; overscroll-behavior:contain; border-top:1px solid #e5eaef; padding-top:.35rem; }
.crime-filter-option { display:flex; align-items:center; gap:.55rem; padding:.3rem .2rem; line-height:1.35; cursor:pointer; }
.crime-filter-option:hover { background:#f1f6fa; }
.crime-filter-option input { margin:0; padding:0; flex:none; }
@media(max-width:760px) { .crime-filter-dropdowns { grid-template-columns:1fr; } }

/* Stage 13: dropdown apply action stays visible below the scrolling checklist. */
.crime-filter-trigger { display:flex; width:100%; box-sizing:border-box; justify-content:space-between; align-items:center; gap:1rem; cursor:pointer; border:1px solid #cbd6df; background:#fff; color:inherit; border-radius:.4rem; padding:.75rem 1rem; margin:0; font:inherit; text-align:left; }
.crime-filter-trigger:hover, .crime-filter-trigger:focus-visible { border-color:#7c9bad; }
.crime-filter-chevron { color:#526a78; }
.crime-filter-actions { display:flex; justify-content:flex-end; padding-top:.55rem; border-top:1px solid #e5eaef; margin-top:.5rem; }
.crime-filter-actions button { margin:0; background:#123e50; border:1px solid #123e50; color:#fff; border-radius:.3rem; padding:.5rem 1rem; cursor:pointer; }
.crime-filter-actions button:disabled { opacity:.55; cursor:wait; }

/* Stage 14: wide reporting tables retain original rows and calculations. */
.summary-table-wrap { max-width:100%; max-height:70vh; overflow:auto; border:1px solid #dbe2e8; border-radius:.4rem; background:white; overscroll-behavior:contain; }
.summary-table { width:max-content; min-width:100%; border-collapse:separate; border-spacing:0; font-variant-numeric:tabular-nums; }
.summary-table thead th { position:sticky; top:0; z-index:3; background:#e8eff3; vertical-align:middle; min-width:5.3rem; }
.summary-table thead th:first-child { min-width:7.4rem; }
.summary-table tbody th:first-child, .summary-table tbody td:first-child { position:sticky; left:0; z-index:2; background:#fff; min-width:7.4rem; box-shadow:1px 0 #dbe2e8; }
.summary-table tbody .summary-total > :first-child { background:#dcecf7; }
.summary-table tbody .summary-average > :first-child { background:#e2f1e4; }
.summary-table thead th:first-child { left:0; z-index:4; }
.summary-table tbody td:not(:first-child) { text-align:right; }
.summary-table tbody tr:hover > td:not(.summary-total):not(.summary-average) { filter:brightness(.98); }
@media print { .summary-table-wrap { max-height:none; overflow:visible; border:0; } .summary-table { font-size:8pt; width:100%; } .summary-table thead th, .summary-table tbody td:first-child, .summary-table tbody th:first-child { position:static; box-shadow:none; } }

/* Monthly summary: use available browser width, wrap headings and centre counts. */
main:has(.summary-table-wrap) { max-width:none; width:100%; box-sizing:border-box; margin:1.25rem auto; padding:0 1rem; }
.summary-table { width:100%; min-width:1100px; table-layout:fixed; }
.summary-table thead th { min-width:0; width:auto; white-space:normal; overflow-wrap:normal; word-break:normal; hyphens:auto; text-align:center; line-height:1.25; padding:.6rem .25rem; font-size:.9rem; }
.summary-table thead th:first-child { min-width:0; width:8rem; text-align:left; }
.summary-table tbody th:first-child, .summary-table tbody td:first-child { min-width:0; width:8rem; white-space:nowrap; text-align:left; }
.summary-table tbody td:not(:first-child) { text-align:center; padding:.55rem .2rem; }
.summary-table thead th:not(:first-child) { width:calc((100% - 8rem) / 14); }
@media print { main:has(.summary-table-wrap) { margin:0; padding:0; } .summary-table { min-width:0; } }

/* Stage 17: Crime List layout only. No filter, sorting or grid logic changes. */
main:has(.crime-list-page) { max-width:none; width:100%; box-sizing:border-box; margin:1.25rem auto; padding:0 1rem; }
.crime-list-page { width:100%; min-width:0; }
.crime-list-page > h1 { margin:.3rem 0 1rem; }
.crime-list-page .crime-filter-dropdowns { grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; margin:.7rem 0 1.15rem; }
.crime-list-page .crime-filter-trigger { min-height:3.1rem; gap:.35rem; padding:.65rem .75rem; }
.crime-list-page .crime-filter-count { font-size:.82rem; }
.crime-list-page .crime-filter-panel { min-width:min(350px,calc(100vw - 2rem)); }
.crime-list-page .crime-filter-dropdown:nth-child(n+3) .crime-filter-panel { left:auto; right:0; }
.crime-list-page .crime-sort-toolbar { display:flex; align-items:center; gap:.7rem 1.25rem; flex-wrap:wrap; margin:.55rem 0 .8rem; }
.crime-list-page .crime-sort-toolbar h2 { font-size:1.15rem; margin:0; white-space:nowrap; }
.crime-list-page .crime-sort-controls { display:flex; align-items:center; gap:.35rem .8rem; flex-wrap:wrap; margin:0; }
.crime-list-page .crime-sort-field { gap:.3rem; white-space:nowrap; }
.crime-list-page .crime-sort-desc { gap:.25rem; white-space:nowrap; }
.crime-list-page .crime-sort-field select { margin:0; padding:.35rem .4rem; }
.crime-list-page .crime-sort-actions { display:flex; gap:.4rem; align-items:center; flex-wrap:wrap; margin-left:auto; }
.crime-list-page .crime-sort-actions button { margin:0; padding:.4rem .6rem; }
.crime-list-page .crime-grid-container { width:100%; box-sizing:border-box; }
@media(max-width:1250px) { .crime-list-page .crime-filter-dropdowns { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) { .crime-list-page .crime-filter-dropdowns { grid-template-columns:1fr; } .crime-list-page .crime-filter-dropdown .crime-filter-panel { left:0; right:0; min-width:0; } .crime-list-page .crime-sort-actions { margin-left:0; } }

/* Stage 18: reporting presentation only; preserve all calculations and filters. */
main:has(.graph-page), main:has(.mapping-page) { max-width:none; width:100%; box-sizing:border-box; margin:1.25rem auto; padding:0 1rem; }
.graph-page, .mapping-page { width:100%; min-width:0; }
.graph-page > h1, .mapping-page > h1 { margin:.35rem 0 .9rem; }
.graph-page .graph-series-name { margin:.1rem 0 .8rem; font-size:1rem; }
.graph-page .graph-controls { display:flex; align-items:end; gap:.75rem 1.25rem; flex-wrap:wrap; margin:.6rem 0 1rem; }
.graph-page .graph-controls label { font-size:.9rem; gap:.25rem; }
.graph-page .graph-controls select { margin:0; min-width:9rem; }
.graph-page .graph-frame { box-sizing:border-box; max-width:none; width:100%; padding:.6rem; background:#fff; border:1px solid #dbe2e8; border-radius:.4rem; }
.graph-page .graph-frame svg { display:block; width:100%; max-height:65vh; }
.mapping-page .map-filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; margin:.6rem 0 .8rem; }
.mapping-page .map-filters details { position:relative; min-width:0; border:1px solid #cbd6df; border-radius:.4rem; background:#fff; }
.mapping-page .map-filters summary { padding:.8rem .7rem; cursor:pointer; font-weight:600; white-space:nowrap; }
.mapping-page .map-filters details[open] { z-index:20; }
.mapping-page .map-filters details[open] > :not(summary) { position:relative; }
.mapping-page .map-filter-actions { display:flex; gap:.4rem; padding:.4rem .5rem; }
.mapping-page .map-filter-actions button { margin:0; }
.mapping-page .map-checks { max-height:220px; overflow-y:auto; padding:.3rem .5rem .6rem; display:grid; grid-template-columns:1fr; }
.mapping-page .map-checks label { display:flex; align-items:center; gap:.35rem; padding:.2rem 0; }
.mapping-page .map-checks input { margin:0; flex:none; }
.mapping-page .map-action-bar { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem .7rem; margin:.7rem 0; }
.mapping-page .map-action-bar button { margin:0; }
.mapping-page .map-action-bar span { margin-left:.4rem; }
.mapping-page #crime-map { height:70vh !important; min-height:440px; border-radius:.4rem; }
main:has(.outcome-report-heading) { max-width:none; width:100%; box-sizing:border-box; margin:1.25rem auto; padding:0 1rem; }
@media(max-width:1000px) { .mapping-page .map-filters { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:650px) { .mapping-page .map-filters { grid-template-columns:1fr; } .mapping-page #crime-map { height:55vh !important; min-height:350px; } }
@media print { main:has(.outcome-report-heading) { padding:0; margin:0; } }

/* Stage 19: compact page headings and full-width SVG plot. */
.graph-page .graph-heading-row, .mapping-page .map-heading-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin:.3rem 0 .9rem; }
.graph-page .graph-heading-row h1, .mapping-page .map-heading-row h1 { margin:0; }
.graph-page .graph-heading-row .graph-controls { display:flex; align-items:center; gap:.65rem 1rem; margin:0 0 0 auto; }
.graph-page .graph-heading-row .graph-controls label { display:inline-flex; align-items:center; gap:.45rem; margin:0; }
.graph-page .graph-heading-row .graph-controls select { margin:0; }
/* A max-height on the SVG scales the entire drawing down, leaving large unused horizontal space. */
.graph-page .graph-frame svg { width:100%; height:auto; max-height:none; }
.mapping-page .map-heading-row .map-action-bar { margin:0 0 0 auto; justify-content:flex-end; }
.mapping-page .map-heading-row .map-action-bar span { white-space:nowrap; }
@media(max-width:850px) { .graph-page .graph-heading-row .graph-controls, .mapping-page .map-heading-row .map-action-bar { margin-left:0; } }
