:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --ink: #1a1f2c;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --accent: #0d8b8f;
  --accent-strong: #086e71;
  --heat: #c7433c;
  --shadow: 0 16px 40px rgba(24, 37, 56, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(520px, 1.6fr);
  gap: 18px;
  align-items: end;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand-title {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-title img {
  width: clamp(44px, 5vw, 68px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(0 9px 16px rgba(24, 37, 56, 0.34))
    drop-shadow(-5px -5px 8px rgba(255, 255, 255, 0.45))
    drop-shadow(4px 5px 5px rgba(13, 139, 143, 0.24));
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.clock {
  display: block;
  margin-top: 10px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

select,
input {
  width: 100%;
  padding: 0 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  padding: 0 18px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

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

.summary article {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(24, 37, 56, 0.04);
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.summary strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: clamp(1.15rem, 2vw, 1.8rem);
  letter-spacing: 0;
}

.view {
  display: none;
  min-height: 670px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#heatmap-view {
  overflow: auto;
}

#status-view {
  overflow: auto;
}

.view.active {
  display: block;
}

.chart {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 620px;
}

.chart-message {
  display: grid;
  min-height: 520px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.map-tooltip {
  position: fixed;
  z-index: 50;
  display: none;
  width: min(840px, calc(100vw - 32px));
  max-height: min(78vh, 680px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--accent);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(5px);
  box-shadow: 0 18px 45px rgba(24, 37, 56, 0.22);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.4;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #e9eef4;
}

.map-tooltip.visible {
  display: block;
}

.map-hover-label {
  position: fixed;
  z-index: 45;
  display: none;
  padding: 6px 9px;
  border: 1px solid rgba(8, 110, 113, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(4px);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(24, 37, 56, 0.16);
  pointer-events: none;
}

.map-hover-label.visible {
  display: block;
}

.tooltip-card {
  position: relative;
  display: grid;
  gap: 10px;
}

.tooltip-close {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  width: 30px;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(13, 139, 143, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent-strong);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(24, 37, 56, 0.14);
}

.tooltip-close:hover {
  background: #ffffff;
  color: var(--ink);
}

.tooltip-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.45fr);
  gap: 14px;
  align-items: start;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tooltip-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.tooltip-header p {
  margin-top: 4px;
}

.tooltip-focus,
.tooltip-exports {
  display: grid;
  gap: 3px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(238, 248, 247, 0.72);
}

.tooltip-focus span,
.tooltip-exports span,
.tooltip-section h3 {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tooltip-focus strong,
.tooltip-exports strong {
  font-size: 0.98rem;
}

.tooltip-focus em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.tooltip-exports small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.tooltip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
}

.tooltip-section {
  min-width: 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
}

.tooltip-section h3 {
  margin: 0 0 6px;
}

.tooltip-section dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.tooltip-section dl div {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto auto;
  gap: 8px;
  align-items: baseline;
}

.tooltip-section dt {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tooltip-section small {
  color: var(--accent-strong);
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}

.tooltip-section dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

#map-chart .choroplethlocation.country-active {
  stroke: #083f42 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 4px rgba(8, 110, 113, 0.55));
}

.heatmap-chart {
  width: 100%;
  height: 78vh;
  min-height: 700px;
}

.status-board {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.status-band,
.status-grid article,
.status-columns article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.status-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.status-hero span,
.status-grid span,
.status-columns h2,
.status-columns dt,
.status-pulse span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status-hero strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

.status-pulse {
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef8f7;
}

.status-pulse strong {
  font-size: 1rem;
}

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

.status-grid article {
  min-width: 0;
  padding: 14px;
}

.status-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: clamp(1.15rem, 2vw, 1.75rem);
}

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

.status-columns article {
  min-width: 0;
  padding: 16px;
}

.status-columns h2 {
  margin: 0 0 12px;
  color: var(--accent-strong);
}

.status-columns dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.status-columns dl div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf1f5;
}

.status-columns dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .topbar,
  .controls,
  .summary,
  .status-grid,
  .status-columns {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    align-items: start;
  }

  .segmented {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 1480px);
    padding: 14px 0;
  }

  .topbar,
  .controls,
  .summary,
  .status-grid,
  .status-columns,
  .status-hero {
    grid-template-columns: 1fr;
  }

  .chart,
  .heatmap-chart {
    height: 72vh;
    min-height: 520px;
  }

  .tooltip-header,
  .tooltip-grid {
    grid-template-columns: 1fr;
  }
}
