:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #242837;
  --muted: #6f7685;
  --line: #dfe4eb;
  --temp: #2563eb;
  --visibility: #16a34a;
  --ceiling: #f97316;
}

* {
  box-sizing: border-box;
}

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

button,
table {
  font: inherit;
}

.page {
  width: min(1480px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  align-items: start;
  margin-bottom: 18px;
}

.brand-block {
  min-width: 0;
}

.station-heading {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: 0;
}

.station-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 10px;
  min-height: 36px;
}

.station-tab-shell {
  display: inline-flex;
}

.station-tab-shell.disabled {
  cursor: not-allowed;
}

.station-tab {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 680;
}

.station-tab.active {
  border-color: var(--temp);
  background: #eaf3ff;
  color: #164aa8;
}

.station-tab:disabled {
  opacity: 0.52;
  pointer-events: none;
}

.login-button {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #b7bfcc;
  padding: 0 13px;
  cursor: default;
  font-weight: 680;
  pointer-events: none;
}

.login-button:disabled {
  border-color: transparent;
  background: transparent;
  color: #b7bfcc;
  opacity: 1;
}

.service-kicker,
.service-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 560;
}

.service-kicker {
  margin-bottom: -8px;
  color: var(--text);
  font-weight: 720;
}

.metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 220px));
  gap: 14px;
  justify-content: start;
}

.metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 520;
  letter-spacing: 0;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  height: 26px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #b91c1c;
}

.status-chip[data-state="normal"] {
  display: none;
}

.status-chip[data-state="normal"] .status-dot {
  background: #16a34a;
}

.status-chip[data-state="disconnected"] {
  border-color: #fecaca;
  background: #fff5f5;
  color: #991b1b;
}

.status-label {
  color: inherit;
}

.status-value {
  color: inherit;
}

.chart-section,
.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.chart-section {
  padding: 12px 16px 12px;
  margin-bottom: 14px;
}

.chart-toolbar {
  display: flex;
  gap: 8px;
  min-height: 36px;
  align-items: center;
  margin-bottom: 6px;
}

.overlay-button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.overlay-button.active {
  color: #ffffff;
}

.overlay-button.visibility.active {
  border-color: var(--visibility);
  background: var(--visibility);
}

.overlay-button.ceiling.active {
  border-color: var(--ceiling);
  background: var(--ceiling);
}

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

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

.contact-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.contact-footer a {
  color: var(--temp);
  font-weight: 650;
  text-decoration: none;
}

.contact-footer a:hover,
.contact-footer a:focus {
  text-decoration: underline;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-observed {
  width: 14%;
}

.col-received {
  width: 16%;
}

.col-temp {
  width: 10%;
}

.col-dewpoint {
  width: 11%;
}

.col-wind-speed,
.col-visibility,
.col-ceiling {
  width: 12%;
}

.col-wind-direction {
  width: 13%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  color: var(--muted);
  background: #fbfcfe;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
}

th[data-tooltip] {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

td {
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}

td.numeric,
th.numeric {
  text-align: right;
}

tr.row-highlight td {
  animation: row-highlight-pulse 0.85s ease-in-out 0s 3;
}

tr.row-highlight td:first-child {
  animation:
    row-highlight-pulse 0.85s ease-in-out 0s 3,
    row-highlight-accent 0.85s ease-in-out 0s 3;
}

@keyframes row-highlight-pulse {
  0%,
  100% {
    background-color: transparent;
  }

  42% {
    background-color: #eaf3ff;
  }
}

@keyframes row-highlight-accent {
  0%,
  100% {
    box-shadow: inset 0 0 0 var(--temp);
  }

  42% {
    box-shadow: inset 3px 0 0 var(--temp);
  }
}

.empty {
  color: var(--muted);
  text-align: center;
}

.chart-tooltip {
  max-width: 260px;
  width: max-content;
}

.tooltip-row {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: 14px;
  align-items: baseline;
  padding: 2px 6px;
  font-size: 12px;
}

.tooltip-label {
  color: var(--muted);
}

.tooltip-value {
  text-align: right;
  white-space: nowrap;
}

.field-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #242837;
  color: #ffffff;
  box-shadow: 0 8px 24px rgb(36 40 55 / 18%);
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 9px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.field-tooltip.visible {
  visibility: visible;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  tr.row-highlight td {
    animation: none;
    background-color: #eaf3ff;
  }
}

@media (max-width: 860px) {
  .page {
    width: min(100vw - 24px, 1480px);
    padding-top: 18px;
  }

  .topbar {
    position: relative;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .brand-block {
    padding-right: 74px;
  }

  .login-button {
    position: absolute;
    top: 0;
    right: 0;
  }

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

  .metric strong {
    font-size: 26px;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100vw - 12px, 1480px);
    padding-top: 10px;
  }

  h1 {
    font-size: 24px;
  }

  .station-tabs {
    min-height: 32px;
    margin-top: 8px;
  }

  .station-tab {
    height: 30px;
    padding: 0 10px;
  }

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

  .metric {
    min-height: 64px;
    padding: 10px;
  }

  .metric-label {
    margin-bottom: 8px;
    font-size: 12px;
  }

  .metric strong {
    font-size: clamp(19px, 5vw, 22px);
  }

  .chart-section {
    padding: 8px 6px 8px;
    margin-bottom: 10px;
  }

  .chart-toolbar {
    min-height: 32px;
    margin-bottom: 2px;
  }

  .overlay-button {
    height: 30px;
    padding: 0 9px;
    font-size: 13px;
  }

  .chart {
    height: 360px;
  }
}
