.safety-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.safety-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 28px;
  border: 1px solid var(--owtl-line);
  border-radius: var(--owtl-radius);
  background:
    linear-gradient(135deg, rgba(13, 135, 116, 0.1), rgba(34, 95, 154, 0.08) 48%, rgba(215, 93, 72, 0.08)),
    rgba(255, 255, 255, 0.94);
  box-shadow: var(--owtl-shadow);
}

.safety-header h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.safety-lede {
  max-width: 790px;
  margin: 14px 0 0;
  color: var(--owtl-muted);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.62;
}

.score-card,
.method-note,
.control-panel,
.results-panel,
.source-panel,
.map-fallback {
  border: 1px solid var(--owtl-line);
  border-radius: var(--owtl-radius);
  background: rgba(255, 255, 255, 0.92);
}

.score-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border-color: var(--owtl-carbon);
}

.score-card span,
.score-card small,
.helper-text {
  color: var(--owtl-muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.score-card strong {
  font-size: 1.75rem;
  line-height: 1;
}

.score-value {
  color: var(--score-color) !important;
  font-weight: 900;
}

.method-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
}

.method-note div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: #fffefd;
}

.method-note strong {
  font-size: 0.9rem;
}

.method-note span {
  color: var(--owtl-muted);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.52;
}

.map-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(420px, 1fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.control-panel,
.results-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.control-panel {
  position: sticky;
  top: 14px;
}

.search-panel label,
.filter-panel h2,
.detail-panel h2,
.results-panel h2,
.source-panel h2 {
  margin: 0;
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row input,
.search-row button,
.quiet-button {
  min-height: 40px;
  border: 1px solid var(--owtl-carbon);
  border-radius: 6px;
  background: #fff;
  color: var(--owtl-ink);
}

.search-row input {
  min-width: 0;
  padding: 0 11px;
}

.search-row button,
.quiet-button {
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.layer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.layer-button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--owtl-line);
  border-radius: 6px;
  background: #fff;
  color: var(--owtl-ink);
  text-align: left;
  cursor: pointer;
}

.layer-button.active {
  border-color: var(--layer-color);
  box-shadow: inset 4px 0 0 var(--layer-color);
}

.layer-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--layer-color);
}

.layer-button span:nth-child(2) {
  font-weight: 800;
}

.layer-button small {
  color: var(--owtl-muted);
  font-weight: 700;
}

.layer-button small .score-value {
  font-weight: 900;
}

.detail-panel {
  display: grid;
  gap: 10px;
}

.detail-panel p {
  margin: 0;
  color: var(--owtl-muted);
  font-weight: 500;
  line-height: 1.52;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.detail-metrics div {
  padding: 9px;
  border: 1px solid var(--owtl-line);
  border-radius: 6px;
  background: #f8fbf9;
}

.detail-metrics dt {
  color: var(--owtl-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-metrics dd {
  margin: 4px 0 0;
  font-size: 1.18rem;
  font-weight: 900;
}

.map-panel {
  position: sticky;
  top: 14px;
  min-height: min(72vh, 760px);
}

.map-canvas {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 540px;
  border: 1px solid var(--owtl-carbon);
  border-radius: var(--owtl-radius);
  background: #dce8e2;
  overflow: hidden;
}

.map-fallback {
  position: absolute;
  inset: 16px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
}

.map-fallback[hidden] {
  display: none;
}

.map-legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 104px auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--owtl-carbon);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--owtl-muted);
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(14, 17, 16, 0.12);
}

.legend-ramp {
  height: 10px;
  border: 1px solid rgba(14, 17, 16, 0.24);
  border-radius: 999px;
  background: var(--legend-gradient, linear-gradient(90deg, #0d8774, #c7901d, #d75d48));
}

.map-fallback h2,
.map-fallback p {
  margin: 0;
}

.map-fallback p {
  max-width: 500px;
  color: var(--owtl-muted);
  font-weight: 500;
  line-height: 1.55;
}

.result-count {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--owtl-carbon);
  border-radius: 6px;
  background: #fff;
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 10px;
  max-height: min(66vh, 710px);
  overflow: auto;
  padding-right: 4px;
}

.result-card {
  border: 1px solid var(--owtl-line);
  border-radius: 6px;
  background: #fff;
}

.result-card.active {
  border-color: var(--owtl-carbon);
  box-shadow: inset 4px 0 0 var(--active-color, var(--owtl-green));
}

.result-select {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.result-select h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--owtl-line);
  border-radius: 999px;
  background: #f8fbf9;
  color: var(--owtl-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.score-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--owtl-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.score-track {
  height: 8px;
  border: 1px solid var(--owtl-line);
  border-radius: 999px;
  overflow: hidden;
  background: #eef2ef;
}

.score-fill {
  width: var(--score-width);
  height: 100%;
  background: var(--active-color, var(--owtl-green));
}

.safety-fill {
  background: var(--owtl-green);
}

.source-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  margin-top: 16px;
  padding: 18px;
}

.source-panel p {
  margin: 8px 0 0;
  color: var(--owtl-muted);
  font-weight: 500;
  line-height: 1.55;
}

.source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--owtl-line);
  border-radius: 6px;
  background: #fff;
}

.source-list a {
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.source-list span {
  color: var(--owtl-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.safety-info {
  max-width: 260px;
}

.safety-info h3,
.safety-info p {
  margin: 0;
}

.safety-info p {
  margin-top: 5px;
}

@media (max-width: 1120px) {
  .map-workspace {
    grid-template-columns: minmax(260px, 330px) minmax(420px, 1fr);
  }

  .control-panel,
  .map-panel {
    position: static;
    top: auto;
  }

  .results-panel {
    grid-column: 1 / -1;
  }

  .result-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 760px) {
  .safety-shell {
    width: min(100% - 20px, 720px);
    padding-top: 16px;
  }

  .safety-header,
  .method-note,
  .map-workspace,
  .source-panel,
  .result-list {
    grid-template-columns: 1fr;
  }

  .safety-header {
    padding: 20px;
  }

  .map-canvas {
    height: 62vh;
    min-height: 420px;
  }
}
