* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ecebea;
  --text: #2f2928;
  --muted: #6b625f;
  --card: rgba(255, 255, 255, 0.45);
  --border: rgba(47, 41, 40, 0.18);
  --button-dark: #2f2928;
  --button-light: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 42%),
    radial-gradient(circle at top right, rgba(79, 76, 68, 0.05), transparent 35%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  width: 100%;
}

.navbar {
  width: min(1200px, 90%);
  margin: 22px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.98rem;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.nav-logo:hover {
  opacity: 0.65;
}

.hero {
  width: min(1200px, 90%);
  margin: 56px auto 80px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  left: -30px;
  top: -20px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
  filter: blur(18px);
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(47, 41, 40, 0.07);
  z-index: 0;
}

.hero-text {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin-bottom: 20px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero h1 {
  font-size: clamp(3.8rem, 8vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin-bottom: 26px;
  max-width: 8ch;
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.3s both;
}

.hero-description {
  font-size: 1.35rem;
  max-width: 680px;
  margin-bottom: 32px;
  color: var(--text);
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.4s both;
}

.hero-buttons {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.5s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid var(--text);
  font-size: 1rem;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--button-dark);
  color: #ffffff;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--button-light);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--button-dark);
  color: #ffffff;
}

.hero-image {
  display: flex;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.hero-image img {
  width: 100%;
  max-width: 470px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  animation: float 10s ease-in-out infinite;
}

.section-container {
  width: min(1200px, 90%);
  margin: 0 auto;
}

.intro-section,
.quick-links,
.profiles-section {
  padding: 80px 0;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.intro-card,
.link-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px;
  backdrop-filter: blur(4px);
}

.intro-card h2 {
  font-size: 2rem;
  margin-bottom: 14px;
  line-height: 1.1;
}

.intro-card p {
  font-size: 1.08rem;
  color: var(--text);
}

.section-title {
  font-size: clamp(2.4rem, 4vw, 3.8rem);
  line-height: 1;
  margin-bottom: 14px;
}

.section-subtitle {
  max-width: 760px;
  font-size: 1.12rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.link-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
  border-color: rgba(47, 41, 40, 0.28);
}

.card-label {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-card h3 {
  font-size: 1.7rem;
  line-height: 1.15;
  margin-bottom: 12px;
}

.link-card p {
  font-size: 1.02rem;
  color: var(--text);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    margin-top: 42px;
  }

  .hero-image {
    justify-content: flex-start;
  }

  .hero-image img {
    max-width: 520px;
  }

  .intro-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: 10ch;
  }
}

@media (max-width: 640px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .nav-links {
    gap: 18px;
  }

  .hero {
    width: min(92%, 1200px);
  }

  .hero h1 {
    font-size: clamp(3rem, 14vw, 4.5rem);
  }

  .hero-description {
    font-size: 1.08rem;
  }

  .btn {
    width: 100%;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .intro-card h2,
  .link-card h3 {
    font-size: 1.5rem;
  }
}

.publications-section {
  padding: 30px 0 90px;
}

.publications-list {
  display: grid;
  gap: 22px;
}

.publication-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.publication-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
  border-color: rgba(47, 41, 40, 0.25);
}

.publication-card h3 {
  font-size: 1.45rem;
  line-height: 1.2;
  margin-bottom: 10px;
}

.publication-authors {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 6px;
}

.publication-meta {
  font-size: 1rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .publication-card {
    padding: 22px;
  }

  .publication-card h3 {
    font-size: 1.2rem;
  }
}

.featured-projects {
  padding: 80px 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.8s ease 0.6s both;
}

.project-card:nth-child(2) {
  animation-delay: 0.7s;
}

.project-card:nth-child(3) {
  animation-delay: 0.8s;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  border-color: rgba(47, 41, 40, 0.28);
}

.project-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.project-card:hover img {
  transform: scale(1.02);
}

.project-content {
  padding: 20px 22px;
}

.project-content h3 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.project-content p {
  font-size: 1.05rem;
  color: var(--text);
}

.btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}


.social-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 20px;
}

.social-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s ease;
}

.social-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  border-color: rgba(47, 41, 40, 0.3);
}

.social-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.social-card h3 {
  font-size: 1.4rem;
}

@media (max-width: 900px) {
  .social-grid {
    grid-template-columns: 1fr;
  }
}

/* DARK cards (like your brown button) */
.social-primary {
  background: #2f2928;
  color: #ffffff;
  border: none;
}

.social-primary .social-label {
  color: rgba(255, 255, 255, 0.7);
}

/* WHITE card */
.social-secondary {
  background: var(--card);
  color: var(--text);
}

/* Hover behavior */
.social-primary:hover {
  transform: translateY(-4px);
  opacity: 0.95;
}

.social-secondary:hover {
  background: #2f2928;
  color: #fff;
}

.social-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;   /* 🔥 this fixes weird height */
  padding: 26px;
  border-radius: 20px;
}

.social-card h3 {
  margin-top: 6px;
  line-height: 1.2;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

}}

/* ========== Projects Page Styles ========== */

.page-hero {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  line-height: 1;
  margin-bottom: 14px;
}

.page-subtitle {
  max-width: 800px;
  font-size: 1.15rem;
  color: var(--muted);
  margin-top: 16px;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.projects-full-section {
  padding: 60px 0;
}

.projects-full-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.project-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card-full {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  transition: all 0.28s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card-link:hover .project-card-full {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.1);
  border-color: rgba(47, 41, 40, 0.35);
}

.project-card-full img {
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.project-card-full-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-card-full-content h3 {
  font-size: 1.35rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.project-card-full-content p {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 16px;
  flex-grow: 1;
}

.read-more {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.project-card-link:hover .read-more {
  color: var(--text);
}

.project-card-streamlit {
  background: linear-gradient(135deg, rgba(47, 41, 40, 0.85), rgba(47, 41, 40, 0.95));
  border-color: rgba(47, 41, 40, 0.5);
}

.project-card-link:hover .project-card-streamlit {
  background: linear-gradient(135deg, #2f2928, #1a1612);
}

.project-card-streamlit .project-card-full-content {
  color: #ffffff;
}

.project-card-streamlit .project-card-full-content h3,
.project-card-streamlit .project-card-full-content p {
  color: #ffffff;
}

.project-card-streamlit .read-more {
  color: rgba(255, 255, 255, 0.8);
}

.project-card-link:hover .project-card-streamlit .read-more {
  color: #ffffff;
}

@media (max-width: 1024px) {
  .projects-full-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .projects-full-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .page-title {
    font-size: 2.2rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }

  .project-card-full img {
    height: 180px;
  }
}

/* Random Gallery Section */
.random-gallery {
  padding: 60px 0;
  background: var(--background);
}

.random-gallery .section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.random-gallery .section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 40px;
  color: var(--text);
}

.random-photo-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

#random-photo {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

#random-photo:hover {
  transform: scale(1.05);
}

/* Gallery Page */
.gallery-section {
  padding: 60px 0;
  background: var(--background);
}

.gallery-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.slideshow-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.slideshow-container img {
  width: 100%;
  max-height: 600px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.slideshow-container .prev,
.slideshow-container .next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 16px;
  cursor: pointer;
  border-radius: 50%;
  font-size: 18px;
  transition: background 0.3s ease;
}

.slideshow-container .prev:hover,
.slideshow-container .next:hover {
  background: rgba(0, 0, 0, 0.8);
}

.slideshow-container .prev {
  left: 20px;
}

.slideshow-container .next {
  right: 20px;
}

.album-section {
  padding: 60px 0;
  background: var(--background);
}

.album-header {
  max-width: 900px;
  margin: 0 auto 32px;
  text-align: left;
}

.album-header .eyebrow {
  margin-bottom: 12px;
}

.album-header h2 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.1;
}

.album-header .section-subtitle {
  margin-top: 16px;
  color: var(--muted);
  font-size: 1rem;
  max-width: 760px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.album-grid img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.album-grid img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
}

.lightbox-container img {
  width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-prev {
  left: -80px;
}

.lightbox-next {
  right: -80px;
}

@media (max-width: 768px) {
  .lightbox-prev {
    left: 16px;
    right: auto;
    top: auto;
    bottom: 20px;
    transform: none;
  }

  .lightbox-next {
    right: 16px;
    left: auto;
    top: auto;
    bottom: 20px;
    transform: none;
  }

  .lightbox-close {
    top: 16px;
    right: 16px;
  }
}

.lightbox-caption {
  margin-top: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
}

.album-placeholder {
  text-align: center;
  padding: 60px 20px;
  background: var(--card-background);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.album-placeholder p {
  margin: 10px 0;
  color: var(--muted);
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .gallery-grid,
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  .gallery-grid img,
  .album-grid img {
    height: 200px;
  }

  #random-photo {
    max-height: 300px;
  }
}


/* ========== Sensor Dashboard ========== */
.sensor-page-hero {
  padding-top: 48px;
}

.sensor-hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 28px;
  align-items: start;
}

.sensor-eyebrow {
  opacity: 1;
  animation: none;
}

.sensor-dashboard-section {
  padding: 44px 0 90px;
}

.sensor-status-card,
.sensor-metric-card,
.sensor-panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  backdrop-filter: blur(4px);
}

.sensor-status-card {
  padding: 26px;
}

.sensor-status-card h3 {
  font-size: 1.8rem;
  line-height: 1.1;
  margin-bottom: 10px;
}

.sensor-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}

.sensor-metric-card {
  padding: 26px;
}

.sensor-metric-card h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: 8px;
}

.soil-moisture-dry {
  color: #b42b2b;
}

.soil-moisture-medium {
  color: #b36b00;
}

.soil-moisture-wet {
  color: #2f7a2f;
}

.sensor-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.sensor-controls-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.5fr);
  gap: 24px;
  margin-bottom: 24px;
}

.sensor-panel-card {
  padding: 24px;
}

.sensor-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sensor-panel-head h3 {
  font-size: 1.4rem;
  line-height: 1.15;
}

.sensor-chart-grid {
  grid-template-columns: minmax(0, 1fr);
}

.sensor-chart-panel {
  grid-column: 1;
  width: 100%;
  min-width: 0;
}

.sensor-chart-actions,
.sensor-range-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sensor-chart-controls,
.custom-range-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.custom-range-fields[hidden],
.custom-frequency-fields[hidden] {
  display: none;
}

.sensor-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sensor-control-group label,
.sensor-control-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.sensor-range-group {
  grid-column: 1 / -1;
}

.sensor-inline-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sensor-input,
.sensor-select {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font: inherit;
}

.sensor-input {
  min-width: 160px;
}

.sensor-select {
  cursor: pointer;
}

.sensor-select-compact {
  min-width: 120px;
}

.range-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.range-btn:hover {
  border-color: rgba(47, 41, 40, 0.4);
  background: rgba(47, 41, 40, 0.05);
}

.range-btn.active {
  background: var(--button-dark);
  color: #ffffff;
  border-color: var(--button-dark);
}

.sensor-chart {
  width: 100%;
  height: 260px;
  display: block;
  overflow: visible;
}

.sensor-chart-container {
  position: relative;
  width: 100%;
  height: clamp(430px, 52vh, 620px);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#sensor-chart {
  width: 100%;
  height: 100%;
}

.sensor-chart-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 22px 28px 26px;
  background: #f7f6f4;
  border-radius: 0;
  border: 0;
}

.sensor-chart-panel:fullscreen .sensor-chart-container {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  align-items: stretch;
}

.sensor-chart-panel:fullscreen .sensor-panel-head {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.sensor-chart-panel:fullscreen .sensor-chart-controls,
.sensor-chart-panel:fullscreen .custom-range-fields {
  flex: 0 0 auto;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 10px 18px;
  margin-bottom: 10px;
}

.sensor-chart-panel:fullscreen .custom-frequency-fields {
  grid-column: auto;
}

.sensor-chart-panel:fullscreen .sensor-range-group {
  grid-column: 2;
}

.sensor-chart-panel:fullscreen .range-btn,
.sensor-chart-panel:fullscreen .sensor-input,
.sensor-chart-panel:fullscreen .sensor-select {
  min-height: 34px;
}

.sensor-chart-panel:fullscreen .range-btn {
  padding: 0 14px;
}

.sensor-chart-panel:fullscreen .sensor-panel-head h3 {
  font-size: 1.35rem;
}

.sensor-chart-panel:fullscreen .card-label,
.sensor-chart-panel:fullscreen .sensor-control-group label,
.sensor-chart-panel:fullscreen .sensor-control-label {
  font-size: 0.78rem;
}

.sensor-grid-line {
  stroke: rgba(47, 41, 40, 0.12);
  stroke-width: 1;
}

.sensor-axis-label,
.sensor-chart-empty {
  font-size: 14px;
  fill: var(--muted);
}

.sensor-chart-line {
  fill: none;
  stroke-width: 3.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.sensor-chart-line-temp {
  stroke: #2f2928;
}

.sensor-chart-line-humidity {
  stroke: #75655d;
}

.sensor-chart-fill {
  opacity: 0.16;
}

.sensor-chart-fill-temp {
  fill: #2f2928;
}

.sensor-chart-fill-humidity {
  fill: #75655d;
}

.sensor-table-panel {
  margin-bottom: 24px;
}

.sensor-refresh-btn {
  min-height: 44px;
  padding: 0 18px;
}

.sensor-table-wrap {
  overflow-x: auto;
}

.sensor-table {
  width: 100%;
  border-collapse: collapse;
}

.sensor-table th,
.sensor-table td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(47, 41, 40, 0.1);
  font-size: 0.98rem;
}

.sensor-table th {
  color: var(--muted);
  font-weight: 600;
}

.sensor-api-hint code {
  background: rgba(47, 41, 40, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
}

.sensor-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(47, 41, 40, 0.1);
}

.pagination-btn {
  min-height: 40px;
  padding: 0 16px;
}

.pagination-info {
  font-size: 0.95rem;
  color: var(--muted);
  min-width: 120px;
  text-align: center;
}

.water-usage-card {
  margin-bottom: 24px;
}

.water-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 18px;
}

.water-usage-stat h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin: 8px 0;
}

.tank-progress {
  width: 100%;
  height: 14px;
  border: 1px solid rgba(47, 41, 40, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
  margin-bottom: 18px;
}

.tank-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2f7a2f;
  transition: width 0.25s ease, background 0.25s ease;
}

.tank-progress-close {
  background: #b36b00;
}

.tank-progress-refill {
  background: #b42b2b;
}

.water-usage-settings {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.water-usage-settings label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

@media (max-width: 980px) {
  .sensor-hero-grid,
  .sensor-stats-grid,
  .sensor-panels-grid,
  .sensor-controls-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sensor-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .sensor-range-selector {
    width: 100%;
    justify-content: flex-start;
  }

  .sensor-metric-card,
  .sensor-panel-card,
  .sensor-status-card {
    padding: 20px;
  }

  .sensor-pagination {
    flex-direction: column;
    gap: 10px;
  }

  .pagination-btn {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .sensor-chart-panel:fullscreen {
    padding: 18px 16px 22px;
    overflow: auto;
  }

  .sensor-chart-panel:fullscreen .sensor-chart-controls,
  .sensor-chart-panel:fullscreen .custom-range-fields {
    grid-template-columns: 1fr;
  }

  .sensor-chart-panel:fullscreen .sensor-range-group {
    grid-column: 1;
  }

  .sensor-chart-panel:fullscreen .sensor-chart-container {
    min-height: 520px;
  }
}

/* Pump Control Styles */
.pump-status {
  margin-bottom: 1rem;
}

.pump-status-display {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-align: center;
  margin: 0.5rem 0;
}

.pump-status-on {
  background-color: #d4edda;
  color: #155724;
}

.pump-status-off {
  background-color: #f8d7da;
  color: #721c24;
}

.pump-status-unknown {
  background-color: #e2e3e5;
  color: #383d41;
}

.pump-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pump-button-active-on {
  color: #ffffff !important;
  background-color: #2f7a2f !important;
  border-color: #2f7a2f !important;
}

.pump-button-active-off {
  color: #ffffff !important;
  background-color: #b42b2b !important;
  border-color: #b42b2b !important;
}

.pump-button-inactive {
  opacity: 0.8;
}

.pump-button-active-on:hover,
.pump-button-active-off:hover {
  transform: translateY(-1px);
}

.error-message {
  color: #dc3545;
  margin-top: 1rem;
}

body.control-auth-open {
  overflow: hidden;
}

.control-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 18, 16, 0.48);
}

.control-auth-modal[hidden] {
  display: none;
}

.control-auth-dialog {
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid rgba(47, 41, 40, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 50px rgba(21, 18, 16, 0.24);
}

.control-auth-dialog h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.control-auth-description {
  margin-bottom: 16px;
  color: var(--muted);
}

.control-auth-form {
  display: grid;
  gap: 12px;
}

.control-auth-input {
  width: 100%;
  min-height: 48px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.control-auth-input:focus {
  border-color: var(--button-dark);
  outline: 2px solid rgba(47, 41, 40, 0.16);
  outline-offset: 2px;
}

.control-auth-error {
  min-height: 1.2em;
  color: #dc3545;
  font-size: 0.92rem;
}

.control-auth-error:empty {
  display: none;
}

.control-auth-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
