/**
 * SAMP v4.8.2 — Compact, content-driven responsive layout
 * Final layout layer loaded after main.css.
 * Goals: predictable shell, high information density, no page-level horizontal overflow,
 * and graceful behaviour across browser zoom, desktop, tablet and mobile widths.
 */

:root {
  --samp-sidebar-width: 240px;
  --samp-mobile-nav-height: 76px;
  --samp-safe-bottom: env(safe-area-inset-bottom, 0px);
  --samp-content-pad: clamp(8px, .85vw, 16px);
  --samp-section-gap: clamp(9px, .7vw, 13px);
  --samp-card-gap: clamp(7px, .55vw, 10px);
  --samp-radius-sm: 10px;
  --samp-radius-md: 14px;
  --samp-radius-lg: 20px;
  --samp-border: #d8e5e8;
  --samp-bg: #f3f7f7;
  --samp-surface: #ffffff;
  --samp-surface-soft: #f7fafb;
  --samp-navy: #123e53;
  --samp-navy-2: #0f3041;
  --samp-teal: #109b81;
  --samp-teal-soft: #e8f7f3;
  --samp-muted: #70828c;
  --samp-shadow: 0 7px 24px rgba(17, 55, 73, .065);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--samp-bg);
  color: #20343e;
  font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
}

button, input, select, textarea { font-family: inherit; }
img, video, canvas, svg { max-width: 100%; }

/* --------------------------------------------------------------------------
   Application shell
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  inset-block: 0;
  right: 0;
  left: auto;
  width: var(--samp-sidebar-width);
  min-width: 0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #0d3042, #153f52);
  color: #fff;
  z-index: 100;
}

html[dir="ltr"] .sidebar { right: auto; left: 0; }

.sidebar .brand {
  width: 100%;
  min-width: 0;
  padding: 0 4px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar .brand-mark { flex: 0 0 auto; }
.sidebar .brand > div { min-width: 0; }
.sidebar .brand strong,
.sidebar .brand small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sidebar .brand strong { font-size: 14px; line-height: 1.45; }
.sidebar .brand small { font-size: 10px; line-height: 1.55; }

.sidebar nav {
  width: 100%;
  margin-top: 18px;
  display: grid;
  gap: 7px;
}

.sidebar .nav {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  border-radius: 11px;
  text-align: start;
  font-size: 15px;
  line-height: 1.35;
}
.sidebar .nav span { min-width: 0; overflow-wrap: anywhere; }
.sidebar .side-account { margin-top: auto; min-width: 0; }
.sidebar .side-account span { overflow-wrap: anywhere; }

main,
body.command-center-active main {
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 100dvh;
  margin: 0 var(--samp-sidebar-width) 0 0;
  overflow-x: clip;
  container-type: inline-size;
  container-name: samp-workspace;
}
html[dir="ltr"] main,
html[dir="ltr"] body.command-center-active main {
  margin: 0 0 0 var(--samp-sidebar-width);
}

.topbar {
  width: 100%;
  min-width: 0;
  min-height: 82px;
  height: auto;
  padding: 14px var(--samp-content-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff;
}
.topbar > div, .top-actions { min-width: 0; }
.topbar h1 {
  margin: 0;
  color: var(--samp-navy);
  font-size: clamp(21px, 1.65vw, 29px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

main > section.view {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: var(--samp-content-pad);
  overflow-x: clip;
}
main > section.view[hidden],
main > section.view:not(.active) { display: none; }
main > section.view.active:not([hidden]) { display: block; }
main > section.view > * { min-width: 0; max-width: 100%; }

/* --------------------------------------------------------------------------
   Shared visual language
   -------------------------------------------------------------------------- */
.panel,
.metric,
.team-card,
.cc-kpi,
.scouting-metric,
.shelter-metric,
.cc-field-care-metric,
.cc-chart-card,
.period-bar {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--samp-border);
  border-radius: var(--samp-radius-md);
  background: var(--samp-surface);
  box-shadow: var(--samp-shadow);
}

.panel { padding: clamp(10px, .75vw, 14px); }

.panel-title,
.section-actions,
.table-summary,
.cc-zone-header,
.cc-chart-head,
.scouting-page-head,
.shelter-page-head {
  min-width: 0;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-title > *,
.section-actions > *,
.cc-zone-title,
.cc-chart-head > * { min-width: 0; }

.panel h2,
.section-actions h2,
.cc-zone-header h3,
.cc-chart-head h3 {
  color: var(--samp-navy);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.primary, .secondary, .link-btn {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 9px;
  white-space: nowrap;
}

input, select, textarea {
  max-width: 100%;
  min-width: 0;
}

/* KPI cards */
.metric,
.cc-kpi,
.shelter-metric,
.cc-field-care-metric,
.scouting-metric {
  position: relative;
  min-height: 96px;
  height: auto;
  padding: 10px 11px 9px;
  overflow: hidden;
  text-align: start;
}

.metric .icon,
.cc-kpi-icon,
.shelter-metric > span,
.cc-field-care-icon,
.scouting-metric > span {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  width: 36px;
  height: 36px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  z-index: 2;
}

.metric > div:not(.icon),
.cc-kpi-copy,
.shelter-metric > div,
.cc-field-care-copy,
.scouting-metric > div {
  width: 100%;
  min-width: 0;
  min-height: 74px;
  display: grid;
  grid-template-rows: auto minmax(34px, 1fr) auto;
  align-items: center;
  gap: 3px;
  padding: 0;
}

.metric > div:not(.icon) > span:first-child,
.cc-kpi-copy > small:first-child,
.shelter-metric > div > small:first-child,
.cc-field-care-copy > small:first-child,
.scouting-metric > div > small:first-child {
  width: 100%;
  min-height: 30px;
  margin: 0;
  padding-inline-start: 44px;
  display: flex;
  align-items: flex-start;
  color: #173f55;
  font-size: clamp(12px, .72rem + .12vw, 14px);
  font-weight: 700;
  line-height: 1.45;
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
}

.metric b,
.cc-kpi b,
.shelter-metric b,
.cc-field-care-metric b,
.scouting-metric b {
  width: 100%;
  margin: 0;
  color: #0b3c54;
  font-size: clamp(25px, 1.8vw, 34px);
  font-weight: 700;
  line-height: 1.08;
  text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
}

.metric .metric-note,
.cc-kpi em,
.cc-field-care-metric em,
.shelter-metric small:last-child,
.scouting-metric small:last-child {
  width: 100%;
  margin: 0;
  color: var(--samp-muted);
  font-size: clamp(9px, .63rem + .05vw, 11px);
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Reusable responsive grids */
.cards,
.team-grid,
.scouting-metrics,
.shelter-metrics,
.cc-kpi-grid,
.cc-scouting-kpis,
.cc-field-care-metrics {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: var(--samp-card-gap);
  align-items: stretch;
}

.filters,
.reports-filters,
.scouting-filters,
.shelter-filters,
.cc-filter-grid,
.map-filters,
.compact-map-filters {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 9px;
  align-items: end;
}
.filters > *, .reports-filters > *, .scouting-filters > *, .shelter-filters > *,
.cc-filter-grid > *, .map-filters > *, .compact-map-filters > * {
  min-width: 0;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Command center
   -------------------------------------------------------------------------- */
body.command-center-active .topbar { display: none; }

#command-center-view.command-center-view {
  width: 100%;
  min-width: 0;
  padding: var(--samp-content-pad);
  overflow-x: clip;
}

#command-center-view .cc-hero,
#command-center-view .cc-filter-dock,
#command-center-view .cc-zone,
#command-center-view .cc-bottom-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#command-center-view .cc-hero {
  min-height: 122px;
  padding: clamp(17px, 1.55vw, 27px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-radius: var(--samp-radius-lg);
  overflow: hidden;
}
#command-center-view .cc-hero-copy,
#command-center-view .cc-hero-actions { min-width: 0; }
#command-center-view .cc-hero-copy h2 {
  margin: 0;
  font-size: clamp(28px, 2.45vw, 43px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
#command-center-view .cc-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#command-center-view .cc-filter-dock {
  position: relative;
  inset: auto;
  z-index: 4;
  margin: var(--samp-section-gap) 0;
  padding: 12px 14px;
}
#command-center-view .cc-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
#command-center-view .cc-filter-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#command-center-view .cc-filter-heading b { min-width: 0; overflow-wrap: anywhere; }
#command-center-view .cc-quick-periods {
  max-width: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
#command-center-view .cc-filter-content {
  height: auto;
  min-height: 0;
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
#command-center-view .cc-filter-actions {
  display: flex;
  gap: 7px;
  align-items: end;
}
#command-center-view .cc-filter-actions button { min-width: 76px; }

#command-center-view .cc-zone {
  position: relative;
  margin: var(--samp-section-gap) 0;
  padding: clamp(12px, 1vw, 18px);
  border-radius: var(--samp-radius-lg);
  overflow: hidden;
}

#command-center-view .cc-zone-header { margin-bottom: 10px; }
#command-center-view .cc-kpi-grid,
#command-center-view .cc-scouting-kpis,
#command-center-view .cc-field-care-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#command-center-view .cc-kpi-grid > .cc-kpi,
#command-center-view .cc-scouting-kpis > .cc-kpi { min-width: 0; }

#command-center-view .cc-report-analytics-grid,
#command-center-view .cc-field-analytics-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--samp-card-gap);
  align-items: start;
  grid-auto-flow: row dense;
}

#command-center-view .cc-report-trend-card { grid-column: span 8; }
#command-center-view .cc-report-mix-card { grid-column: span 4; }
#command-center-view .cc-hourly-card { grid-column: 1 / -1; }
#command-center-view .cc-sector-reports-card,
#command-center-view .cc-top-areas-card,
#command-center-view .cc-period-comparison-card { grid-column: span 4; }
#command-center-view .cc-control-outcomes-card,
#command-center-view .cc-field-sector-card { grid-column: span 6; }
#command-center-view .cc-impact-indicator-card { grid-column: span 8; }
#command-center-view .cc-observed-card { grid-column: span 4; }

#command-center-view .cc-chart-card {
  display: flex;
  flex-direction: column;
  align-self: start;
  height: auto;
  min-height: 0;
  padding: clamp(11px, .9vw, 16px);
  overflow: hidden;
}
#command-center-view .cc-chart-head { margin-bottom: 8px; }
#command-center-view .cc-chart-head h3 { margin-bottom: 2px; }
#command-center-view .cc-chart-head p { line-height: 1.45; }
#command-center-view .cc-chart-card > .cc-chart-body {
  flex: 0 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 210px;
  overflow: hidden;
}
#command-center-view .cc-report-trend-card .cc-chart-body,
#command-center-view .cc-report-mix-card .cc-chart-body { min-height: clamp(245px, 22vw, 360px); }
#command-center-view .cc-hourly-card .cc-chart-body { min-height: clamp(290px, 25vw, 410px); }
#command-center-view .cc-sector-reports-card .cc-chart-body,
#command-center-view .cc-top-areas-card .cc-chart-body,
#command-center-view .cc-period-comparison-card .cc-chart-body,
#command-center-view .cc-observed-card .cc-chart-body { min-height: clamp(210px, 18vw, 290px); }

#command-center-view .cc-chart-body > svg,
#command-center-view .cc-svg-chart,
#command-center-view .cc-svg-chart > svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
#command-center-view .cc-hourly-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}
#command-center-view .cc-hourly-scroll > svg {
  display: block;
  width: max(100%, 720px);
  max-width: none;
  height: auto;
}
#command-center-view .cc-control-radial,
#command-center-view .cc-field-impact,
#command-center-view .cc-sector-executive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
#command-center-view .cc-control-radial {
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
  gap: clamp(11px, 1.25vw, 20px);
}
#command-center-view .cc-field-impact {
  grid-template-columns: minmax(210px, .75fr) minmax(280px, 1.25fr);
  gap: clamp(11px, 1.2vw, 19px);
}
#command-center-view .cc-bottom-grid { display: grid; grid-template-columns: 1fr; gap: var(--samp-card-gap); }

/* --------------------------------------------------------------------------
   Dashboard, reports, scouting, teams and shelter
   -------------------------------------------------------------------------- */
#dashboard-view .period-bar {
  padding: 14px;
  display: grid;
  gap: 10px;
  margin-bottom: var(--samp-section-gap);
}
#dashboard-view .period-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 8px;
  align-items: end;
}
#dashboard-view .cards {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
#dashboard-view .cards > .metric { grid-column: span 3; }
#dashboard-view .cards > .metric:nth-child(n + 5) { grid-column: span 4; }
#dashboard-view .grid-two {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr);
  gap: var(--samp-card-gap);
  align-items: start;
  margin-bottom: var(--samp-section-gap);
}
#dashboard-view .grid-two > * { min-width: 0; }

#reports-view .reports-workspace {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(330px, .78fr) minmax(0, 1.42fr);
  grid-template-areas:
    "filters filters"
    "map table";
  gap: var(--samp-card-gap);
  align-items: start;
  direction: rtl;
}
#reports-view .reports-filter-panel {
  grid-area: filters;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
}
#reports-view .reports-map-pane { grid-area: map; }
#reports-view .reports-table-pane { grid-area: table; }
#reports-view .reports-map-pane,
#reports-view .reports-table-pane,
#reports-view .reports-filter-panel { min-width: 0; height: auto; }
#reports-view .reports-map-content {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
#reports-view #pending-map {
  width: 100%;
  height: clamp(360px, 46vh, 600px);
  min-height: 340px;
}
#reports-view .integrated-chart { min-height: 210px; }
#reports-view .reports-table-pane { display: flex; flex-direction: column; }
#reports-view .reports-table-pane .table-wrap { flex: 1 1 auto; max-height: clamp(520px, 72vh, 840px); }

#scouting-view .scouting-page-head,
#shelter-view .shelter-page-head,
#teams-view > .section-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--samp-section-gap);
}
#scouting-view .scouting-filter-panel,
#shelter-view .shelter-filter-panel { margin-bottom: var(--samp-section-gap); }
#scouting-view .scouting-analysis-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: var(--samp-card-gap);
  align-items: start;
  margin-bottom: var(--samp-section-gap);
}
#scouting-view .scouting-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#scouting-view .scouting-analysis-grid > * { min-width: 0; }
#scouting-view #scouting-map {
  width: 100%;
  height: clamp(380px, 50vh, 620px);
  min-height: 350px;
}
#scouting-view .scouting-table-wrap { max-height: clamp(500px, 67vh, 760px); }

#teams-view .distribution-board {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  gap: var(--samp-card-gap);
  align-items: start;
}
#teams-view .area-bank-panel {
  position: sticky;
  top: 10px;
  max-height: calc(100dvh - 30px);
  overflow: auto;
}
#teams-view .team-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
}

#shelter-view .shelter-section-panel { width: 100%; margin-bottom: var(--samp-section-gap); }
#shelter-view .shelter-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#shelter-view .shelter-table-wrap { max-height: clamp(520px, 70vh, 820px); }
#shelter-view .shelter-capacity,
#shelter-view .shelter-fifo-list { min-width: 0; }

/* --------------------------------------------------------------------------
   Tables, maps and modals
   -------------------------------------------------------------------------- */
.table-wrap,
.reports-table-wrap,
.scouting-table-wrap,
.shelter-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}
.table-wrap table,
.reports-table-wrap table,
.scouting-table-wrap table,
.shelter-table-wrap table { width: 100%; }
.reports-table { min-width: 1080px; }
.scouting-table { min-width: 980px; }
.shelter-table-panel table { min-width: 1000px; }
.table-wrap thead th,
.reports-table-wrap thead th,
.scouting-table-wrap thead th,
.shelter-table-wrap thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 3;
}

#pending-map,
#scouting-map,
#cc-command-map,
#cc-attraction-report-map,
.leaflet-container { max-width: 100%; }
#cc-command-map,
#cc-attraction-report-map {
  width: 100%;
  height: clamp(360px, 48vh, 620px);
  min-height: 340px;
}
.leaflet-pane, .leaflet-top, .leaflet-bottom { z-index: auto; }
.leaflet-control { z-index: 5; }
.leaflet-popup-pane { z-index: 7; }

.modal {
  padding: clamp(7px, 1.3vw, 20px);
  overflow: hidden;
}
.modal-card,
.report-details-card,
.scouting-details-card,
.shelter-details-card,
.shelter-form-card {
  width: min(1120px, 100%);
  max-width: calc(100% - 2px);
  max-height: calc(100dvh - 2 * clamp(7px, 1.3vw, 20px));
  margin: auto;
  overflow: auto;
  overscroll-behavior: contain;
}
.modal-close {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
}

/* --------------------------------------------------------------------------
   Content-width adaptations. Browser zoom naturally changes these CSS pixels.
   -------------------------------------------------------------------------- */
@container samp-workspace (max-width: 1260px) {
  #command-center-view .cc-kpi-grid,
  #command-center-view .cc-scouting-kpis {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  #command-center-view .cc-kpi-grid > .cc-kpi:nth-child(-n + 6),
  #command-center-view .cc-scouting-kpis > .cc-kpi:nth-child(-n + 6) { grid-column: span 4; }
  #command-center-view .cc-kpi-grid > .cc-kpi:nth-child(n + 7),
  #command-center-view .cc-scouting-kpis > .cc-kpi:nth-child(n + 7) { grid-column: span 6; }
  #command-center-view .cc-field-care-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  #command-center-view .cc-report-trend-card,
  #command-center-view .cc-report-mix-card { grid-column: span 6; }
  #command-center-view .cc-sector-reports-card,
  #command-center-view .cc-top-areas-card,
  #command-center-view .cc-period-comparison-card { grid-column: span 6; }
  #command-center-view .cc-period-comparison-card { grid-column: 1 / -1; }
  #command-center-view .cc-impact-indicator-card { grid-column: span 8; }
  #command-center-view .cc-observed-card { grid-column: span 4; }
}

@container samp-workspace (min-width: 1450px) {
  #dashboard-view .cards { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  #dashboard-view .cards > .metric,
  #dashboard-view .cards > .metric:nth-child(n + 5) { grid-column: auto; }
}

@container samp-workspace (max-width: 1080px) {
  #reports-view .reports-workspace {
    grid-template-columns: 1fr;
    grid-template-areas: "filters" "map" "table";
  }
  #reports-view .reports-map-pane #pending-map { height: clamp(390px, 48vh, 560px); }
}

@container samp-workspace (max-width: 980px) {
  #command-center-view .cc-hero { grid-template-columns: 1fr; }
  #command-center-view .cc-hero-actions { justify-self: start; }
  #command-center-view .cc-filter-content { grid-template-columns: 1fr; }
  #command-center-view .cc-filter-actions { justify-content: flex-start; }

  #command-center-view .cc-kpi-grid,
  #command-center-view .cc-scouting-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #command-center-view .cc-kpi-grid > .cc-kpi,
  #command-center-view .cc-scouting-kpis > .cc-kpi { grid-column: auto; }
  #command-center-view .cc-field-care-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  #command-center-view .cc-report-analytics-grid,
  #command-center-view .cc-field-analytics-grid { grid-template-columns: 1fr; }
  #command-center-view .cc-report-analytics-grid > .cc-chart-card,
  #command-center-view .cc-field-analytics-grid > .cc-chart-card { grid-column: 1 / -1; }
  #command-center-view .cc-control-radial,
  #command-center-view .cc-field-impact { grid-template-columns: 1fr; }

  #dashboard-view .grid-two,
  #scouting-view .scouting-analysis-grid,
  #teams-view .distribution-board { grid-template-columns: 1fr; }
  #dashboard-view .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashboard-view .cards > .metric { grid-column: auto; }
  #dashboard-view .cards > .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #scouting-view .scouting-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #shelter-view .shelter-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #shelter-view .shelter-metrics > .shelter-metric:nth-child(-n + 3) { grid-column: span 2; }
  #shelter-view .shelter-metrics > .shelter-metric:nth-child(n + 4) { grid-column: span 3; }
  #teams-view .area-bank-panel { position: static; max-height: none; }
}

@container samp-workspace (max-width: 620px) {
  #command-center-view .cc-kpi-grid,
  #command-center-view .cc-scouting-kpis,
  #command-center-view .cc-field-care-metrics,
  #dashboard-view .cards,
  #scouting-view .scouting-metrics,
  #shelter-view .shelter-metrics,
  #teams-view .team-grid { grid-template-columns: 1fr; }
  #command-center-view .cc-kpi-grid > .cc-kpi,
  #command-center-view .cc-scouting-kpis > .cc-kpi,
  #dashboard-view .cards > .metric,
  #shelter-view .shelter-metrics > .shelter-metric { grid-column: 1 / -1; }

  #command-center-view .cc-action-row { width: 100%; display: grid; grid-template-columns: 1fr; }
  #command-center-view .cc-action-row > * { width: 100%; }
  #command-center-view .cc-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #command-center-view .cc-filter-actions button { width: 100%; }
}

/* --------------------------------------------------------------------------
   Viewport shell breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1279px) and (min-width: 960px) {
  :root { --samp-sidebar-width: 220px; }
  .sidebar { padding: 18px 12px; }
  .sidebar .brand strong { font-size: 12px; }
  .sidebar .brand small { font-size: 9px; }
  .sidebar .nav { min-height: 45px; padding: 9px 10px; font-size: 14px; }
}

@media (max-width: 959px) and (min-width: 760px) {
  :root { --samp-sidebar-width: 88px; }
  .sidebar { padding: 14px 8px; align-items: center; }
  .sidebar .brand { justify-content: center; padding: 0 0 16px; }
  .sidebar .brand > div,
  .sidebar .nav span,
  .sidebar .side-account,
  .sidebar .side-note { display: none; }
  .sidebar nav { margin-top: 14px; gap: 6px; }
  .sidebar .nav {
    min-height: 50px;
    padding: 8px;
    justify-content: center;
    font-size: 20px;
  }
  .topbar { align-items: flex-start; }
  .top-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 759px) {
  body { padding-bottom: calc(var(--samp-mobile-nav-height) + var(--samp-safe-bottom)); }
  .sidebar {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(var(--samp-mobile-nav-height) + var(--samp-safe-bottom));
    padding-block-start: 5px;
    padding-inline: 4px;
    padding-block-end: var(--samp-safe-bottom);
    display: block;
    overflow: hidden;
  }
  .sidebar .brand,
  .sidebar .side-note,
  .sidebar .side-account { display: none; }
  .sidebar nav {
    width: 100%;
    height: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }
  .sidebar .nav {
    width: 100%;
    min-width: 0;
    min-height: 60px;
    padding: 4px 2px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    border-radius: 9px;
    font-size: 18px;
    line-height: 1;
  }
  .sidebar .nav span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px;
    line-height: 1.15;
  }
  main,
  body.command-center-active main,
  html[dir="ltr"] main,
  html[dir="ltr"] body.command-center-active main {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  .topbar { min-height: 70px; padding: 11px; }
  main > section.view,
  #command-center-view.command-center-view { padding: 9px 8px 18px; }
  #command-center-view .cc-hero { min-height: 0; padding: 17px 14px; }
  #command-center-view .cc-hero-copy h2 { font-size: clamp(25px, 8vw, 32px); }
  .filters,
  .reports-filters,
  .scouting-filters,
  .shelter-filters,
  .cc-filter-grid,
  .map-filters,
  .compact-map-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #reports-view .reports-workspace { grid-template-columns: 1fr; grid-template-areas: "filters" "map" "table"; }
  #reports-view #pending-map,
  #scouting-view #scouting-map,
  #cc-command-map,
  #cc-attraction-report-map { height: clamp(340px, 56vh, 500px); min-height: 320px; }
  .modal { padding: 5px; }
  .modal-card,
  .report-details-card,
  .scouting-details-card,
  .shelter-details-card,
  .shelter-form-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 10px);
    border-radius: 13px;
  }
}

@media (max-width: 480px) {
  :root { --samp-card-gap: 8px; }
  .filters,
  .reports-filters,
  .scouting-filters,
  .shelter-filters,
  .cc-filter-grid,
  .map-filters,
  .compact-map-filters { grid-template-columns: 1fr; }
  .metric,
  .cc-kpi,
  .shelter-metric,
  .cc-field-care-metric,
  .scouting-metric { min-height: 108px; }
  .metric b,
  .cc-kpi b,
  .shelter-metric b,
  .cc-field-care-metric b,
  .scouting-metric b { font-size: clamp(29px, 10vw, 39px); }
}

/* --------------------------------------------------------------------------
   v4.8.2 compact data-density correction
   Keep card height driven by real content, and switch dense pairs according
   to the workspace width that remains after the sidebar and browser zoom.
   -------------------------------------------------------------------------- */
#command-center-view .cc-zone {
  margin-block: var(--samp-section-gap);
  padding: clamp(9px, .65vw, 13px);
}
#command-center-view .cc-zone-header { margin-bottom: 7px; }
#command-center-view .cc-report-analytics-grid,
#command-center-view .cc-field-analytics-grid {
  gap: var(--samp-card-gap);
  margin-top: 10px;
}
#command-center-view .cc-field-analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#command-center-view .cc-field-analytics-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: var(--samp-card-gap);
}
#command-center-view .cc-field-analytics-column > .cc-chart-card { grid-column: 1 / -1; }
#command-center-view .cc-chart-card {
  padding: clamp(9px, .65vw, 13px);
  border-radius: 14px;
}
#command-center-view .cc-chart-head {
  margin-bottom: 6px;
  padding-bottom: 0;
}
#command-center-view .cc-chart-card > .cc-chart-body {
  min-height: 0;
  height: auto;
  align-content: start;
}
#command-center-view .cc-report-trend-card .cc-chart-body { min-height: 210px; }
#command-center-view .cc-report-mix-card .cc-chart-body { min-height: 185px; }
#command-center-view .cc-hourly-card .cc-chart-body { min-height: 235px; }
#command-center-view .cc-sector-reports-card .cc-chart-body,
#command-center-view .cc-top-areas-card .cc-chart-body,
#command-center-view .cc-period-comparison-card .cc-chart-body,
#command-center-view .cc-observed-card .cc-chart-body,
#command-center-view .cc-impact-indicator-card .cc-chart-body { min-height: 0; }
#command-center-view .cc-svg-chart > svg { max-height: 220px; }
#command-center-view .cc-hourly-scroll > svg { max-height: 225px; }
#command-center-view .cc-hourly-activity { gap: 7px; }
#command-center-view .cc-hourly-insights { gap: 6px; }
#command-center-view .cc-hourly-insights > div { padding: 7px 9px; }

#command-center-view .cc-bar-list { gap: 6px; align-content: start; }
#command-center-view .cc-bar-row {
  min-height: 20px;
  gap: 7px;
  grid-template-columns: minmax(88px, 1.25fr) minmax(90px, 3fr) 52px;
}
#command-center-view .cc-bar-row.interactive { padding: 2px 3px; }
#command-center-view .cc-bar-row > div { height: 8px; }
#command-center-view .cc-comparison-list { gap: 7px; }
#command-center-view .cc-comparison-list > div { padding: 8px 9px; }

#command-center-view .cc-report-mix {
  height: auto;
  gap: 11px;
  grid-template-columns: minmax(110px, .7fr) minmax(145px, 1.3fr);
}
#command-center-view .cc-report-mix .cc-donut { width: min(145px, 100%); }
#command-center-view .cc-mix-list { gap: 5px; }
#command-center-view .cc-mix-item { padding: 7px 8px; }

#command-center-view .cc-control-radial {
  min-height: 205px;
  gap: clamp(10px, 1vw, 16px);
  grid-template-columns: minmax(190px, .72fr) minmax(260px, 1.28fr);
}
#command-center-view .cc-control-radial-stage { min-height: 205px; }
#command-center-view .cc-control-radial-stage::before { width: 180px; height: 180px; }
#command-center-view .cc-control-radial-svg { width: min(205px, 100%); }
#command-center-view .cc-control-radial-center { width: 108px; min-height: 88px; }
#command-center-view .cc-control-radial-center b { font-size: 34px; }
#command-center-view .cc-control-radial-orbit.cats { inset-block-start: 8px; }
#command-center-view .cc-control-radial-orbit.dogs { inset-block-end: 10px; }
#command-center-view .cc-control-radial-list { gap: 7px; }
#command-center-view .cc-control-radial-item {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 11px;
  border-radius: 13px;
}
#command-center-view .cc-control-radial-item-icon { width: 36px; height: 36px; }
#command-center-view .cc-control-radial-item-copy > strong { font-size: 25px; }
#command-center-view .cc-control-radial-note { padding: 6px 8px; }

#command-center-view .cc-field-impact {
  height: auto;
  gap: clamp(10px, 1vw, 15px);
  align-items: center;
}
#command-center-view .cc-impact-gauge { width: min(150px, 100%); }
#command-center-view .cc-impact-gauge b { font-size: 23px; }
#command-center-view .cc-impact-copy { gap: 7px; }
#command-center-view .cc-impact-total { padding-bottom: 6px; }
#command-center-view .cc-impact-total b { font-size: 22px; }
#command-center-view .cc-impact-lane { padding: 7px 8px; }

#command-center-view .cc-sector-executive { gap: 9px; }
#command-center-view .cc-sector-executive-top { gap: 8px; }
#command-center-view .cc-sector-leader { min-height: 88px; padding: 12px 14px; border-radius: 14px; }
#command-center-view .cc-sector-leader strong { font-size: 21px; }
#command-center-view .cc-sector-overview-metrics { gap: 6px; }
#command-center-view .cc-sector-overview-metrics > div { gap: 6px; padding: 8px; border-radius: 12px; }
#command-center-view .cc-sector-overview-metrics > div > span {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
  border-radius: 9px;
}
#command-center-view .cc-sector-overview-metrics small {
  min-height: 22px;
  display: flex;
  align-items: center;
  white-space: normal;
  line-height: 1.25;
}
#command-center-view .cc-sector-overview-metrics b { font-size: 18px; }
#command-center-view .cc-sector-ranking-list { gap: 5px; }
#command-center-view .cc-sector-rank-row { gap: 7px; padding: 7px 8px; border-radius: 11px; }
#command-center-view .cc-sector-rank-stats > span { min-height: 34px; padding: 3px; }

#scouting-view .scouting-analysis-grid { align-items: start; }
#scouting-view .scouting-map-panel,
#scouting-view .scouting-analysis-panel {
  height: auto;
  min-height: 0;
  align-self: start;
}
#scouting-view #scouting-map {
  height: clamp(280px, 32dvh, 380px);
  min-height: 280px;
}
#scouting-view .scouting-sector-chart {
  height: 205px;
  min-height: 205px;
  padding-top: 39px;
  gap: 10px;
}
#scouting-view .scouting-sector-chart .grouped-bars { height: 130px; }
#scouting-view .scouting-risk-summary { gap: 6px; margin-top: 10px; }
#scouting-view .scouting-risk-summary-item { padding: 7px 4px; }

@container samp-workspace (max-width: 1300px) {
  #command-center-view .cc-field-analytics-grid,
  #scouting-view .scouting-analysis-grid { grid-template-columns: 1fr; }
  #command-center-view .cc-field-analytics-column { display: contents; }
  #command-center-view .cc-control-outcomes-card { order: 1; }
  #command-center-view .cc-field-sector-card { order: 2; }
  #command-center-view .cc-observed-card { order: 3; }
  #command-center-view .cc-impact-indicator-card { order: 4; }
  #command-center-view .cc-sector-executive-top {
    grid-template-columns: minmax(190px, .62fr) minmax(0, 1.38fr);
  }
}

@container samp-workspace (max-width: 760px) {
  #command-center-view .cc-sector-executive-top { grid-template-columns: 1fr; }
  #command-center-view .cc-sector-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #command-center-view .cc-control-radial,
  #command-center-view .cc-field-impact { grid-template-columns: 1fr; }
}

@media (max-width: 759px) {
  #scouting-view #scouting-map { height: clamp(300px, 52dvh, 400px); min-height: 300px; }
  #command-center-view .cc-report-trend-card .cc-chart-body { min-height: 185px; }
  #command-center-view .cc-hourly-card .cc-chart-body { min-height: 215px; }
}

@media print {
  .sidebar, .topbar, .cc-filter-dock, .team-toolbar, .section-actions button { display: none; }
  main, body.command-center-active main, html[dir="ltr"] main { width: 100%; max-width: 100%; margin: 0; }
  main > section.view { padding: 0; }
}
