* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #eef1f4;
  color: #17202a;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.page-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px 20px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.08);
}

.page-header h1 {
  margin: 2px 0 0;
  font-size: 1.9rem;
  font-weight: 700;
  color: #17324d;
}

.eyebrow {
  margin: 0;
  color: #5f6f7b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.aux-link {
  display: inline-block;
  border: 1px solid #8fb393;
  border-radius: 7px;
  background: #e5efe6;
  color: #27572b;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 14px;
}

.tabs {
  display: flex;
  gap: 4px;
  border: 1px solid #bfccd3;
  border-radius: 8px;
  background: #dfe6ea;
  padding: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #314755;
  font-size: 1rem;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
}

.tab-btn.active {
  background: #ffffff;
  color: #17324d;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.1);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.subtabs {
  display: flex;
  gap: 4px;
  border: 1px solid #bfccd3;
  border-radius: 8px;
  background: #dfe6ea;
  padding: 4px;
  margin: 0 0 14px;
}

.subtab-btn {
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #314755;
  font-size: 0.96rem;
  font-weight: 700;
  padding: 10px 12px;
  cursor: pointer;
}

.subtab-btn.active {
  background: #ffffff;
  color: #17324d;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.1);
}

.safety-subtab-panel {
  display: none;
}

.safety-subtab-panel.active {
  display: block;
}

.map-subtab-panel {
  display: none;
}

.map-subtab-panel.active {
  display: block;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.15fr);
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
  border-bottom: 1px solid #d4dde2;
  padding-bottom: 14px;
}

.section-head h2 {
  margin: 2px 0 0;
  color: #17324d;
  font-size: 1.35rem;
}

.analysis-block {
  margin-bottom: 18px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
}

.analysis-block h3 {
  margin: 0 0 6px;
  color: #17324d;
  font-size: 1.16rem;
}

.analysis-intro-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 12px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.field {
  display: block;
}

.field span {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin: 2px 0 6px;
}

.field .field-label-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
}

.field .field-label-inline > span {
  margin: 0;
  display: inline;
}

.help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid #97a7b3;
  border-radius: 50%;
  background: #f4f7f9;
  color: #43535e;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  overflow: visible;
}

.help-icon:hover {
  background: #e8eef2;
}

.help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 240px;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
  color: #17202a;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 4px 14px rgba(23, 32, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
}

.help-icon:hover::after,
.help-icon:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.filter-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-field legend {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

select,
input,
button {
  font-family: Arial, sans-serif;
}

select,
input {
  width: 100%;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
  color: #17202a;
  padding: 8px 10px;
  font-size: 1rem;
}

.compare-options {
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
  padding: 8px 10px;
  display: grid;
  gap: 8px;
}

.compare-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.compare-option input {
  width: auto;
  margin: 0;
}

.filter-options {
  padding: 0;
  display: grid;
  gap: 2px;
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
  padding: 1px 0;
}

.filter-label-text {
  flex: 1;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}

.switch-slider {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #bcbcbc;
  transition: background-color 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: #34c759;
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.note {
  margin: 0;
  color: #6f6f6f;
  font-size: 0.95rem;
  line-height: 1.3;
}

.section-description {
  margin: 6px 0 14px;
  color: #4b5c67;
  font-size: 1rem;
  line-height: 1.55;
}

#calc-btn,
#split-run-btn,
#tab3-run-btn {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid #1f5a8a;
  border-radius: 5px;
  background: #1f5a8a;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 9px 10px;
  cursor: pointer;
}

#tab3-run-btn {
  grid-column: auto;
  width: auto;
  justify-self: end;
  min-width: 164px;
  padding-left: 16px;
  padding-right: 16px;
}

.safety-control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.safety-control-grid select,
.safety-control-grid input,
.safety-control-grid .state-picker summary {
  min-height: 40px;
}

.safety-control-grid select,
.safety-control-grid input {
  min-height: 42px;
}

.safety-control-grid .state-picker summary {
  padding-top: 8px;
  padding-bottom: 8px;
}

.overlap-control-row {
  grid-template-columns: 1fr;
}

.comparison-control-row {
  grid-template-columns: 1fr;
}

.overlap-control-row .safety-control-grid {
  grid-template-columns:
    minmax(180px, 0.8fr)
    minmax(240px, 1.25fr)
    minmax(230px, 1.15fr)
    auto;
  align-items: end;
}

.comparison-control-row .safety-control-grid {
  grid-template-columns:
    minmax(120px, 0.55fr)
    minmax(230px, 1.25fr)
    minmax(210px, 1fr)
    minmax(90px, 0.45fr)
    auto;
  align-items: end;
}

.safety-control-grid #calc-btn,
.safety-control-grid #split-run-btn {
  grid-column: auto;
  width: auto;
  min-width: 132px;
  justify-self: end;
  min-height: 38px;
}

#calc-btn:disabled,
#split-run-btn:disabled,
#tab3-run-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

.status {
  margin: 10px 0;
  min-height: 36px;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.95rem;
}

.status.info {
  color: #314755;
  background: #e1e8ed;
}

.status.success {
  color: #215732;
  background: #dcebdd;
}

.status.error {
  color: #8a1d1d;
  background: #f3dddd;
}

.empty-card,
.coming-soon {
  border: 1px dashed #b5b5b5;
  border-radius: 6px;
  background: #ececec;
  color: #505050;
  font-size: 0.95rem;
  padding: 11px;
  margin-bottom: 10px;
}

.result-summary {
  font-size: 0.95rem;
  margin: 4px 0 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  margin-bottom: 12px;
}

th,
td {
  border: 1px solid #c7c7c7;
  text-align: center;
  padding: 6px;
  font-size: 0.95rem;
}

th {
  background: #d4dfd7;
  font-weight: 700;
}

.chart-card {
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
}

.chart-card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #17324d;
}

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

.chart-title-row h2 {
  margin: 0;
}

.secondary-action {
  border: 1px solid #7f99aa;
  border-radius: 5px;
  background: #f4f7f9;
  color: #17324d;
  padding: 7px 11px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-action:hover {
  background: #e8eef2;
}

.chart-frame {
  position: relative;
  min-height: 420px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 6px;
}

.split-grid {
  margin-bottom: 10px;
}

.tab3-grid {
  grid-template-columns:
    minmax(220px, 1.4fr)
    minmax(180px, 1fr)
    minmax(140px, 0.6fr)
    auto;
  gap: 12px 14px;
}

.tab3-grid select,
.tab3-grid input,
.tab3-grid .state-picker summary,
.cluster-grid select,
.cluster-grid input,
.cluster-grid .state-picker summary {
  min-height: 42px;
}

.cluster-grid {
  grid-template-columns: minmax(320px, 1.2fr) minmax(180px, 0.7fr) minmax(180px, 0.7fr);
  align-items: start;
}

.cluster-states-field {
  align-self: start;
}

.cluster-map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: calc(100% - 24px);
}

.cluster-layer-toggles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(23, 32, 42, 0.12);
  backdrop-filter: blur(4px);
}

.cluster-layer-toggles > span {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 2px;
  color: #17202a;
}

.cluster-layer-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #314755;
  cursor: pointer;
  white-space: nowrap;
}

.cluster-layer-toggles input {
  width: auto;
  margin: 0;
}

.cluster-summary-action {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  border: 1px solid #1f5a8a;
  border-radius: 5px;
  background: rgba(31, 90, 138, 0.96);
  color: #ffffff;
  padding: 8px 10px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(23, 32, 42, 0.14);
}

.cluster-summary-action:hover:not(:disabled) {
  background: #17496f;
}

.cluster-summary-action:disabled {
  border-color: #aab7c0;
  background: rgba(236, 240, 243, 0.92);
  color: #667985;
  cursor: default;
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.08);
}

.picker-toggle {
  display: inline-flex;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
  background: #ffffff;
}

.picker-toggle-btn {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #314755;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 7px 12px;
}

.picker-toggle-btn + .picker-toggle-btn {
  border-left: 1px solid #aab7c0;
}

.picker-toggle-btn.active {
  background: #1f5a8a;
  color: #ffffff;
}

.picker-hex {
  max-width: 560px;
}

.picker-hex svg {
  width: 100%;
  height: auto;
  display: block;
}

.hex-tile {
  cursor: pointer;
}

.hex-tile polygon {
  fill: #e8eef2;
  stroke: #ffffff;
  stroke-width: 1.5;
  transition: fill 0.12s;
}

.hex-tile text {
  fill: #17324d;
  font: 700 9px Arial, sans-serif;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

.hex-tile:hover polygon {
  fill: #b7d0df;
}

.hex-tile[aria-pressed="true"] polygon {
  fill: #1f5a8a;
}

.hex-tile[aria-pressed="true"] text {
  fill: #ffffff;
}

.hex-tile:focus {
  outline: none;
}

.hex-tile:focus polygon {
  stroke: #17202a;
  stroke-width: 2.5;
}

.hex-tile.at-cap {
  cursor: not-allowed;
}

.hex-tile.at-cap polygon {
  fill: #eeeeee;
  opacity: 0.55;
}

.picker-list-wrap {
  max-width: 420px;
}

.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  margin-bottom: 6px;
}

.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: #1f5a8a;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 8px 3px 6px;
}

.picker-chip button {
  border: 0;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.picker-search {
  margin-bottom: 6px;
}

.picker-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
}

.picker-row {
  padding: 7px 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.picker-row:hover {
  background: #eef4f7;
}

.picker-row[aria-selected="true"] {
  background: #1f5a8a;
  color: #ffffff;
}

.picker-row:focus {
  outline: 2px solid #17324d;
  outline-offset: -2px;
}

.picker-row.at-cap {
  color: #8a8a8a;
  cursor: not-allowed;
}

.picker-hint {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: #8a1d1d;
  font-size: 0.9rem;
}

.cluster-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 12px;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid #d8e0e4;
  border-radius: 6px;
  background: #f8fafb;
}

.legend-header {
  grid-column: 1 / -1;
  color: #38463a;
  font-size: 0.92rem;
  font-weight: 700;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.legend-color {
  width: 22px;
  height: 22px;
  border: 1px solid #97a7b3;
  border-radius: 50%;
  flex: 0 0 auto;
}

#cluster-map {
  width: 100%;
  height: 520px;
}

.tab3-rank-row {
  padding: 10px 10px 8px;
  border-top: 1px solid #d0d9df;
  margin-top: 2px;
}

.tab3-rank-field {
  max-width: 420px;
}

.tab3-rank-row.hidden {
  display: none !important;
}

.tab3-grid > .field {
  min-width: 0;
}

.tab3-field-switch .mode-switch {
  width: 100%;
  max-width: 260px;
  justify-content: space-between;
}

.tab3-compare-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.tab3-compare-group {
  display: grid;
  gap: 8px;
  flex: 0 0 240px;
}

.tab3-compare-field-wrap {
  width: 260px;
  flex: 0 0 260px;
}

.tab3-compare-group .mode-switch {
  max-width: 220px;
}

.tab3-compare-field {
  margin-top: 0;
  width: 100%;
}

.tab3-field-compact {
  justify-self: start;
}

.tab3-field-compact input {
  max-width: 136px;
}

.tab3-field-compact span {
  white-space: nowrap;
}

.state-picker {
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
}

.state-picker summary {
  list-style: none;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #17202a;
  user-select: none;
}

.state-picker summary > span {
  flex: 1 1 auto;
}

.state-picker summary::after {
  content: "▾";
  color: #5b6b75;
  font-size: 0.8rem;
}

.state-picker summary::-webkit-details-marker {
  display: none;
}

.state-picker[open] summary {
  border-bottom: 1px solid #d0d9df;
}

.state-picker[open] summary::after {
  content: "▴";
}

.clear-selection {
  border: 1px solid #97aa99;
  border-radius: 4px;
  background: #ebf2ec;
  color: #234f27;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.clear-selection:hover {
  background: #dde8df;
}

.picker-footer {
  padding: 8px 10px;
  border-top: 1px solid #d0d9df;
  display: flex;
  justify-content: flex-end;
}

.state-confirm-btn {
  border: 1px solid #1a6fa8;
  border-radius: 4px;
  background: #2980b9;
  color: #fff;
  padding: 6px 18px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.state-confirm-btn:hover {
  background: #1f6391;
}

.state-checkbox-grid {
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  min-height: 150px;
  max-height: 180px;
  overflow: auto;
}

.overlap-checkbox-grid {
  grid-template-columns: 1fr;
}

.state-checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.state-checkbox-option input {
  width: auto;
  margin: 0;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #aab7c0;
  border-radius: 5px;
  background: #ffffff;
  padding: 0 10px;
  height: 36px;
  width: fit-content;
  box-sizing: border-box;
}

.mode-switch > span {
  font-size: 0.9rem;
  font-weight: 700;
  color: #43535e;
  line-height: 1;
  white-space: nowrap;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch .switch-slider {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #bcbcbc;
  transition: background-color 0.2s ease;
  flex: 0 0 auto;
}

.mode-switch .switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.mode-switch input:checked + .switch-slider {
  background: #1f5a8a;
}

.mode-switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.mode-switch:focus-within {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.tab3-result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.tab3-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin: 2px 0 10px;
  color: #38463a;
  font-size: 0.92rem;
}

.tab3-pagination-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.tab3-pagination button {
  border: 1px solid #97aa99;
  border-radius: 4px;
  background: #ebf2ec;
  color: #234f27;
  padding: 5px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.tab3-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tab3-page-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab3-page-size-control span {
  font-weight: 700;
}

.tab3-page-size-control select {
  width: auto;
  min-width: 88px;
  padding: 5px 8px;
}

#tab3-download-btn {
  border: 1px solid #8ca890;
  border-radius: 4px;
  background: #e0ece2;
  color: #1f5a23;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

#tab3-download-btn:hover {
  background: #d3e3d5;
}

.split-result {
  margin-bottom: 12px;
}

.split-boxplot {
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  margin-bottom: 8px;
}

.split-boxplot-title {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: #434343;
}

.split-boxplot svg {
  width: 100%;
  height: auto;
  display: block;
}

.split-output-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 12px;
  align-items: start;
}

.split-stat-table table {
  min-width: 760px;
}

.split-context-list {
  margin: 0 0 12px;
  padding-left: 20px;
  color: #516254;
  line-height: 1.5;
}

.split-context-list li + li {
  margin-top: 4px;
}

.split-context-list strong {
  color: #243528;
}

.split-interpretation {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #d8e0e4;
  border-radius: 6px;
  background: #f8fafb;
  color: #314755;
  line-height: 1.5;
}

.split-interpretation h4 {
  margin: 0 0 6px;
  color: #243528;
  font-size: 0.96rem;
}

.split-interpretation p {
  margin: 0;
}

.split-interpretation p + p {
  margin-top: 8px;
}

.comparison-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.comparison-badge-higher {
  border: 1px solid #d9a38f;
  background: #fff0e8;
  color: #8a3b25;
}

.comparison-badge-lower {
  border: 1px solid #5a8b64;
  background: #e2f0e4;
  color: #1f5a23;
}

.comparison-badge-same {
  border: 1px solid #9aa8b0;
  background: #edf2f5;
  color: #43535e;
}

.split-filter-note {
  margin: 2px 0 8px;
  font-size: 0.9rem;
  color: #4c4c4c;
}

.filter-note {
  margin: 6px 0 8px;
  font-size: 0.9rem;
  color: #4c4c4c;
  line-height: 1.4;
}

.filter-note code {
  font-family:
    Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88em;
  background: #efefef;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 1px 4px;
}

.split-meta {
  margin: 2px 0 8px;
  color: #4c4c4c;
  font-size: 0.92rem;
}

.tab3-aggregation {
  margin: 14px 0 10px;
}

.hidden {
  display: none !important;
}

.tab3-map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.tab3-map-layout.is-compare {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tab3-map-panel {
  min-width: 0;
}

.tab3-map-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.tab3-map-panel-head h3 {
  margin: 0;
  color: #17324d;
  font-size: 1rem;
}

.tab3-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tab3-summary-panel {
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
}

.tab3-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.tab3-summary-head h3 {
  margin: 0;
  color: #17324d;
  font-size: 1.05rem;
}

.tab3-summary-head p {
  margin: 0;
  color: #4c4c4c;
  font-size: 0.92rem;
}

.tab3-summary-story {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #d8e0e4;
  border-radius: 6px;
  background: #f8fafb;
}

.tab3-story-text {
  margin: 0 0 8px;
  color: #38463a;
  font-size: 0.92rem;
  line-height: 1.45;
}

.tab3-story-list {
  margin: 0;
  padding-left: 18px;
  color: #2c3a33;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tab3-story-list li {
  margin: 0 0 4px;
}

.tab3-story-list strong {
  color: #17324d;
}

.tab3-summary-table {
  min-width: 0;
}

.tab3-popup {
  min-width: 280px;
  max-width: 340px;
}

.tab3-popup-row {
  width: 100%;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  font-size: 0.7rem;
  line-height: 1.15;
  margin: 0;
  padding: 4px 0;
  border-bottom: 1px solid #e8ecef;
}

.tab3-popup-row:last-child {
  border-bottom: none;
}

.tab3-popup-label,
.tab3-popup-value {
  min-width: 0;
  padding: 0;
}

.tab3-popup-label {
  color: #17324d;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tab3-popup-value {
  color: #22313f;
  overflow-wrap: anywhere;
}

.map-frame {
  position: relative;
  min-height: 460px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  overflow: hidden;
}

#split-map {
  width: 100%;
  height: 460px;
}

#tab3-map {
  width: 100%;
  height: 520px;
}

#tab3-compare-map {
  width: 100%;
  height: 520px;
}

@media (max-width: 1100px) {
  .section-head,
  .analysis-intro-grid,
  .split-output-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .subtabs {
    flex-direction: column;
  }

  .tab3-summary-grid {
    grid-template-columns: 1fr;
  }

  .tab3-map-layout.is-compare {
    grid-template-columns: 1fr;
  }

  .tab3-grid {
    grid-template-columns: 1fr;
  }

  .cluster-grid {
    grid-template-columns: 1fr;
  }

  .cluster-map-controls {
    left: 10px;
    right: 10px;
    max-width: 220px;
  }

  .cluster-summary-action {
    left: 10px;
    bottom: 10px;
  }

  .page-header h1,
  .aux-link,
  .tab-btn,
  .field span,
  select,
  input,
  #calc-btn,
  #split-run-btn,
  .status,
  .empty-card,
  .coming-soon,
  .result-summary,
  th,
  td,
  .chart-card h2,
  .note,
  .section-description {
    font-size: clamp(14px, 2.8vw, 21px);
  }

  .container {
    padding: 0 10px 16px;
  }
}

@media print {
  body {
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  #tab-map .map-card,
  #tab-map .map-card * {
    visibility: visible;
  }

  #tab-map .map-card {
    position: absolute;
    inset: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .tabs,
  .page-header,
  .secondary-action,
  #tab3-status,
  #tab3-result {
    display: none;
  }

  .map-frame,
  #tab3-map {
    height: 7.5in;
  }
}
