.tool-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--spacing-md, 16px);
  align-items: start;
  min-height: 640px;
}

/*
  Card-styled sidebar matching the estate's own convention (compare
  crime-checker.css/drive-time-map.css's own .tool-sidebar/.sidebar-
  content/.tool-section rules) - this page's grid layout and
  max-height:700px/overflow-y:auto cap are kept as-is (the same
  convention postcode-mapper/route-optimiser/flood-risk/nearest-
  postcodes use for a shorter sidebar, per CLAUDE.md's own "LAUNCH
  BLOCKER" entry), only the VISUAL styling below is new - a bare box
  with no card chrome, headers, or button styling was Dan's actual
  "unstyled" finding (2026-09-08).
*/
.tool-sidebar {
  max-height: 700px;
  overflow-y: auto;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.sidebar-content {
  padding: 20px;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-weight: 600;
}

.tool-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.pa-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 6px;
  background: var(--surface-muted, #f3f4f6);
  border-radius: 8px;
}

/*
  Real button chrome, not plain text - a bare link-styled control was
  Dan's actual "no way back out" finding (2026-09-07): it worked when
  clicked, but nothing about it looked clickable, and at 22-26px tall it
  sat well under the ~44px touch-target floor this project's own stage
  plan already named as a real mobile risk. min-height/min-width give a
  real touch target even though the visible box stays compact.
*/
.pa-breadcrumb button {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  color: var(--link-color, #2563eb);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
}

.pa-breadcrumb button:disabled {
  background: var(--surface-muted, #e5e7eb);
  color: var(--text-primary, #111827);
  border-color: transparent;
  cursor: default;
  font-weight: 600;
}

.pa-breadcrumb .pa-breadcrumb-sep {
  color: var(--text-muted, #6b7280);
}

.pa-search-message {
  margin-top: 8px;
  font-size: 0.85rem;
  padding: 8px;
  border-radius: 6px;
  background: var(--surface-muted, #f3f4f6);
}

.pa-search-message-error {
  background: #fef2f2;
  color: #991b1b;
}

.pa-coverage-note {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pa-coverage-note p {
  margin: 0;
}

.pa-click-result {
  margin-top: 8px;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-muted, #f3f4f6);
  color: var(--text-body, #1f2937);
}

.pa-click-result-error {
  background: #fef2f2;
  color: #991b1b;
}

.pa-nongeo ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pa-nongeo li {
  background: var(--surface-muted, #f3f4f6);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.85rem;
  font-family: monospace;
}

.pa-stats {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}

.pa-export-count {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 8px;
}

.pa-map-wrap .map {
  width: 100%;
  height: 640px;
  border-radius: 8px;
}

/*
  Permanent area/district/sector code labels. Leaflet's default tooltip
  is a white bubble with a border and a directional arrow - fine for a
  hover tooltip, wrong for a label meant to sit quietly inside a coloured
  shape at all times. Stripped back to plain text with a text-shadow for
  contrast instead of a background box, so it reads over any of the
  patchwork's own fill colours without adding a second layer of visual
  noise on top of them.
*/
.pa-area-label {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-weight: 700;
  font-size: 12px;
  color: #1a1a1a;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.85),
    1px -1px 0 rgba(255,255,255,0.85),
    -1px 1px 0 rgba(255,255,255,0.85),
    1px 1px 0 rgba(255,255,255,0.85);
  pointer-events: none;
}

.pa-area-label::before {
  display: none;
}

/* Bin A pins (scripts/filter-postcode-areas-subvisible-parts.mjs) - a
   real cluster too small to draw as a polygon at any zoom, shown as a
   small dot instead. Same text treatment as a polygon label; only the
   anchor differs (a real point, not a part's own centre). */
.pa-pin-label {
  font-size: 11px;
}

/* Dark mode: white text with a dark halo, mirroring the light-mode
   approach so the label stays legible over the SAME muted fill colours
   (the patchwork's own colours are not re-themed for dark mode - see
   the Stage 1 report's own note on this, matching the site's existing
   precedent of not re-skinning vector basemap fills for dark mode). */
html[data-theme="dark"] .pa-area-label {
  color: #f5f5f5;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.85),
    1px -1px 0 rgba(0,0,0,0.85),
    -1px 1px 0 rgba(0,0,0,0.85),
    1px 1px 0 rgba(0,0,0,0.85);
}

@media (max-width: 640px) {
  .tool-container {
    grid-template-columns: 1fr;
  }

  .tool-sidebar {
    max-height: none;
    overflow-y: visible;
    order: 2;
  }

  .pa-map-wrap {
    order: 1;
  }
}
