:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --series-temp: #2a78d6;
  --series-humidity: #1baf7a;
  --series-pressure: #4a3aa7;
  --series-wind: #eb6834;
  --series-rain: #008300;
  --series-uv: #eda100;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);

    --series-temp: #3987e5;
    --series-humidity: #199e70;
    --series-pressure: #9085e9;
    --series-wind: #d95926;
    --series-rain: #008300;
    --series-uv: #c98500;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

h1 { font-size: 1.4rem; margin: 0; }

.logout {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}
.logout:hover { color: var(--text-primary); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.tile .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tile .value {
  font-size: 1.6rem;
  margin-top: 2px;
  font-variant-numeric: proportional-nums;
}

.tile .unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-left: 2px;
}

.range-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.range-switch button {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.range-switch button.active {
  color: var(--text-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.chart-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  height: 260px;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-box label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.login-box input {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--text-primary);
}

.login-box button {
  padding: 8px;
  border-radius: 6px;
  border: none;
  background: var(--series-temp);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.login-box .error { color: #e34948; font-size: 0.85rem; margin: 0; }
