:root {
  --bg-main: #10161d;
  --bg-card: #1b2638;
  --text-primary: #e8fefe;
  --text-secondary: #9bdede;
  --text-muted: #6a8f8f;
  --accent-temp: #7df9ff;
  --accent-hum: #6ad6c8;
  --warn: #f2c94c;
  --critical: #eb5757;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.page {
  max-width: 815px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.sensor-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 5px 5px 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

  .sensor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.04);
  }

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.temp {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(180deg, #DDfcff, #5fdde0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

  .temp.critical {
    background: none;
    color: var(--critical);
    -webkit-text-fill-color: initial;
  }

.footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.hum {
  font-size: 1rem;
  font-weight: 600;
  /*color: var(--accent-hum);*/
  background: linear-gradient(180deg, #BBfcff, #5fdde0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.smalltext {
  font-size: 1rem;
  background: linear-gradient(180deg, #9ffcff, #5fdde0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-left: 5px;
}

  .hum.warn {
    color: var(--warn);
  }

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.pin-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  text-align: center;
}

.pin-input {
  font-size: 1.4rem;
  letter-spacing: 0.3rem;
  text-align: center;
  width: 160px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg-card);
  color: var(--text-primary);
}

.pin-button {
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: var(--accent-hum);
  color: #0a1414;
  cursor: pointer;
}

.pin-error {
  color: var(--critical);
  margin: 0;
}

.lamp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.lamp-toggle {
  width: 100%;
  margin-top: auto;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

  .lamp-toggle.on {
    background: linear-gradient(180deg, #ffe98a, #f2c94c);
    color: #3a2e00;
  }

  .lamp-toggle.off {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
  }

  .lamp-toggle:disabled {
    opacity: 0.6;
    cursor: default;
  }

.lamp-card.all-toggle {
  grid-column: span 2;
}

.page-dots {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 5;
}

.page-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

  .page-dots .dot.active {
    background: var(--accent-hum);
    transform: scale(1.3);
  }

