/* CrimeGrade Portal - styles for the 2024-model (v3) pages. Loaded after common.css, whose variables and
   .card / .card-header / .main-content it reuses. Scores: higher = more crime (red); colours come from
   CG_COLOR_SCHEMES through js/cg-model.js, never from this file. */

.v3 { --v3-radius: 8px; --v3-shadow: 0 2px 4px rgba(0,0,0,0.1); --v3-muted: #5f6b7a; }
.v3 .card { margin-bottom: 20px; }
.v3 h2 { font-size: 17px; color: var(--cg-dark-blue); margin: 0; }
.v3 [hidden] { display: none !important; }
.v3 input[type=checkbox], .v3 input[type=radio], .v3-modal input[type=checkbox] { accent-color: var(--cg-blue); }

/* banners */
.v3-banner { border-radius: var(--v3-radius); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; line-height: 1.45; }
.v3-banner.fixture { background: #fde8e8; border: 1px solid #dd4545; color: #7a1c1c; font-weight: 600; }

/* 1. header */
.v3-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, #2c5aa0 0%, #1a3a6b 100%); color: #fff; padding: 20px 26px;
  border-radius: var(--v3-radius); margin-bottom: 20px; }
.v3-header h1 { font-size: 24px; margin: 0 0 2px; }
.v3-header .v3-addr { font-size: 14px; opacity: 0.88; }
.v3-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.v3-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 12px;
  font-weight: 600; background: rgba(255,255,255,0.16); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
button.v3-chip { cursor: pointer; font-family: inherit; }
button.v3-chip:hover { background: rgba(255,255,255,0.28); }
.v3-chip .v3-chip-link { text-decoration: underline; opacity: 0.9; }
.v3-toggle { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,0.5); }
.v3-toggle button { border: 0; background: transparent; color: inherit; padding: 6px 14px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; }
.v3-toggle button.active { background: #fff; color: var(--cg-dark-blue); }
.v3-toggle.light { border-color: var(--cg-border); color: var(--cg-dark-blue); }
.v3-toggle.light button.active { background: var(--cg-blue); color: #fff; }
.v3-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 2. hero */
.v3-hero { display: grid; grid-template-columns: minmax(300px, 5fr) 7fr; gap: 20px; margin-bottom: 20px; }
.v3-hero .card { margin-bottom: 0; padding: 18px 20px; }
.v3-geo-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.v3-geo-chips button { border: 1px solid var(--cg-border); background: #fff; border-radius: 999px; padding: 4px 12px;
  font-size: 12px; cursor: pointer; color: var(--cg-dark-blue); font-family: inherit; }
.v3-geo-chips button.active { background: var(--cg-blue); border-color: var(--cg-blue); color: #fff; }
.v3-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--v3-muted); }
.v3-overall { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.v3-score-big { font-size: 46px; font-weight: 800; line-height: 1; min-width: 96px; text-align: center; padding: 10px 12px;
  border-radius: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.v3-overall-grade { font-size: 22px; font-weight: 800; color: var(--cg-dark-blue); }
.v3-overall-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v3-overall-badges .v3-grade-badge { font-size: 18px; padding: 4px 12px; }
.v3-overall-sub { font-size: 13px; color: var(--v3-muted); margin-top: 2px; }
.v3-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid #eee; padding-top: 12px; }
.v3-strip-item { display: flex; align-items: center; gap: 10px; }
.v3-score-chip { display: inline-block; min-width: 46px; text-align: center; border-radius: 6px; padding: 3px 7px;
  font-weight: 700; font-size: 13px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.35); }
.v3-score-chip.none { background: #c8c8c8; color: #444; text-shadow: none; }
.v3-keypoints h2 { margin-bottom: 10px; }
.v3-keypoints ul { margin: 0; padding: 0; list-style: none; }
.v3-keypoints li { padding: 9px 0 9px 26px; border-bottom: 1px solid #f0f0f0; position: relative; font-size: 14px;
  line-height: 1.45; color: #222; }
.v3-keypoints li:last-child { border-bottom: 0; }
.v3-keypoints li::before { content: ''; position: absolute; left: 6px; top: 15px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--cg-blue); }
.v3-keypoints li.biz::before { background: #c27b1d; }

/* 3. business */
.v3-biz-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.v3-biz-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.v3-biz-controls select { padding: 6px 8px; border: 1px solid var(--cg-border); border-radius: 6px; font-size: 13px;
  max-width: 300px; font-family: inherit; }
.v3-framing { color: var(--v3-muted); font-size: 13px; margin: 10px 0 12px; }
.v3-bizrow { border: 1px solid #e6e9ee; border-radius: 8px; margin-bottom: 8px; background: #fff; }
.v3-bizrow > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: grid;
  grid-template-columns: 170px 1fr; gap: 12px; align-items: start; }
.v3-bizrow > summary::-webkit-details-marker { display: none; }
.v3-bizrow[open] > summary { border-bottom: 1px solid #eef0f3; }
.v3-bizrow .v3-fam { font-weight: 700; color: var(--cg-dark-blue); font-size: 14px; }
.v3-bizrow .v3-headline { font-size: 14px; color: #222; line-height: 1.45; }
.v3-bizbody { padding: 10px 14px 12px 196px; font-size: 13px; color: #333; line-height: 1.5; }
.v3-bizbody p { margin: 4px 0; }
.v3-bizbody .v3-sub { font-weight: 700; color: var(--cg-dark-blue); margin-top: 8px; }
.v3-coverage { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 6px; }
.v3-coverage span { background: #f1f4f8; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--v3-muted); }
.v3-store-match { font-size: 13px; color: #333; margin: 8px 0; }
.v3-source { font-size: 12px; color: var(--v3-muted); margin: 8px 0 0; }
.v3-prompt { background: #f5f8fc; border: 1px dashed #b9cde6; border-radius: 8px; padding: 14px 16px; font-size: 14px; color: #1a3a6b; }
/* in progress (CGV3UI.spinner): beside every "Calculating" line and in place of every figure still coming */
.v3-spinner { display: inline-block; flex: none; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid #d3dbe6; border-top-color: var(--cg-blue); vertical-align: -2px; animation: v3-spin 0.8s linear infinite; }
.v3-calculating { display: flex; align-items: center; gap: 8px; }
@keyframes v3-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .v3-spinner { animation-duration: 2.4s; } }
/* The store score: its own scale, so no grade and no score colour; neutral numbers only. */
.v3-store-overall { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.v3-store-box { flex: 1 1 240px; border: 1px solid #dfe4ea; border-radius: 8px; padding: 10px 14px; background: #f8fafc; }
.v3-store-label { font-size: 12px; font-weight: 700; color: var(--v3-muted); }
.v3-store-value { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.v3-store-big { font-size: 28px; font-weight: 700; color: var(--cg-dark-blue); line-height: 1.2; }
.v3-store-num { display: inline-block; min-width: 42px; margin-right: 8px; font-weight: 700; color: var(--cg-dark-blue); }
.v3-bizline-store { font-size: 13px; color: #333; margin-top: 6px; }
.v3-bizline-store .v3-store-num { min-width: 0; margin-right: 6px; font-size: 15px; }

/* 4. map */
.v3-maplayout { display: grid; grid-template-columns: 270px 1fr; min-height: 560px; }
.v3-mapcontrols { border-right: 1px solid var(--cg-border); padding: 12px; display: flex; flex-direction: column; gap: 10px;
  max-height: 620px; overflow: auto; }
.v3-layerlist { display: flex; flex-direction: column; }
.v3-layerlist .v3-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--v3-muted); margin: 10px 0 4px; }
.v3-layerlist button { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0;
  background: transparent; text-align: left; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
  color: #222; font-family: inherit; }
.v3-layerlist button.sub { padding-left: 22px; font-size: 12px; color: #444; }
.v3-layerlist button:hover { background: #f1f4f8; }
.v3-layerlist button.active { background: #e3ecf7; font-weight: 700; color: var(--cg-dark-blue); }
.v3-layerlist .v3-layer-val { font-weight: 700; color: var(--cg-dark-blue); }
.v3-mapwrap { position: relative; }
#v3Map { position: absolute; inset: 0; }
/* the report's map card in fullscreen (report-v3.js fullscreenControl): the whole card, its list and toggle with it */
#mapCard.v3-fs-on { margin: 0; border-radius: 0; width: 100vw; height: 100vh; box-sizing: border-box; display: flex;
  flex-direction: column; background: #fff; overflow: hidden; }
#mapCard.v3-fs-on .v3-maplayout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
#mapCard.v3-fs-on .v3-mapcontrols { max-height: none; }
#mapCard.v3-fs-fixed { position: fixed; inset: 0; z-index: 2147483000; }
.v3-fs-btn svg { display: block; margin: auto; }
.v3-legend { position: absolute; left: 12px; bottom: 26px; background: rgba(255,255,255,0.96); border-radius: 8px;
  box-shadow: var(--v3-shadow); padding: 8px 10px; font-size: 11px; color: #333; min-width: 230px; z-index: 2; }
/* the key itself (CGMapV3.renderLegend), in the report's box and the map view's legend */
.v3-legend-title { font-weight: 700; margin-bottom: 4px; color: var(--cg-dark-blue); }
.v3-ramp { height: 10px; border-radius: 3px; }
.v3-ends { display: flex; justify-content: space-between; margin-top: 2px; }
.v3-grades { display: flex; justify-content: space-between; margin-top: 2px; color: var(--v3-muted); }
.v3-bins { display: flex; height: 10px; border-radius: 3px; overflow: hidden; }
.v3-bins span { flex: 1; }
.v3-nores { display: inline-block; width: 12px; height: 10px; background: #c8c8c8; vertical-align: middle; margin-right: 4px; }
.v3-legend-where { margin-top: 6px; font-size: 11px; line-height: 1.4; }

/* 5. table */
.v3-tablewrap { overflow-x: auto; }
.v3-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.v3-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--v3-muted);
  padding: 8px 10px; border-bottom: 2px solid #e6e9ee; white-space: nowrap; }
.v3-table td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.v3-table tr.v3-grouprow td { background: #f7f9fc; font-weight: 700; color: var(--cg-dark-blue); font-size: 12px; }
.v3-table tr.v3-row { cursor: pointer; }
.v3-table tr.v3-row:hover td { background: #fafbfd; }
.v3-table tr.v3-row td:first-child { font-weight: 600; color: #222; }
.v3-table tr.v3-row.sub td:first-child { padding-left: 28px; font-weight: 400; color: #333; }
.v3 .v3-grade { color: var(--v3-muted); margin-left: 6px; font-weight: 600; }
.v3-table .v3-score-chip, .v3-data-table .v3-score-chip { white-space: nowrap; }   /* phones scroll the table instead */
.v3-table tr.v3-detail td { background: #fbfcfe; padding: 10px 16px 14px; }
.v3-detail table { border-collapse: collapse; font-size: 12px; }
.v3-detail td, .v3-detail th { padding: 4px 12px 4px 0; border: 0; text-align: left; }
.v3-detail th { color: var(--v3-muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.v3-note { font-size: 12px; color: var(--v3-muted); }

/* 6-8. SCAPP, history, footer */
.v3-collapsible > summary { cursor: pointer; list-style: none; padding: 16px 20px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap; }
.v3-collapsible > summary::-webkit-details-marker { display: none; }
.v3-collapsible > summary::after { content: '+'; font-size: 20px; color: var(--cg-blue); }
.v3-collapsible[open] > summary::after { content: '−'; }
.v3-collapsible .v3-body { padding: 0 20px 18px; }
.v3-scapp-line { font-size: 14px; color: #222; }
.v3-scapp-copy { font-size: 13px; color: #333; line-height: 1.5; max-width: 860px; }
.v3-smallprint { font-size: 11px; color: var(--v3-muted); }
.v3-footer { font-size: 12px; color: var(--v3-muted); margin: 6px 2px 30px; line-height: 1.6; }
a.def-link { color: var(--cg-blue); }

/* shared pieces (js/v3-ui.js) */
.v3-score-chip.small { min-width: 36px; padding: 2px 6px; font-size: 12px; }
.v3-grade-badge { padding: 3px 9px; font-size: 13px; }
.v3-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.v3-page-head .page-header { margin-bottom: 20px; }
.v3-head-actions { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.v3-add-btn { display: inline-flex; align-items: center; gap: 6px; }
/* the head's two buttons alike: a <button> takes neither the page font nor its line height, and has a border */
.v3-head-actions .btn { font-family: inherit; line-height: 1.6; }
.v3-head-actions .btn-secondary { padding-top: 9px; padding-bottom: 9px; }
/* the info "i" (CGV3UI.infoTip): the v2 pages' info-icon tooltip (inline in dashboard.html and report.html), as is */
.info-icon-wrapper { position: relative; display: inline-block; margin-left: 6px; }
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  background: #4A90E2; color: white; border-radius: 50%; font-size: 11px; font-weight: bold; font-style: normal;
  cursor: help; user-select: none; transition: all 0.2s ease; vertical-align: middle; }
.info-icon:hover { background: #2d6ba8; transform: scale(1.1); }
.info-tooltip { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); background: white;
  border: 2px solid #4A90E2; border-radius: 8px; padding: 12px 16px; width: 320px; max-width: 90vw;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); z-index: 1000; font-size: 13px; line-height: 1.5; font-weight: normal;
  color: #333; text-align: left; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none; }
.info-tooltip::before { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: #4A90E2; }
.info-tooltip::after { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: white; margin-bottom: -1px; }
.info-icon-wrapper:hover .info-tooltip, .info-tooltip.active { opacity: 1; visibility: visible; }
.info-tooltip.active { pointer-events: auto; }
.info-tooltip-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 10000; }
.info-line { display: block; }
.info-line + .info-line { margin-top: 6px; }
.info-icon-wrapper.align-right .info-tooltip { left: auto; right: -10px; transform: none; }
.info-icon-wrapper.align-right .info-tooltip::before { left: auto; right: 12px; transform: none; }
.info-icon-wrapper.align-right .info-tooltip::after { left: auto; right: 13px; transform: none; }
@media (max-width: 768px) {
  .info-tooltip, .info-icon-wrapper.align-right .info-tooltip { position: fixed; left: 50%; right: auto; top: 50%;
    transform: translate(-50%, -50%); width: calc(100vw - 40px); max-width: 320px; z-index: 10001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
  .info-tooltip::before, .info-tooltip::after, .info-icon-wrapper.align-right .info-tooltip::after { display: none; }
  .info-tooltip.active::after, .info-icon-wrapper.align-right .info-tooltip.active::after { display: block;
    position: static; transform: none; border: 0; border-top: 1px solid rgba(74, 144, 226, 0.3); margin: 12px 0 0;
    padding-top: 12px; content: '✕ Tap outside to close'; font-size: 11px; text-align: center; color: #666;
    font-style: italic; }
}
.v3-modal-back { position: fixed; inset: 0; background: rgba(15, 30, 55, 0.45); z-index: 2000; display: flex;
  align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.v3-modal { background: #fff; border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,0.25); width: 100%; max-width: 520px;
  padding: 20px 22px; }
.v3-modal h3 { margin: 0 0 6px; color: var(--cg-dark-blue); font-size: 18px; }
.v3-modal .v3-modal-picker { margin: 12px 0 6px; }
.v3-modal .v3-check { font-size: 13px; display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.v3-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.v3-modal-actions .btn-secondary:first-child { margin-right: auto; }
/* the Custom weights dialog (js/weights-v3.js): one slider per crime, each showing its share */
.v3-modal.v3-wmodal { max-width: 620px; }
.v3-wkind { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.v3-wkind label { font-size: 13px; font-weight: 700; color: var(--cg-dark-blue); }
.v3-wkind select { flex: 1 1 280px; min-width: 0; height: 38px; padding: 6px 8px; border: 1px solid var(--cg-border);
  border-radius: 6px; font: inherit; font-size: 14px; background: #fff; }
.v3-wsource { margin: 6px 0 4px; }
.v3-wrows { margin: 6px 0 2px; }
.v3-wrow { display: grid; grid-template-columns: 170px 1fr 72px; align-items: center; gap: 12px; padding: 4px 0;
  border-bottom: 1px solid #f2f2f2; font-size: 13px; }
.v3-wrow label { font-weight: 600; color: #222; }
.v3-wrow input[type=range] { width: 100%; margin: 0; accent-color: var(--cg-blue); }
.v3-wshare { font-weight: 700; color: var(--cg-dark-blue); text-align: right; white-space: nowrap; }
.v3-whint { margin: 6px 0 0; }
.v3-whint.v3-wwarn { color: var(--cg-red); }
.v3-wpreview { margin-top: 12px; }
.v3-wpreview table { width: 100%; border-collapse: collapse; font-size: 13px; }
.v3-wpreview th { font-size: 12px; font-weight: 700; color: var(--v3-muted); text-align: right; padding: 4px 6px; }
.v3-wpreview td { padding: 4px 6px; border-top: 1px solid #f2f2f2; text-align: right; white-space: nowrap; }
.v3-wpreview th:first-child, .v3-wpreview td:first-child { text-align: left; white-space: normal; }
.v3-wpreview .v3-note { margin: 4px 0 0; }
@media (max-width: 560px) {
  .v3-wrow { grid-template-columns: 1fr 72px; }
  .v3-wrow input[type=range] { grid-column: 1 / -1; grid-row: 2; }
}
.v3-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 9px; font-size: 10.5px; font-weight: 700;
  background: #fff3e0; color: #b45309; vertical-align: 1px; }
.v3-tag.muted { background: #f1f1f1; color: #666; }
.v3-biz-current { font-size: 14px; color: #222; }

/* dashboard */
.v3-overview { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; align-items: stretch; }
.v3-overview .overview-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.v3-overview .stat-card { margin: 0; border-left: 0; }   /* no coloured left edge (common cursor rules) */
.v3-overview .overview-donut { margin: 0; }
.v3-stat-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 34px; }
.v3-stat-value .v3-score-chip { font-size: 18px; padding: 4px 10px; }
.v3-stat-value .v3-grade { font-size: 18px; margin-left: 0; color: var(--cg-dark-blue); }
.stat-card .stat-change a { color: var(--cg-blue); text-decoration: none; font-weight: 600; }
.stat-card .stat-change a:hover { text-decoration: underline; }
.v3-donut-wrap { position: relative; height: 170px; }
.v3-donut-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 12px; font-size: 12px; }
.v3-legend-row { display: flex; align-items: center; gap: 6px; }
.v3-legend-row b { margin-left: auto; color: var(--cg-dark-blue); }
.v3-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.v3-bizline { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; padding: 12px 0;
  border-bottom: 1px solid #eef0f3; align-items: start; }
.v3-bizline:last-child { border-bottom: 0; }
.v3-bizline-name { font-weight: 700; color: var(--cg-dark-blue); text-decoration: none; font-size: 14px; }
.v3-bizline-name:hover { text-decoration: underline; }
.v3-bizline-type { font-size: 13px; color: #333; margin-top: 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.v3-linkbtn { border: 0; background: none; color: var(--cg-blue); cursor: pointer; padding: 0; font-size: 12px;
  text-decoration: underline; font-family: inherit; }
.v3-bizline-stats { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--cg-blue); }
.v3-bizline-risks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.v3-risk-item { position: relative; border: 1px solid #e6e9ee; border-radius: 8px; transition: border-color 0.15s; }
.v3-risk-item:hover { border-color: var(--cg-blue); }
.v3-risk-link { display: block; padding: 8px 30px 9px 10px; color: inherit; text-decoration: none; }
.v3-risk-link .v3-fam { display: block; font-weight: 700; font-size: 14px; color: var(--cg-dark-blue); }
.v3-risk-link:hover .v3-fam { text-decoration: underline; }
.v3-risk-num { display: block; margin-top: 3px; font-size: 14px; color: #222; }
.v3-risk-measure { color: var(--v3-muted); }
.v3-risk-item .info-icon-wrapper { position: absolute; top: 9px; right: 9px; margin: 0; }
.v3-bizhomes { margin: 12px 0 0; }
.v3-data-table td { vertical-align: middle; }
.v3-data-table td .v3-score-chip { font-size: 12px; }
/* both v3 tables (the dashboard's and the Locations page's): compact cells and wrapping headers, so they fit beside the
   sidebar at laptop widths; the dashboard's long business types wrap too */
.v3-data-table th, .v3-data-table td { padding: 7px 10px; }
.v3-data-table thead th { white-space: normal; }
.v3-data-table:not(.v3-loc-table) td:nth-child(2) { white-space: normal; min-width: 150px; }

/* locations */
.v3-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.v3-filters input[type=search], .v3-filters select, .v3-filters input[type=number] { padding: 8px 10px;
  border: 1px solid var(--cg-border); border-radius: 6px; font-size: 13px; font-family: inherit; background: #fff; }
.v3-filters input[type=search] { min-width: 240px; flex: 1; }
.v3-filters input[type=number] { width: 80px; }
.v3-range-label { font-size: 13px; color: var(--v3-muted); display: inline-flex; gap: 6px; align-items: center; }
.v3-filter-card { padding: 14px 20px; }
/* the Columns panel (locations-v3.js): one section per kind of column; every tick applies at once */
.v3-colpicker { border: 1px solid #e3e8ef; border-radius: 8px; padding: 12px 16px 4px; margin-bottom: 16px; background: #fbfcfe; }
.v3-pick-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.v3-pick-head h3 { font-size: 15px; color: var(--cg-dark-blue); margin: 0; }
.v3-pick-btns { display: flex; gap: 8px; margin-left: auto; }
.v3-pick-sec { border-top: 1px solid #e6e9ee; padding: 9px 0 7px; }
.v3-pick-sechead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 3px; }
.v3-pick-sechead h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--cg-dark-blue); margin: 0; }
.v3-pick-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--cg-blue); }
.v3-pick-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: start; padding: 1px 0; }
.v3-pick-label { font-size: 12px; color: var(--v3-muted); padding-top: 3px; }
.v3-pick-opts { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: center; }
.v3-pick-opts .v3-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; padding: 2px 0; cursor: pointer;
  white-space: nowrap; }
.v3-pick-opts .v3-check input:disabled { cursor: default; }
.v3-pick-opts .def-link { font-size: 12px; }
.v3-pick-opts .info-icon-wrapper { margin-left: 0; }
/* the table: compact rows, crime columns under a group header that names the crime and what the columns share, and
   the name frozen on the left while the rest scrolls (separate borders: collapsed ones do not travel with a frozen cell) */
.v3-loc-table { border-collapse: separate; border-spacing: 0; }
.v3-loc-table thead tr:first-child th:first-child, .v3-loc-table td.v3-cell-name { position: sticky; left: 0; z-index: 2;
  box-shadow: 3px 0 4px -3px rgba(0, 0, 0, 0.25); }
.v3-loc-table td.v3-cell-name { background: #fff; }
.v3-loc-table tr:hover td.v3-cell-name { background: #fafafa; }
.v3-loc-table thead th { font-size: 13px; vertical-align: bottom; }
.v3-loc-table thead th:not(.v3-group-head) { white-space: nowrap; }   /* short labels: keep the sort arrow beside them */
.v3-loc-table thead th.v3-group-head { text-align: center; font-size: 12px; color: var(--cg-dark-blue); background: #e9eef5;
  border-bottom: 1px solid var(--cg-border); border-left: 2px solid #fff; cursor: default; white-space: normal; }
.v3-loc-table thead tr + tr th.v3-group-head { background: #f1f4f8; font-weight: 600; }
.v3-loc-table thead th.v3-group-head:hover { background: #e9eef5; }
.v3-loc-table thead tr + tr th.v3-group-head:hover { background: #f1f4f8; }
.v3-loc-table thead th.v3-nosort:hover { background: var(--cg-light-gray); }
.v3-loc-table thead th.v3-nosort { cursor: default; }
.v3-loc-table td.v3-cell-name { white-space: normal; min-width: 220px; max-width: 300px; }
.v3-loc-table td.v3-cell-name a { font-weight: 600; }
.v3-loc-table td.v3-cell-type { white-space: normal; min-width: 190px; max-width: 260px; }
.v3-loc-table td.v3-cell-tags { white-space: normal; min-width: 80px; max-width: 220px; }
.v3-editbox { display: flex; align-items: flex-start; }
.v3-edittext { min-width: 0; }
.v3-loc-table .tag-badge { margin: 1px 4px 1px 0; }
.v3-notes-text { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle; }
.v3-pencil { border: 0; background: none; padding: 3px; margin-left: 4px; color: #7d8a9b; cursor: pointer; border-radius: 4px;
  vertical-align: middle; line-height: 0; opacity: 0.6; }
.v3-loc-table tr:hover .v3-pencil { opacity: 1; }
.v3-pencil:hover, .v3-pencil:focus-visible { color: var(--cg-blue); background: #eef3fb; opacity: 1; }
/* the location editor (CGV3UI.editLocation) */
.v3-modal [hidden] { display: none !important; }
.v3-modal-back { overflow-y: auto; }
.v3-modal-back.v3-editor-back { padding-top: 4vh; }
.v3-modal.v3-editor { max-width: 560px; }
.v3-editor input[type=text], .v3-editor select { height: 38px; }
.v3-editor .v3-field { margin-top: 12px; }
.v3-editor .v3-field > label { display: block; font-size: 12px; font-weight: 700; color: var(--cg-dark-blue); margin-bottom: 4px; }
.v3-editor input[type=text], .v3-editor select, .v3-editor textarea { width: 100%; padding: 8px 10px;
  border: 1px solid var(--cg-border); border-radius: 6px; font-size: 14px; font-family: inherit; color: #333; background: #fff; }
.v3-editor textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
.v3-editor input:focus, .v3-editor select:focus, .v3-editor textarea:focus { outline: none; border-color: var(--cg-blue);
  box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.12); }
.v3-editor input:disabled, .v3-editor textarea:disabled { background: #f4f5f7; color: #777; }
.v3-editor .v3-invalid { border-color: var(--cg-red); }
.v3-editor .v3-field-hint { margin-top: 4px; }
.v3-editor-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; background: #f7f9fc; border-radius: 8px;
  padding: 0 12px 10px; margin-top: 12px; }
.v3-editor-details .v3-editor-wide { grid-column: 1 / -1; margin-top: 8px; }
.v3-taginput { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 8px; border: 1px solid var(--cg-border);
  border-radius: 6px; background: #fff; min-height: 40px; cursor: text; }
.v3-taginput:focus-within { border-color: var(--cg-blue); box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.12); }
.v3-editor .v3-taginput input[type=text] { border: 0; box-shadow: none; padding: 3px 2px; flex: 1; min-width: 90px; width: auto; }
.v3-tagbubble { display: inline-flex; align-items: center; gap: 2px; background: #e8eef6; color: var(--cg-dark-blue);
  padding: 2px 4px 2px 10px; border-radius: 14px; font-size: 13px; white-space: nowrap; }
.v3-tagx { border: 0; background: none; color: var(--cg-gray); font-size: 15px; line-height: 1; width: 18px; height: 18px;
  border-radius: 50%; cursor: pointer; }
.v3-tagx:hover { color: var(--cg-red); background: rgba(221, 69, 69, 0.1); }
@media (max-width: 560px) { .v3-editor-details { grid-template-columns: 1fr; } }

/* data definitions (the text look follows data-definitions.html) */
.dd3 { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1180px; }
.dd3-nav { position: sticky; top: 0; background: #fff; border-radius: 8px; box-shadow: var(--v3-shadow); padding: 8px 0 12px;
  max-height: calc(100vh - 150px); overflow-y: auto; }
.dd3-navgroup { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--v3-muted);
  padding: 12px 16px 4px; }
.dd3-nav a { display: block; padding: 5px 16px 5px 13px; font-size: 13px; line-height: 1.4; color: #333; text-decoration: none;
  border-left: 3px solid transparent; }
.dd3-nav a:hover { background: #f5f8fc; color: var(--cg-dark-blue); }
.dd3-nav a.active { border-left-color: var(--cg-blue); background: #eef4fb; color: var(--cg-dark-blue); font-weight: 700; }
.dd3-jump { display: none; }
.dd3-content > section { scroll-margin-top: 16px; }
.dd3-content .card-header h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; width: 100%; }
.dd3-content p, .dd3-content li { font-size: 14px; line-height: 1.7; color: #444; }
.dd3-content p { margin: 0 0 10px; }
.dd3-content ul, .dd3-content ol { margin: 0 0 12px; padding-left: 22px; }
.dd3-content strong { color: var(--cg-dark-blue); }
.dd3-content a:not(.btn) { color: var(--cg-blue); }
.dd3-content h3 { font-size: 15px; color: var(--cg-dark-blue); margin: 18px 0 6px; }
.dd3-content .v3-note { font-size: 12.5px; line-height: 1.6; }
.dd3-copy { margin-left: auto; border: 0; background: none; color: #9aa6b5; cursor: pointer; padding: 4px; border-radius: 4px;
  display: inline-flex; align-items: center; opacity: 0.6; transition: opacity 0.15s; }
.dd3-content .card-header:hover .dd3-copy, .dd3-denoms tr:hover .dd3-copy, .dd3-copy:focus { opacity: 1; }
.dd3-copy:hover { background: #eef4fb; color: var(--cg-blue); }
.dd3-copy.copied { color: var(--cg-green); opacity: 1; }
.dd3-scale { margin: 12px 0 14px; max-width: 560px; font-size: 12px; }
.dd3-scale .v3-ramp { height: 12px; }
.dd3-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 10px; }
.dd3-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--v3-muted);
  padding: 8px 10px; border-bottom: 2px solid #e6e9ee; }
.dd3-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: top; line-height: 1.5; color: #333; }
.dd3-denoms td.dd3-crime { font-weight: 600; color: #222; white-space: nowrap; }
.dd3-denoms tr.sub td.dd3-crime { padding-left: 26px; font-weight: 400; }
.dd3-denoms td.dd3-crime .dd3-copy { margin-left: 4px; }
.dd3-denoms tr:target td { background: #fff8e1; }
.dd3-denoms tr { scroll-margin-top: 90px; }
.dd3 .table-wrapper { overflow-x: auto; }
.dd3-grade-table { border-collapse: collapse; font-size: 12px; margin: 6px 0 14px; }
.dd3-grade-table th, .dd3-grade-table td { padding: 5px 6px; text-align: center; white-space: nowrap; }
.dd3-grade-table tr > th:first-child { text-align: left; color: var(--v3-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.4px; padding-right: 12px; }
.dd3-grade-table .grade-badge { min-width: 34px; font-size: 12px; padding: 3px 6px; }
.dd3-swatch { display: inline-block; width: 30px; height: 10px; border-radius: 3px; }
.dd3-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.dd3-two h3 { margin-top: 4px; }
@media (max-width: 900px) {
  .dd3 { grid-template-columns: minmax(0, 1fr); }
  .dd3-nav { display: none; }
  .dd3-jump { display: block; position: sticky; top: 0; z-index: 3; width: 100%; margin-bottom: 14px; padding: 10px;
    border: 1px solid var(--cg-border); border-radius: 6px; background: #fff; font-size: 14px; font-family: inherit;
    box-shadow: var(--v3-shadow); }
  .dd3-two { grid-template-columns: 1fr; }
  .dd3-denoms td.dd3-crime { white-space: normal; }
  .dd3-content > section, .dd3-denoms tr { scroll-margin-top: 70px; }   /* clear of the sticky jump menu */
}

/* contact (the field look follows profile.html's forms) */
.v3-contact { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 20px; align-items: start; max-width: 1100px; }
.v3-field { margin-bottom: 16px; }
.v3-field label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--cg-gray); font-size: 14px; }
.v3-field input, .v3-field select, .v3-field textarea { width: 100%; padding: 10px; border: 1px solid var(--cg-border);
  border-radius: 4px; background: #fff; font-family: inherit; font-size: 14px; color: #222; }
.v3-field textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.v3-field input:focus, .v3-field select:focus, .v3-field textarea:focus { outline: 2px solid rgba(44, 90, 160, 0.35);
  border-color: var(--cg-blue); }
.v3-optional { font-weight: 400; font-size: 12px; }
.v3-count { text-align: right; margin-top: 3px; }
.v3-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.v3-form-error { background: #fde8e8; border: 1px solid #dd4545; color: #7a1c1c; border-radius: 6px; padding: 10px 12px;
  font-size: 13px; margin-bottom: 14px; }
.v3-form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.v3-sent h2 { font-size: 20px; margin-bottom: 8px; }
.v3-sent p { font-size: 14px; color: #333; }
.v3-sent-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.v3-contact-side h2 { margin-bottom: 12px; }
.v3-contact-side p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.v3-contact-side a { color: var(--cg-blue); font-weight: 600; }
@media (max-width: 900px) {
  .v3-contact { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .v3-field-row { grid-template-columns: 1fr; gap: 0; }
}

/* map view: map-view.html's layout. Its rules live inline in that page; this is the v3 page's copy, scoped. */
.v3-mapmain { padding: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.v3-mapmain > .v3-banner { margin: 0; border-radius: 0; border-width: 0 0 1px; flex-shrink: 0; }
.v3-mapmain .map-filter-bar { flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--cg-border); overflow: hidden;
  max-height: 0; transition: max-height 0.2s ease, padding 0.2s ease; padding: 0 16px; }
.v3-mapmain .map-filter-bar.active { max-height: 120px; padding: 8px 16px; }
.v3-mapmain .map-filter-bar-inner { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.v3-mapmain .map-filter-bar-label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--cg-dark-blue); white-space: nowrap; flex-shrink: 0; }
.v3-mapmain .map-filter-bar-chips { display: flex; gap: 5px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.v3-mapmain .map-filter-bar-chips::-webkit-scrollbar { display: none; }
.v3-mapmain .map-filter-bar-chips .cg-chip { font-size: 11px; padding: 2px 6px 2px 8px; }
.v3-mapmain .map-filter-bar-clear { background: none; border: none; color: var(--cg-red); font-size: 11px; font-weight: 600;
  cursor: pointer; padding: 3px 6px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; font-family: inherit; }
.v3-mapmain .map-filter-bar-clear:hover { background: rgba(221, 69, 69, 0.08); }
.v3-mapmain .map-page { display: flex; flex: 1; min-width: 0; min-height: 0; }
.v3-mapmain .map-sidebar { width: 280px; background: #fff; border-right: 1px solid var(--cg-border); flex-shrink: 0;
  display: flex; flex-direction: column; overflow: hidden; transition: width 0.3s ease, min-width 0.3s ease; }
.v3-mapmain .map-sidebar.collapsed { width: 0; min-width: 0; border-right: none; }
.v3-mapmain .map-sidebar-header { padding: 14px 16px; border-bottom: 2px solid var(--cg-border); background: var(--cg-dark-blue);
  color: #fff; flex-shrink: 0; }
.v3-mapmain .map-sidebar-header h2 { font-size: 17px; margin: 0; color: #fff; }
.v3-mv-headrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.v3-mv-count { margin: 0; font-size: 14px; opacity: 0.9; }
.v3-mv-seeall { font-size: 13px; opacity: 0.85; color: #fff; text-decoration: underline; }
.v3-mapmain .map-filter-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 5px;
  padding: 5px 7px; cursor: pointer; display: flex; align-items: center; color: #fff; position: relative; flex-shrink: 0; }
.v3-mapmain .map-filter-btn:hover, .v3-mapmain .map-filter-btn[aria-expanded="true"] { background: rgba(255,255,255,0.28); }
.v3-mapmain .map-filter-badge { position: absolute; top: -5px; right: -5px; background: var(--cg-gold); color: #333; font-size: 10px;
  font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: none; align-items: center;
  justify-content: center; padding: 0 4px; line-height: 1; }
.v3-mapmain .map-filter-badge.visible { display: flex; }
.v3-mv-filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--cg-border); background: #fafbfc; flex-shrink: 0; }
.v3-mv-filters > input, .v3-mv-filters > select { width: 100%; min-width: 0; flex: none; }
.v3-mv-filters .v3-range-label { justify-content: space-between; white-space: nowrap; }
.v3-mv-filters .v3-range-label input[type=number] { width: 70px; }
.v3-mv-filters .btn { align-self: flex-start; }
.v3-mapmain .map-stats-panel { flex-shrink: 0; border-bottom: 1px solid var(--cg-border); background: #fafbfc; font-size: 13px; }
.v3-mapmain .map-stats-header { display: flex; align-items: center; gap: 6px; padding: 10px 16px; background: #eef1f6; cursor: pointer;
  user-select: none; font-weight: 600; font-size: 12px; color: var(--cg-dark-blue); text-transform: uppercase;
  letter-spacing: 0.3px; border-bottom: 1px solid var(--cg-border); }
.v3-mapmain .map-stats-header:hover { background: #e4e9f0; }
.v3-mapmain .map-stats-arrow { font-size: 9px; transition: transform 0.2s; flex-shrink: 0; width: 12px; text-align: center; }
.v3-mapmain .map-stats-arrow.open { transform: rotate(90deg); }
.v3-mapmain .map-stats-body { padding: 10px 16px 12px; }
.v3-mapmain .map-stats-avg { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid #e8e8e8; }
.v3-mapmain .map-stats-avg-label { color: var(--cg-gray); font-size: 12px; }
.v3-mapmain .map-stats-avg-value { display: flex; align-items: center; gap: 6px; }
.v3-mapmain .map-dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.v3-mapmain .map-dist-label { flex: 0 0 108px; }
.v3-mapmain .map-dist-bar-track { flex: 1; height: 10px; background: #eee; border-radius: 3px; overflow: hidden; }
.v3-mapmain .map-dist-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.v3-mapmain .map-dist-count { flex: 0 0 46px; text-align: right; color: var(--cg-gray); font-size: 11px; }
.v3-mv-hint { margin-top: 7px; font-size: 11px; }
.v3-mapmain .grade-filter-btn { border: 0; cursor: pointer; font-family: inherit; transition: opacity 0.15s, filter 0.15s; }
.v3-mapmain .grade-filter-btn:hover { opacity: 0.85; }
.v3-mapmain .grade-filter-btn.dimmed { filter: grayscale(1); opacity: 0.35; }
/* the panel's grades are plain text: the bar beside each is its one colour */
.v3-mapmain .v3-grade-plain { background: none; padding: 2px 0; text-align: left; width: 100%; font-size: 12px;
  font-weight: 600; color: #333; }
.v3-mapmain .v3-grade-plain:hover, .v3-mapmain .v3-grade-plain[aria-pressed="true"] { text-decoration: underline;
  color: var(--cg-dark-blue); opacity: 1; }
.v3-mapmain .map-inview-filter { flex-shrink: 0; padding: 9px 16px; border-bottom: 1px solid var(--cg-border); background: #fafbfc; }
.v3-mapmain .map-inview-filter label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--cg-dark-blue);
  cursor: pointer; user-select: none; margin: 0; }
.v3-mapmain .map-inview-filter input { margin: 0; }
.v3-mapmain .map-sidebar-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #bbb #f0f0f0; }
.v3-mapmain .location-list { padding: 0; margin: 0; list-style: none; }
.v3-mapmain .location-list-item { padding: 12px 16px 12px 12px; border-bottom: 1px solid var(--cg-border);
  border-left: 4px solid transparent; cursor: pointer; transition: background 0.2s; }
.v3-mapmain .location-list-item:hover { background: var(--cg-light-gray); }
.v3-mapmain .location-list-item.active { background: rgba(44, 90, 160, 0.1); border-left-color: var(--cg-blue); }
.v3-mapmain .location-list-item.filtered-out { display: none; }
.v3-mapmain .location-title { font-weight: 600; font-size: 14px; color: var(--cg-dark-blue); margin-bottom: 1px; }
.v3-mv-addr { font-size: 13px; color: var(--cg-gray); }
.v3-mv-type { font-size: 12px; color: #444; margin: 1px 0 8px; }
.v3-mapmain .location-score { display: flex; align-items: center; gap: 8px; }
.v3-mv-grade { font-weight: 700; color: var(--cg-dark-blue); font-size: 14px; }
.v3-mapmain #mapContainer { flex: 1; min-width: 0; position: relative; }
.v3-mapmain .map-sidebar-toggle { position: absolute; top: 50%; left: 0; transform: translateY(-50%); z-index: 6; width: 24px;
  height: 48px; background: #fff; border: 1px solid var(--cg-border); border-left: none; border-radius: 0 6px 6px 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 2px 0 6px rgba(0,0,0,0.1); padding: 0; }
.v3-mapmain .map-sidebar-toggle:hover { background: #f0f0f0; }
.v3-mapmain .map-sidebar-toggle svg { width: 14px; height: 14px; transition: transform 0.3s ease; }
.v3-mapmain .map-sidebar.collapsed ~ #mapContainer .map-sidebar-toggle svg { transform: rotate(180deg); }
.v3-mapctl { position: absolute; top: 10px; left: 10px; max-width: calc(100% - 64px); z-index: 5; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px 12px; background: rgba(255,255,255,0.97); border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18); padding: 8px 12px; font-size: 13px; }
.v3-mapctl-body { display: contents; }
.v3-mapctl-toggle { display: none; border: 1px solid var(--cg-blue); background: #fff; color: var(--cg-blue); border-radius: 4px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; }
.v3-mapctl.open .v3-mapctl-toggle { background: var(--cg-blue); color: #fff; }
.v3-mapctl-crime { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--cg-dark-blue); font-size: 12px; margin: 0; }
.v3-mapctl select { padding: 5px 8px; border: 1px solid var(--cg-border); border-radius: 6px; font-size: 13px; font-family: inherit;
  background: #fff; max-width: 220px; color: #222; }
.v3-mapctl-note { flex-basis: 100%; font-size: 12px; color: var(--v3-muted); }
.v3-mapmain .map-legend { position: absolute; bottom: 30px; right: 30px; background: #fff; padding: 14px 15px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 5; width: 250px; }
.v3-mapmain .map-legend.hidden { display: none; }
.v3-mapmain .map-legend-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.v3-mapmain .legend-title { font-weight: 600; color: var(--cg-dark-blue); }
.v3-mapmain .legend-item { margin-bottom: 5px; }
.v3-mapmain .legend-item .v3-grade-key { display: block; width: 100%; padding: 6px 12px; border-radius: 4px; font-size: 12px;
  font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.35); text-align: center; }
.v3-mapmain .legend-crime { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e5e5e5; font-size: 11px; color: #333; }
.v3-mapmain .legend-close-btn { width: 20px; height: 20px; border: none; background: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: #888; border-radius: 4px; padding: 0; margin-left: 8px; }
.v3-mapmain .legend-close-btn:hover { background: #f0f0f0; color: #333; }
.v3-mapmain .legend-open-btn { position: absolute; bottom: 30px; right: 30px; width: 42px; height: 42px; background: #fff;
  border: 1px solid var(--cg-border); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; display: none;
  align-items: center; justify-content: center; z-index: 5; color: var(--cg-dark-blue); padding: 0; }
.v3-mapmain .legend-open-btn:hover { background: #f0f0f0; }
.v3-mapmain .legend-open-btn.visible { display: flex; }
.v3-mapstatus { position: absolute; top: 16px; right: 60px; max-width: 380px; padding: 10px 12px; border-radius: 6px;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 12px; line-height: 1.4; z-index: 7; }
/* pins: Overall at the location, score + grade, on the 0-1000 ramp */
.v3-pin { cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.v3-pin-label { display: flex; align-items: baseline; gap: 4px; padding: 2px 7px; border-radius: 6px; border: 2px solid #fff;
  color: #fff; font-size: 12px; line-height: 18px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  text-shadow: 0 1px 1px rgba(0,0,0,0.4); }
.v3-pin-label b { font-weight: 800; }
.v3-pin-label span { font-weight: 600; font-size: 11px; }
.v3-pin-tip { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 7px solid #fff; margin-top: -1px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.v3-pin:hover .v3-pin-label { filter: brightness(1.07); }
.v3-pin.picked .v3-pin-label { border-color: var(--cg-dark-blue); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,0.4); }
.v3-pin.picked .v3-pin-tip { border-top-color: var(--cg-dark-blue); }
/* the location popup (map-view.html's card) */
.v3-mvpopup .maplibregl-popup-content { padding: 14px 15px 12px; min-width: 230px; border-radius: 8px; }
.v3-mvpop .popup-title { display: block; font-weight: 600; font-size: 16px; color: var(--cg-dark-blue); text-decoration: none;
  margin-bottom: 2px; padding-right: 14px; }
.v3-mvpop .popup-title:hover { text-decoration: underline; }
.v3-mvpop .popup-score { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0;
  padding: 8px; background: var(--cg-light-gray); border-radius: 4px; }
.v3-mvpop-score { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.v3-mvpop-biz { font-size: 13px; color: #333; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.v3-mvpop .popup-link { display: inline-block; margin-top: 8px; color: var(--cg-blue); font-weight: 600; font-size: 14px;
  text-decoration: none; }
.v3-mvpop .popup-link:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .v3-overview { grid-template-columns: 1fr; }
  .v3-bizline { grid-template-columns: 1fr; }
  .v3-bizline-risks { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .v3-overview .overview-cards { grid-template-columns: 1fr; }
  .v3 .card-header { flex-wrap: wrap; gap: 10px; }
  .v3 .card-actions { flex-wrap: wrap; }
  .v3-mapctl { right: 54px; max-width: none; gap: 6px 8px; padding: 6px 8px; }
  .v3-mapctl:not(.open) { right: auto; max-width: calc(100% - 64px); }
  .v3-mapctl-toggle { display: inline-block; }
  .v3-mapctl-body { display: none; }
  .v3-mapctl.open .v3-mapctl-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; width: 100%; }
  .v3-mapctl select { max-width: 170px; }
  .v3-mapmain .map-legend { right: 10px; width: 220px; }
  .v3-mapmain .legend-open-btn { right: 10px; }
}
@media (max-width: 640px) {
  .v3-mapmain .map-filter-bar-chips { display: none; }
  /* phones: the locations panel slides over the map instead of squeezing it */
  .v3-mapmain .map-page { position: relative; }
  .v3-mapmain .map-sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 8; width: min(320px, 86vw);
    box-shadow: 2px 0 10px rgba(0,0,0,0.25); }
  .v3-mapmain .map-sidebar:not(.collapsed) ~ #mapContainer .map-sidebar-toggle { left: min(320px, 86vw); z-index: 9; }
}

@media (max-width: 1100px) {
  .v3-hero { grid-template-columns: 1fr; }
  .v3-maplayout { grid-template-columns: 1fr; }
  .v3-mapcontrols { border-right: 0; border-bottom: 1px solid var(--cg-border); max-height: 260px; }
  .v3-mapwrap { min-height: 460px; }
  #mapCard.v3-fs-on .v3-maplayout { grid-template-rows: auto minmax(0, 1fr); }
  #mapCard.v3-fs-on .v3-mapcontrols { max-height: 180px; }
  #mapCard.v3-fs-on .v3-mapwrap { min-height: 0; }
  .v3-bizrow > summary { grid-template-columns: 1fr; }
  .v3-bizbody { padding-left: 14px; }
}
