/* Design tokens and base */

:root {
  --ph-blue-dark: #223654;
  --ph-blue: #095797;
  --ph-blue-mid: #1472bf;
  --ph-blue-pale: #dae6f0;
  --ph-gray-pale: #f1f1f2;
  --ph-gray: #c5cad2;
  --ph-accent: #e0ad03;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Noto Sans", "Helvetica Neue", Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}

/* Application shell and header */

.ph-app {
  min-height: 100dvh;
  --ph-map-left-overlay: 0rem;
  --ph-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ph-safe-top: env(safe-area-inset-top, 0px);
  --ph-topbar-height: calc(6.25rem + var(--ph-safe-top));
  overflow: hidden;
  background: #dfe7ee;
  color: var(--ph-blue-dark);
}

.ph-topbar {
  position: fixed;
  inset: 0 0 auto;
  box-sizing: border-box;
  height: var(--ph-topbar-height);
  z-index: 50;
  border-bottom: 4px solid var(--ph-accent);
  background: var(--ph-blue-dark);
  color: #fff;
}

.ph-topbar-inner {
  display: grid;
  width: 100%;
  min-height: calc(var(--ph-topbar-height) - 4px);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding-top: calc(0.5rem + var(--ph-safe-top)) !important;
}

.ph-map-stage {
  position: fixed;
  inset: var(--ph-topbar-height) 0 0;
  z-index: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.18)), #dfe7ee;
}

.ph-brand-mark {
  display: inline-flex;
  min-height: 2.625rem;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

/* Header search and language controls */

.ph-header-search {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0;
  align-items: stretch;
}

.ph-header-search > label {
  min-width: 0;
}

.ph-header-address-input {
  height: 2.625rem;
  width: 100%;
  border-radius: 0.375rem 0 0 0.375rem;
  border: 1px solid rgba(197, 202, 210, 0.95);
  border-right: 0;
  background: rgba(255, 255, 255, 0.96);
  padding: 0 0.75rem;
  color: var(--ph-blue-dark);
  font-size: 0.875rem;
  outline: none;
}

.ph-header-address-input::placeholder {
  color: #6b778a;
}

.ph-header-address-input:focus {
  position: relative;
  z-index: 1;
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(218, 230, 240, 0.5);
}

.ph-header-search-button {
  height: 2.625rem;
  width: 2.875rem;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 0;
  background: var(--ph-blue);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background-color 0.15s ease;
}

.ph-header-search-button:hover {
  background: #19406c;
}

.ph-header-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.ph-language-button {
  height: 1.75rem;
  min-width: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0 0.5rem;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.ph-language-button:hover,
.ph-language-button:focus-visible {
  color: #fff;
}

.ph-language-button.is-active {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Map surface */

.ph-empty-map,
.ph-map-visual-center {
  box-sizing: border-box;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #4e5662;
}

.ph-empty-map-inner {
  max-width: 28rem;
  border: 1px solid rgba(136, 147, 162, 0.65);
  background: rgba(255, 255, 255, 0.84);
  padding: 1rem;
}

.ph-map-panel,
.ph-map-panel > section {
  height: 100%;
  min-height: 100%;
}

.ph-map-panel > section {
  position: relative;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ph-outage-map {
  display: block;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.ph-shell {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  pointer-events: none;
}

.ph-results-panel,
.ph-language-form,
.ph-side-rail,
.ph-dai-detail-panel {
  pointer-events: auto;
}

/* Sidebar shell, layer headers, icons, and row pills */

.ph-side-rail {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  z-index: 40;
  width: min(calc(100vw - 1rem), 42rem);
  transform: translateX(-50%);
}

.ph-current-location-button {
  display: grid;
  height: 2.625rem;
  width: 2.875rem;
  place-items: center;
  border-radius: 0 0.375rem 0.375rem 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.ph-current-location-button:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ph-current-location-button:focus-visible {
  border-radius: 0.25rem;
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

.ph-button-spinner {
  display: block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 9999px;
  animation: ph-spin 0.8s linear infinite;
}

@keyframes ph-spin {
  to {
    transform: rotate(360deg);
  }
}

#address-suggestions {
  z-index: 80;
}

.ph-context-section {
  position: relative;
  padding: 0.5rem;
}

.ph-context-section[data-layer-state="off"] {
  background: rgba(255, 255, 255, 0.66);
}

.ph-context-section-summary {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  list-style: none;
}

.ph-layer-toggle,
.ph-layer-info-button {
  display: inline-flex;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 0.375rem;
  background: transparent !important;
  padding: 0;
  color: #095797;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.ph-layer-info-button {
  color: #6b778a;
}

.ph-layer-info-button:hover,
.ph-layer-toggle:hover {
  background: rgba(232, 238, 245, 0.72) !important;
  color: #095797;
}

.ph-layer-info-button:focus-visible,
.ph-layer-toggle:focus-visible {
  outline: 2px solid #1472bf;
  outline-offset: 2px;
}

.ph-layer-toggle.is-on {
  background: transparent !important;
  color: #6b778a;
}

#ph-context-current .ph-layer-toggle {
  display: none;
}

.ph-layer-count {
  display: inline-flex;
  align-items: center;
  gap: 0.1875rem;
  min-width: 3.5rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.ph-layer-scope-pill {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  border-radius: 0.375rem;
  background: rgba(100, 116, 139, 0.1);
  padding: 0.0625rem 0.3125rem;
  color: #5d6b80;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

.ph-layer-count-value,
.ph-count-value {
  font-variant-numeric: tabular-nums;
}

.ph-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  stroke-width: 2;
}

.ph-layer-count-icon {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.78;
}

.ph-toggle-icon {
  width: 1rem;
  height: 1rem;
}

.ph-pill-icon,
.ph-status-icon,
.ph-count-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.ph-pill-icon,
.ph-status-icon {
  margin-right: 0.1875rem;
  opacity: 0.82;
}

.ph-count-icon {
  margin-left: 0.1875rem;
  opacity: 0.82;
}

.ph-layer-toggle:disabled {
  cursor: progress;
  opacity: 0.7;
}

.ph-context-section-summary > :first-child,
.ph-context-disclosure-row > summary > span:first-of-type {
  margin-right: auto;
}

.ph-context-section-summary::-webkit-details-marker,
.ph-context-disclosure-row > summary::-webkit-details-marker {
  display: none;
}

.ph-context-section-summary:focus,
.ph-context-section-summary:focus-visible,
.ph-context-disclosure-row > summary:focus,
.ph-context-disclosure-row > summary:focus-visible {
  border-radius: 0.25rem;
  outline: 2px solid #1472bf;
  outline-offset: 2px;
}

.ph-context-disclosure-row > summary::before {
  flex-shrink: 0;
  color: #6b778a;
  content: "▸";
  font-size: 0.6875rem;
}

.ph-context-disclosure-row[open] > summary::before {
  content: "▾";
}

.ph-context-rows {
  margin-top: 0.375rem;
}

.ph-map-context-list .ph-context-rows {
  max-height: 9rem;
  overflow: auto;
}

.ph-context-row,
.ph-context-nested-row {
  display: flex;
  cursor: pointer;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid rgba(197, 202, 210, 0.52);
  padding: 0.45rem 0.125rem;
  color: #223654;
  font-size: 0.75rem;
  line-height: 1.25;
  outline: none;
}

#ph-context-current .ph-context-row,
#ph-context-planned .ph-context-row,
#ph-context-previous .ph-context-row,
#ph-context-disclosure .ph-context-row,
.ph-context-summary-row {
  --ph-count-pill-width: 4.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ph-count-pill-width);
  border-top: 0;
  gap: 0.5rem;
  align-items: center;
  min-height: 0;
  padding-block: 0.1875rem;
  font-size: 0.75rem;
  line-height: 1.15;
}

.ph-context-summary-row {
  grid-template-columns: minmax(0, 1fr) 4.25rem var(--ph-count-pill-width);
  cursor: default;
}

.ph-context-summary-row--municipal {
  --ph-count-pill-width: 3.9rem;
  grid-template-columns: minmax(7rem, 1.35fr) minmax(5.75rem, 0.95fr) 3.2rem var(
      --ph-count-pill-width
    );
  gap: 0.35rem;
  min-height: 0;
  padding-block: 0.125rem;
}

.ph-context-summary-row--municipal.ph-match-row {
  min-height: 0;
}

.ph-context-subhead {
  margin: 0.45rem 0 0.125rem;
  color: #6b778a;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.ph-context-row:hover {
  background: rgba(255, 255, 255, 0.48);
}

.ph-context-row:focus-visible {
  border-radius: 0.25rem;
  box-shadow: 0 0 0 2px #1472bf;
}

.ph-context-disclosure-row > summary {
  list-style: none;
}

.ph-context-nested-rows {
  margin-left: 1rem;
  border-left: 1px solid rgba(197, 202, 210, 0.72);
  padding-left: 0.5rem;
}

.ph-context-nested-row {
  cursor: default;
  padding-block: 0.35rem;
}

.ph-context-pill {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.125rem;
  border-radius: 0.375rem;
  background: rgba(232, 238, 245, 0.86) !important;
  padding: 0.125rem 0.3125rem;
  color: #223654;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.ph-row-pill-group {
  display: grid;
  min-width: 0;
  align-items: center;
  column-gap: 0.25rem;
  row-gap: 0.1875rem;
}

#ph-context-current .ph-row-pill-group {
  grid-template-columns: 6.25rem minmax(0, 1fr);
}

#ph-context-planned .ph-row-pill-group {
  grid-template-columns: minmax(0, 1fr) 4.25rem;
}

#ph-context-previous .ph-row-pill-group {
  grid-template-columns: minmax(0, 1fr) 4.25rem;
}

#ph-context-disclosure .ph-row-pill-group {
  grid-template-columns: minmax(0, 1fr);
}

.ph-row-pill {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  min-height: 1.375rem;
  align-items: center;
  gap: 0.125rem;
  border-radius: 0.375rem;
  background: rgba(232, 238, 245, 0.76);
  padding: 0.125rem 0.375rem;
  color: #223654;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.15;
}

.ph-row-pill-time {
  background: rgba(255, 255, 255, 0.78);
  color: #095797;
}

#ph-context-current .ph-row-pill,
#ph-context-current .ph-context-pill,
#ph-context-planned .ph-row-pill,
#ph-context-planned .ph-context-pill,
#ph-context-previous .ph-row-pill,
#ph-context-previous .ph-context-pill,
#ph-context-disclosure .ph-row-pill,
#ph-context-disclosure .ph-context-pill {
  min-height: 1.25rem;
  padding: 0.0625rem 0.3125rem;
  font-size: inherit;
  line-height: 1.15;
}

#ph-context-current .ph-row-pill,
#ph-context-planned .ph-row-pill,
#ph-context-previous .ph-row-pill,
#ph-context-disclosure .ph-row-pill,
.ph-context-summary-row .ph-row-pill {
  width: 100%;
}

#ph-context-current .ph-context-pill,
#ph-context-planned .ph-context-pill,
#ph-context-previous .ph-context-pill,
#ph-context-disclosure .ph-context-pill {
  width: var(--ph-count-pill-width);
  justify-content: flex-end;
}

#ph-context-previous .ph-context-summary-row--municipal .ph-context-pill-events {
  width: 3.2rem;
}

#ph-context-current .ph-context-pill,
.ph-context-pill.bg-\[\#f8e69a\] {
  background: rgba(238, 159, 42, 0.18) !important;
  color: #223654;
}

.ph-row-pill-current-date {
  background: rgba(238, 159, 42, 0.11);
}

.ph-row-pill-current-time {
  background: rgba(238, 159, 42, 0.15);
  color: #223654;
}

.ph-row-pill-current-status {
  background: rgba(238, 159, 42, 0.09);
}

.ph-row-pill-current-status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-row-pill-planned-schedule {
  width: 100%;
  background: rgba(8, 145, 178, 0.1);
  color: #223654;
}

.ph-row-pill-planned-duration {
  width: 100%;
  background: rgba(8, 145, 178, 0.11);
  color: #223654;
}

#ph-context-planned .ph-context-pill,
.ph-context-pill.bg-\[\#dae6f0\] {
  background: rgba(8, 145, 178, 0.17) !important;
  color: #223654;
}

.ph-row-pill-previous-date {
  background: rgba(100, 116, 139, 0.1);
  color: #223654;
}

.ph-row-pill-previous-time {
  background: rgba(100, 116, 139, 0.14);
  color: #223654;
}

.ph-context-summary-row--municipal .ph-row-pill-previous-date,
.ph-context-summary-row--municipal .ph-row-pill-previous-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-context-summary-row--municipal .ph-row-pill,
.ph-context-summary-row--municipal .ph-context-pill {
  min-height: 1.25rem;
  padding-block: 0.0625rem;
}

#ph-context-previous .ph-context-pill,
.ph-context-pill-previous {
  background: rgba(100, 116, 139, 0.15) !important;
  color: #223654;
}

.ph-row-pill-published-label {
  max-width: 100%;
  background: rgba(59, 130, 246, 0.1);
  color: #223654;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ph-context-disclosure .ph-context-pill,
.ph-context-pill-disclosure {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #223654;
}

.ph-context-pill-regional {
  background: rgba(79, 70, 229, 0.13) !important;
  color: #223654;
}

#ph-context-disclosure .ph-context-pill-regional {
  background: rgba(79, 70, 229, 0.13) !important;
}

/* Detail overlay panels */

.ph-detail-card {
  --ph-detail-count-pill-width: 4.25rem;
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(197, 202, 210, 0.92);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  padding: 1rem;
  box-shadow: 0 18px 55px rgba(34, 54, 84, 0.18);
  color: #223654;
}

.ph-detail-card--current {
  --ph-detail-tone: rgba(238, 159, 42, 0.16);
  --ph-detail-tone-strong: rgba(238, 159, 42, 0.24);
}

.ph-detail-card--planned {
  --ph-detail-tone: rgba(8, 145, 178, 0.13);
  --ph-detail-tone-strong: rgba(8, 145, 178, 0.2);
}

.ph-detail-card--previous {
  --ph-detail-tone: rgba(100, 116, 139, 0.12);
  --ph-detail-tone-strong: rgba(100, 116, 139, 0.18);
}

.ph-detail-card--disclosure {
  --ph-detail-tone: rgba(59, 130, 246, 0.12);
  --ph-detail-tone-strong: rgba(59, 130, 246, 0.19);
}

.ph-detail-card--regional {
  --ph-detail-tone: rgba(79, 70, 229, 0.11);
  --ph-detail-tone-strong: rgba(79, 70, 229, 0.18);
}

.ph-detail-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.ph-detail-heading {
  min-width: 0;
}

.ph-detail-eyebrow {
  margin: 0 0 0.25rem;
  color: #095797;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
  text-transform: uppercase;
}

.ph-detail-title {
  margin: 0;
  color: #223654;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.ph-detail-subtitle {
  margin: 0.25rem 0 0;
  color: #4e5662;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.ph-detail-source-link {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.375rem;
  border-radius: 0.375rem;
  color: #095797;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.ph-detail-source-link:hover {
  color: #073d70;
  text-decoration: underline;
}

.ph-detail-source-link:focus-visible {
  outline: 2px solid #1472bf;
  outline-offset: 2px;
}

.ph-detail-source-link .ph-icon {
  width: 0.8125rem;
  height: 0.8125rem;
}

.ph-detail-source-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-detail-close {
  display: grid;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid rgba(197, 202, 210, 0.92);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  color: #4e5662;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.ph-detail-close:hover {
  background: #f1f1f2;
  color: #223654;
}

.ph-detail-close:focus-visible {
  outline: 2px solid #1472bf;
  outline-offset: 2px;
}

.ph-detail-pill-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.375rem;
  margin-top: 0.875rem;
}

.ph-detail-pill-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.ph-detail-pill {
  display: inline-flex;
  min-width: 0;
  min-height: 1.625rem;
  align-items: center;
  gap: 0.1875rem;
  border-radius: 0.4375rem;
  background: var(--ph-detail-tone, rgba(232, 238, 245, 0.86));
  padding: 0.1875rem 0.4375rem;
  color: #223654;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
}

.ph-detail-pill > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-detail-pill--count {
  justify-content: flex-end;
  width: var(--ph-detail-count-pill-width);
  margin-left: auto;
  background: var(--ph-detail-tone-strong, rgba(232, 238, 245, 0.92));
}

.ph-detail-section {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 0.875rem;
}

.ph-detail-scroll {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.ph-detail-section--scroll {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.ph-detail-section-title {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.375rem;
  color: #6b778a;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ph-detail-row-note {
  flex: 0 0 auto;
  margin: -0.125rem 0 0.375rem;
  color: #6b778a;
  font-size: 0.75rem;
  line-height: 1.25;
}

.ph-detail-event-list {
  display: grid;
  gap: 0.1875rem;
  max-height: 19rem;
  overflow: auto;
}

.ph-detail-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.25rem var(--ph-detail-count-pill-width);
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.42);
  padding: 0.1875rem;
}

.ph-detail-event-row--distance {
  grid-template-columns: minmax(0, 1fr) 4.25rem 4.25rem var(--ph-detail-count-pill-width);
}

.ph-detail-event-row .ph-detail-pill {
  width: 100%;
}

.ph-detail-source-list {
  display: grid;
  align-content: start;
  gap: 0.375rem;
  overflow: auto;
}

.ph-detail-source-list--fill {
  flex: 1 1 auto;
  min-height: 0;
}

.ph-detail-source-row {
  display: grid;
  gap: 0.25rem;
  border: 1px solid rgba(215, 221, 230, 0.72);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.46);
  padding: 0.25rem;
}

.ph-detail-source-row--primary {
  background: var(--ph-detail-tone, rgba(232, 238, 245, 0.72));
}

.ph-detail-source-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7.5rem, 0.72fr);
  gap: 0.25rem;
}

.ph-detail-source-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(3.65rem, 1fr));
  gap: 0.25rem;
}

.ph-detail-source-row--event .ph-detail-source-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.ph-detail-source-row--event .ph-detail-source-metrics {
  grid-template-columns: repeat(2, minmax(3.65rem, 1fr));
}

.ph-detail-source-main .ph-detail-pill,
.ph-detail-source-metrics .ph-detail-pill {
  width: 100%;
}

.ph-disclosure-event-row {
  display: grid;
  gap: 0.1875rem;
  border: 1px solid rgba(215, 221, 230, 0.72);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.46);
  padding: 0.1875rem;
}

.ph-disclosure-event-row-line {
  display: grid;
  align-items: center;
  gap: 0.25rem;
}

.ph-disclosure-event-row-line--time {
  grid-template-columns: minmax(0, 1fr) minmax(4.75rem, 0.22fr);
}

.ph-disclosure-event-row-line--details {
  grid-template-columns: minmax(0, 1fr);
}

.ph-disclosure-event-row--with-area .ph-disclosure-event-row-line--details {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.ph-disclosure-event-row--with-customers .ph-disclosure-event-row-line--details {
  grid-template-columns: minmax(0, 1fr) minmax(4.75rem, 0.24fr);
}

.ph-disclosure-event-row--with-area.ph-disclosure-event-row--with-customers
  .ph-disclosure-event-row-line--details {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(4.75rem, 0.24fr);
}

.ph-disclosure-event-row .ph-detail-pill {
  width: 100%;
}

.ph-disclosure-event-pill--duration,
.ph-disclosure-event-pill--customers {
  justify-content: flex-end;
}

.ph-detail-pill--muted {
  opacity: 0.72;
}

.ph-detail-table-wrap {
  max-height: 24rem;
  overflow: auto;
  border: 1px solid rgba(215, 221, 230, 0.9);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
}

.ph-detail-table {
  width: 100%;
  min-width: 38rem;
  border-collapse: collapse;
  font-size: 0.75rem;
  line-height: 1.25;
  text-align: left;
}

.ph-detail-table th {
  position: sticky;
  top: 0;
  background: rgba(241, 241, 242, 0.96);
  color: #6b778a;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ph-detail-table th,
.ph-detail-table td {
  border-bottom: 1px solid rgba(215, 221, 230, 0.72);
  padding: 0.375rem 0.5rem;
  vertical-align: top;
}

.ph-detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.ph-detail-cause-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ph-detail-table .text-right {
  text-align: right;
}

.ph-detail-table .truncate {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Detail panel narrow-screen adjustments */

@media (max-width: 767px) {
  .ph-detail-source-main {
    grid-template-columns: 1fr;
  }

  .ph-detail-source-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Search results and map-context cards */

.ph-context-empty {
  border-top: 1px solid rgba(197, 202, 210, 0.72);
  padding: 0.5rem 0.25rem 0.25rem;
  color: #4e5662;
  font-size: 0.75rem;
}

.ph-results-panel {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 8.75rem;
  z-index: 35;
  width: min(calc(100vw - 1rem), 42rem);
  max-height: min(48dvh, 26rem);
  overflow: auto;
  border: 1px solid rgba(197, 202, 210, 0.95);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 55px rgba(34, 54, 84, 0.18);
  transform: translateX(-50%);
}

.ph-panel-drawer-handle {
  display: none;
}

.ph-result-sections {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem;
}

.ph-result-sections.ph-map-context-list {
  display: flex;
  flex-direction: column;
}

.ph-map-context-list .ph-context-section {
  border-color: rgba(197, 202, 210, 0.5);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.ph-map-context-list .ph-context-section-summary h3 {
  border-left-width: 0 !important;
  padding-left: 0 !important;
  color: #5d6b80 !important;
  font-size: 0.8125rem !important;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.ph-map-context-list .ph-context-section-summary > h3,
.ph-map-context-list .ph-layer-count,
.ph-map-context-list .ph-layer-toggle,
.ph-map-context-list .ph-layer-info-button {
  line-height: 1.25;
}

.ph-result-sections {
  position: relative;
}

.ph-layer-info-overlay {
  position: absolute;
  z-index: 45;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(197, 202, 210, 0.92);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 55px rgba(34, 54, 84, 0.2);
  color: #223654;
}

.ph-layer-info-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(197, 202, 210, 0.58);
  padding: 0.875rem;
}

.ph-layer-info-heading {
  min-width: 0;
}

.ph-layer-info-eyebrow {
  margin: 0 0 0.25rem;
  color: #6b778a;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
  text-transform: uppercase;
}

.ph-layer-info-heading h4 {
  margin: 0;
  color: #223654;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.ph-layer-info-close {
  display: grid;
  flex: 0 0 auto;
  width: 1.875rem;
  height: 1.875rem;
  place-items: center;
  border: 1px solid rgba(197, 202, 210, 0.82);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: #4e5662;
}

.ph-layer-info-close:hover {
  background: #f1f1f2;
  color: #223654;
}

.ph-layer-info-close:focus-visible {
  outline: 2px solid #1472bf;
  outline-offset: 2px;
}

.ph-layer-info-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.75rem;
  overflow: auto;
  padding: 0.875rem;
}

.ph-layer-info-intro,
.ph-layer-info-section p {
  margin: 0;
  color: #4e5662;
  font-size: 0.8125rem;
  line-height: 1.42;
}

.ph-layer-info-section {
  border-radius: 0.5rem;
  background: rgba(241, 241, 242, 0.72);
  padding: 0.75rem;
}

.ph-layer-info-section h5 {
  margin: 0 0 0.35rem;
  color: #223654;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-transform: uppercase;
}

.ph-result-card {
  border: 1px solid rgba(197, 202, 210, 0.58);
  background: rgba(255, 255, 255, 0.84);
}

.ph-match-row {
  min-height: 3.75rem;
}

.ph-match-row.is-map-selected {
  border-color: rgba(9, 87, 151, 0.34);
  background: rgba(238, 246, 255, 0.72);
  box-shadow: inset 0.125rem 0 0 #095797;
}

.ph-match-row.is-map-selected:hover {
  background: rgba(229, 241, 251, 0.82);
}

.ph-map-context-list .ph-match-row {
  min-height: 2.75rem;
}

.ph-map-context-list .ph-context-summary-row--municipal.ph-match-row {
  min-height: 0;
}

.ph-match-row-compact {
  min-height: 2.375rem;
}

.ph-search-loading {
  margin: 0.75rem;
}

.ph-footer {
  display: none;
}

/* Mobile layout */

@media (max-width: 767px) {
  .ph-language-form {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .ph-header-search {
    grid-row: 2;
  }

  .ph-topbar .text-white\/80 {
    display: none;
  }

  .ph-results-panel:has(.ph-empty-results) {
    display: none;
  }

  .ph-app.ph-has-results #address-input,
  .ph-app.ph-has-results .ph-header-search-button,
  .ph-app.ph-has-results .ph-current-location-button {
    height: 2.5rem;
  }

  .ph-results-panel:has(.ph-map-context-list) {
    bottom: calc(0.75rem + var(--ph-safe-bottom));
    display: flex;
    max-height: none;
    height: var(--ph-mobile-panel-height, min(42dvh, 22rem));
    min-height: 12rem;
    overflow: hidden;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(3px);
  }

  .ph-results-panel:has(.ph-search-context-list) {
    height: var(--ph-mobile-panel-height, min(52dvh, 28rem));
  }

  .ph-app.ph-has-results .ph-results-panel:not(:has(.ph-map-context-list)) {
    bottom: calc(0.75rem + var(--ph-safe-bottom));
    max-height: min(44dvh, 22rem);
  }

  .leaflet-bottom {
    bottom: calc(var(--ph-mobile-panel-height, min(42dvh, 22rem)) + 1rem + var(--ph-safe-bottom));
  }

  .ph-panel-drawer-handle {
    display: grid;
    flex: 0 0 auto;
    height: 1.25rem;
    cursor: ns-resize;
    touch-action: none;
    place-items: center;
  }

  .ph-panel-drawer-handle::before {
    display: block;
    width: 2.75rem;
    height: 0.25rem;
    border-radius: 9999px;
    background: rgba(107, 119, 138, 0.72);
    content: "";
  }

  .ph-results-panel:has(.ph-map-context-list) .ph-result-sections {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scroll-padding-top: 0.5rem;
  }

  .ph-results-panel:has(.ph-map-context-list) .ph-context-section {
    flex: 0 0 auto;
    overflow: hidden;
  }

  .ph-results-panel:has(.ph-map-context-list) .ph-context-section:not([open]) {
    padding-block: 0.375rem;
  }

  .ph-results-panel:has(.ph-map-context-list) .ph-context-section[open] {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .ph-results-panel:has(.ph-map-context-list) .ph-context-rows {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }

  .ph-results-panel.is-expanded:has(.ph-map-context-list) .ph-result-sections {
    overflow-y: auto;
  }

  .ph-results-panel.is-expanded:has(.ph-map-context-list) .ph-context-section {
    min-height: 0;
  }

  .ph-results-panel.is-expanded:has(.ph-map-context-list) .ph-context-section-summary {
    position: sticky;
    top: 0;
    z-index: 2;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.88);
  }

  .ph-results-panel.is-expanded:has(.ph-map-context-list) .ph-context-rows {
    max-height: none;
  }

  .ph-result-card h3 {
    font-size: 0.875rem;
  }

  .ph-match-row {
    min-height: 3.25rem;
  }

  .ph-map-detail {
    display: none;
  }

  .ph-dai-detail-panel {
    position: fixed;
    top: auto;
    right: 0.75rem;
    bottom: calc(0.75rem + var(--ph-safe-bottom));
    left: 0.75rem;
    z-index: 60;
    display: block;
    min-height: 0;
    max-height: min(56dvh, 32rem);
    animation: ph-detail-sheet-in 0.18s ease-out;
  }

  .ph-dai-detail-panel[hidden] {
    display: none;
  }

  .ph-dai-detail-panel > div {
    height: 100%;
    max-height: min(56dvh, 32rem);
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 18px 55px rgba(34, 54, 84, 0.26);
  }
}

@keyframes ph-detail-sheet-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Desktop layout */

@media (min-width: 768px) {
  .ph-app {
    --ph-map-left-overlay: 27rem;
    --ph-side-rail-left: 1rem;
    --ph-side-rail-width: 25rem;
    --ph-topbar-height: calc(4.25rem + var(--ph-safe-top));
  }

  .ph-results-panel {
    position: static;
    width: 100%;
    max-height: none;
    transform: none;
    flex: 1 1 auto;
  }

  .ph-side-rail {
    top: calc(var(--ph-topbar-height) + 0.75rem);
    bottom: 1rem;
    left: var(--ph-side-rail-left);
    display: flex;
    width: min(var(--ph-side-rail-width), calc(100vw - 2rem));
    transform: none;
    flex-direction: column;
    gap: 0.75rem;
  }

  .ph-dai-detail-panel {
    position: fixed;
    top: calc(var(--ph-topbar-height) + 0.75rem);
    bottom: 1rem;
    left: var(--ph-side-rail-left);
    z-index: 60;
    display: block;
    width: min(var(--ph-side-rail-width), calc(100vw - 2rem));
    min-height: 0;
  }

  .ph-dai-detail-panel[hidden] {
    display: none;
  }

  .ph-topbar-inner {
    grid-template-columns: minmax(10rem, auto) minmax(18rem, 44rem) auto;
  }

  .ph-brand-mark {
    white-space: nowrap;
  }

  .ph-header-search {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .ph-current-location-button {
    grid-column: auto;
    white-space: nowrap;
  }

  .ph-language-form {
    justify-self: end;
  }

  .ph-side-rail .ph-results-panel {
    min-height: 0;
    overflow: auto;
  }

  .ph-side-rail .ph-results-panel:has(.ph-map-context-list) {
    display: flex;
    min-height: 0;
    border-color: rgba(197, 202, 210, 0.42);
    background: rgba(247, 249, 252, 0.58);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(34, 54, 84, 0.12);
    backdrop-filter: blur(12px);
  }

  .ph-side-rail .ph-map-context-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    width: 100%;
    gap: 0.4rem;
    padding: 0.4rem;
    overflow-y: auto;
  }

  .ph-side-rail .ph-map-context-list .ph-context-section {
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
  }

  .ph-side-rail .ph-map-context-list .ph-context-section[open] {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 10rem;
  }

  .ph-side-rail .ph-map-context-list .ph-context-section:not([open]) {
    flex-basis: auto;
    min-height: auto;
  }

  .ph-side-rail .ph-map-context-list .ph-context-rows {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }

  .ph-side-rail .ph-map-context-list .ph-context-disclosure-row[open] .ph-context-nested-rows {
    max-height: 8rem;
    overflow-y: auto;
  }

  .ph-side-rail .ph-search-loading {
    margin: 0;
  }

  .ph-empty-map,
  .ph-map-visual-center {
    padding-left: var(--ph-map-left-overlay);
    padding-right: 1.5rem;
  }
}

/* Wide desktop layout */

@media (min-width: 1180px) {
  .ph-app {
    --ph-map-left-overlay: 28rem;
    --ph-side-rail-left: 1.5rem;
    --ph-side-rail-width: 26rem;
  }

  .ph-side-rail {
    left: var(--ph-side-rail-left);
  }

  .ph-map-detail {
    right: 1.5rem;
  }
}
