html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 470px;
  bottom: 0;
}

#sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 470px;
  bottom: 0;
  overflow: auto;
  border-left: 1px solid #ccc;
  background: #fff;
  padding: 12px;
  box-sizing: border-box;
}

h1 {
  margin: 0 0 4px 0;
  font-size: 20px;
}

.subtitle {
  margin-bottom: 10px;
}

.subtitle em a {
  color: #444;
  text-decoration: none;
}

.subtitle em a:hover {
  text-decoration: underline;
}

.panel {
  border: 1px solid #ddd;
  background: #fafafa;
  padding: 8px;
  margin: 8px 0;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid2 label {
  display: block;
  font-size: 12px;
}

.grid2 select,
.grid2 input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px;
  font-size: 13px;
  margin-top: 4px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.button-row.compact {
  margin-bottom: 8px;
}

button {
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f4f4f4;
  cursor: pointer;
  font-size: 13px;
}

button:hover {
  background: #e8e8e8;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

.chart {
  width: 100%;
  height: 320px;
}

.chart.tall {
  height: 520px;
}

.chart-dynamic {
  min-height: 320px;
}

.chart-scroll {
  max-height: 540px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.chart-note {
  margin-bottom: 6px;
}

.export-chart {
  width: 100%;
  height: 280px;
}

.station-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #ddd;
  padding: 8px 0;
}

.station-main {
  flex: 1;
  min-width: 0;
}

.station-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  min-width: 110px;
}

.mono {
  font-family: monospace;
  white-space: pre-wrap;
}

.small {
  font-size: 12px;
  color: #444;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-note {
  margin-top: 6px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-key {
  margin: 4px 0;
}

.legend-shape {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.circle-shape {
  border-radius: 50%;
  background: #c7e9b4;
  border: 3px solid #225ea8;
}

.triangle-shape {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #c7e9b4;
  position: relative;
}

.legend-fill {
  display: inline-block;
  width: 34px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to right, #f7fcb9, #225ea8);
  border: 1px solid #999;
}

.legend-outline {
  display: inline-block;
  width: 34px;
  height: 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 3px solid #225ea8;
}

.radius-handle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #dc2626;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

.station-svg-icon {
  background: transparent;
  border: none;
}

.selected-station-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.selected-station-row:last-child {
  border-bottom: none;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.report-card {
  border: 1px solid #ddd;
  background: #fff;
  padding: 10px;
}

.report-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
}

.report-meta {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
}

.report-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.report-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(1100px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  padding: 12px;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding-top: 4px;
}

.candidate-priority-row input[type="number"] {
  padding: 4px 6px;
  font-size: 12px;
}

#regionalCandidates,
#gapfillSummary {
  white-space: pre-wrap;
}

#gapfillChart {
  width: 100%;
  height: 300px;
}

.manual-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.manual-add-row input {
  flex: 1;
  box-sizing: border-box;
  padding: 6px;
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.search-result-row:last-child {
  border-bottom: none;
}

@media (max-width: 1000px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
}
