
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #65748b;
  --border: #e2e8f0;
  --accent: #1f5f8b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  width: min(1500px, 96vw);
  margin: 0 auto;
  padding: 24px 0 40px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.header p {
  margin: 0;
  color: var(--muted);
}

.badge {
  background: #e8f1f8;
  border: 1px solid #c9dfef;
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.language-select {
  width: 185px;
  min-width: 185px;
  font-size: 13px;
  font-weight: 700;
}

.language-option {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.language-flag {
  display: block;
  width: 28px;
  min-width: 28px;
  height: 20px;
  object-fit: contain;
}

.language-select .Select-control {
  height: 38px;
  border-color: var(--border);
  border-radius: 10px;
}

.language-select .Select-placeholder,
.language-select .Select-value {
  line-height: 36px !important;
}

.language-select .Select-menu-outer {
  z-index: 1100;
  border-color: var(--border);
  border-radius: 0 0 10px 10px;
}

.controls,
.metrics,
.grid-2 {
  display: grid;
  gap: 14px;
}

.controls {
  grid-template-columns: repeat(3, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.controls-2 {
  grid-template-columns: repeat(2, 1fr);
}

.controls label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.metrics {
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 14px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.metric-card {
  padding: 16px;
}

.metric-title {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font-size: 23px;
  font-weight: 800;
  margin-top: 5px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.panel {
  padding: 14px;
}

.panel h3 {
  margin: 2px 0 8px;
  font-size: 17px;
}

.map-panel { position: relative; }

.map-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  margin-top: 4px;
  padding: 8px 10px 2px;
  border-top: 1px solid var(--border);
}

.map-scale {
  min-width: 130px;
  padding: 7px 9px 6px;
  border: 1px solid rgba(99, 115, 129, 0.65);
  border-radius: 6px;
  background: #fff;
  pointer-events: none;
}

.map-scale-label {
  margin-bottom: 3px;
  color: #263746;
  font-size: 11px;
  font-weight: 700;
}

.map-scale-line {
  width: 90px;
  height: 7px;
  border: 2px solid #263746;
  border-top: 0;
}

.map-key {
  display: grid;
  grid-template-columns: auto auto auto auto;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

.map-key-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.map-key-dot--station { background: #1f5f8b; opacity: .72; }
.map-key-dot--selected {
  width: 14px;
  height: 14px;
  background: #d62728;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d62728;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: right;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.institutional-footer {
  margin-top: 22px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.funding-block,
.support-block {
  padding: 20px 24px;
}

.funding-block {
  text-align: center;
  background: #eef5fa;
  border-bottom: 1px solid var(--border);
}

.institutional-footer h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 17px;
}

.funding-block p {
  max-width: 940px;
  margin: 0 auto;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

.support-block h3 {
  text-align: center;
}

.support-countries {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: 16px auto 0;
}

.country-panel {
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.country-panel h4 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.country-flag {
  display: block;
  width: 30px;
  height: 22px;
  object-fit: contain;
}

.country-grid {
  display: grid;
  gap: 12px;
}

.country-grid--brazil {
  grid-template-columns: 1fr;
}

.country-grid--argentina {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.support-card {
  display: flex;
  min-height: 180px;
  padding: 18px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.support-card:hover,
.support-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(31, 95, 139, .14);
}

.support-card img {
  display: block;
  width: auto;
  max-width: min(260px, 90%);
  height: 82px;
  object-fit: contain;
}

.support-card span {
  font-size: 12px;
  line-height: 1.35;
}

.support-card--compact {
  min-height: 142px;
  padding: 14px;
}

.support-card--compact img {
  height: 58px;
}

.support-card--compact .institution-logo--wide {
  width: 100%;
  max-width: 270px;
  height: 58px;
}

.support-card--compact .institution-logo--compact {
  width: auto;
  max-width: 175px;
  height: 62px;
}

.support-card--featured {
  border: 2px solid #75aadb;
  background: #f1f8fd;
}

.institution-wordmark {
  color: #174f7a;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: .025em;
}

.institution-wordmark--cima {
  color: #0a5c91;
  font-size: 30px;
}

.institution-wordmark--conicet {
  color: #0072a8;
}

.institution-wordmark--umaza {
  color: #7c2230;
}

.copyright {
  padding: 14px 24px;
  color: #fff;
  text-align: center;
  background: #172b4d;
  border-top: 1px solid #243b61;
  font-size: 13px;
}

.screen-tabs {
  margin-top: 4px;
}

.screen-tab {
  background: #eaf0f6 !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  padding: 13px 16px !important;
  font-weight: 700;
}

.screen-tab--selected {
  background: var(--panel) !important;
  border-top: 3px solid var(--accent) !important;
  color: var(--accent) !important;
}

.tab-content {
  padding-top: 16px;
}

.screen-help {
  color: var(--muted);
  margin: 9px 0 0;
}

.series-info {
  min-height: 18px;
  margin: 4px 8px 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

#sigma-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

#sigma-panel h4 {
  margin: 0 8px 2px;
  color: var(--text);
  font-size: 14px;
}

.quality-controls {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.quality-controls label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.residual-histograms {
  display: grid;
  gap: 12px;
}

.residual-histogram-item {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.residual-histogram-item:first-child {
  border-top: 0;
}

.residual-histogram-item h4 {
  margin: 4px 8px 0;
  font-size: 14px;
}

@media (max-width: 900px) {
  .controls { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .map-bottom-row { align-items: flex-start; flex-direction: column; }
  .map-key { grid-template-columns: auto auto; }
  .header { flex-direction: column; }
  .header-actions { width: 100%; justify-content: space-between; }
  .support-countries { grid-template-columns: 1fr; }
  .support-card { min-height: 150px; }
}

@media (max-width: 560px) {
  .country-grid--argentina { grid-template-columns: 1fr; }
}
