* { box-sizing: border-box; }

:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f7f9fc 0%, #eef3fb 100%);
}

.container {
  width: min(1200px, 94%);
  margin: 0 auto;
  padding: 36px 0 60px;
}

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

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1; }
h2 { margin-top: 0; }
.subtitle, .muted { color: #657085; line-height: 1.6; }

.card, .stat {
  background: rgba(255,255,255,.95);
  border: 1px solid #e2e7f0;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(33,45,72,.07);
}

.card { padding: 24px; margin-bottom: 20px; }

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

.api-row {
  display: flex;
  gap: 10px;
}

input, select {
  min-height: 46px;
  border: 1px solid #d6ddea;
  border-radius: 10px;
  padding: 0 13px;
  background: white;
}

input[type="url"] { flex: 1; }

button {
  border: 0;
  border-radius: 10px;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 750;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: wait; }

.primary { background: #172033; color: white; }
.secondary { background: #e9eef7; color: #172033; }
.wide { width: 100%; margin-top: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.online { background: #e3f8ea; color: #18733a; }
.badge.offline { background: #fff0f0; color: #a33b3b; }
.badge.checking { background: #fff6db; color: #815f00; }

.hint { color: #7b8495; font-size: 13px; line-height: 1.55; }
code { background: #eef1f6; padding: 2px 5px; border-radius: 5px; }

.info-list { display: grid; gap: 10px; }
.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f5;
}
.info-list span { color: #727d90; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat { padding: 17px; }
.stat span { display: block; color: #727d90; font-size: 12px; margin-bottom: 5px; }
.stat strong { font-size: 20px; }

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: flex-start;
}

.sensor-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sensor-control label { font-weight: 700; }
.sensor-control select { min-width: 180px; }

.chart-wrap {
  position: relative;
  height: 420px;
  margin-top: 12px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.forecast-card {
  padding: 14px;
  border: 1px solid #e3e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.forecast-card span { display: block; color: #727d90; font-size: 12px; }
.forecast-card strong { display: block; margin-top: 6px; font-size: 18px; }

.message {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.message.success { background: #e9f8ee; color: #176b36; }
.message.error { background: #fff0f0; color: #9d3030; }
.message.info { background: #edf3ff; color: #2b4d8a; }

.loading {
  margin-top: 12px;
  color: #657085;
  font-weight: 700;
}

.hidden { display: none; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e3e8f0;
  border-radius: 12px;
}
table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 10px 11px;
  border-bottom: 1px solid #edf0f5;
  text-align: right;
}
th:first-child, td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: white;
}
th { background: #f6f8fb; font-weight: 800; }

.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
  font-weight: 800;
}
.pipeline span {
  padding: 10px 13px;
  border: 1px solid #e1e7f0;
  border-radius: 10px;
  background: #f8fafc;
}

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .api-row, .results-header { flex-direction: column; }
  .sensor-control { width: 100%; }
  .sensor-control select { flex: 1; }
  .forecast-grid { grid-template-columns: repeat(2, 1fr); }
}
