:root {
  --bg: #f3f6ee;
  --ink: #1e2520;
  --muted: #576357;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(42, 66, 52, 0.16);
  --accent: #1f7a4c;
  --accent-2: #d08c1b;
  --danger: #9d3226;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 10% -10%, #e2f0cd, transparent 60%),
    radial-gradient(1000px 600px at 90% 0%, #f7e4c4, transparent 60%), var(--bg);
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
}

.bg-shape-1 {
  width: 300px;
  height: 300px;
  background: #acd78f;
  top: 20px;
  left: 20px;
}

.bg-shape-2 {
  width: 260px;
  height: 260px;
  background: #f0b066;
  right: 24px;
  bottom: 40px;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  width: 100%;
}

.topbar {
  position: relative;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(34, 65, 45, 0.12);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  flex: none;
  text-align: center;
}

.brand-logo img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin: 0 auto 4px;
  border-radius: 12px;
}

.brand-logo .eyebrow {
  margin: 0;
  font-size: 8px;
}

.brand-header h1 {
  font-size: clamp(17px, 4.5vw, 23px);
  line-height: 1.12;
}

.header-nav {
  display: contents;
}

.header-links {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.header-links button {
  padding: 8px 12px;
  font-size: 13px;
}

.account-wrap {
  position: relative;
  grid-column: 2;
  grid-row: 1;
}

.account-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border-radius: 14px;
  cursor: pointer;
  list-style: none;
}

.account-toggle::-webkit-details-marker {
  display: none;
}

.account-toggle:hover,
.account-wrap[open] .account-toggle {
  background: #edf4ee;
}

.account-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #205a3c;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.account-toggle-label {
  font-size: 13px;
  font-weight: 700;
}

.account-chevron {
  color: var(--muted);
  font-size: 12px;
}

.account-menu {
  width: min(260px, calc(100vw - 48px));
}

.account-info {
  display: grid;
  gap: 3px;
  padding: 10px 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.account-info strong {
  font-size: 14px;
}

.account-info span {
  color: var(--muted);
  font-size: 12px;
}

.menu .account-item-active {
  background: #edf4ee;
  color: #205a3c;
  font-weight: 700;
}

.site-footer {
  position: relative;
  z-index: 1;
  margin: auto auto 0;
  padding: 12px 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.site-footer img {
  width: 64px;
  height: 54px;
  object-fit: contain;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.05;
}

h2,
h3 {
  margin: 0;
}

select,
button,
input,
textarea {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.07);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

button.ghost {
  background: rgba(87, 99, 87, 0.14);
  color: var(--ink);
}

button.nav-active {
  background: #315b47;
  color: #fff;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button.small {
  padding: 6px 10px;
  font-size: 13px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 15px;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

label.inline input {
  width: auto;
  margin: 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  animation: rise 500ms ease;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 20px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel.panel-top {
  position: relative;
  z-index: 20;
}

.menu-wrap {
  position: relative;
  display: flex;
}

button.gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
}

button.gear svg {
  display: block;
  width: 1.25em;
  height: 1.25em;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge.status {
  font-size: 12px;
  padding: 4px 10px;
  margin: 0;
}

.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.cycle-detail section {
  margin-bottom: 14px;
}

.cycle-detail h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

.detail-item {
  background: rgba(87, 99, 87, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
}

.detail-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.detail-image img {
  width: min(420px, 100%);
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  margin-bottom: 6px;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.menu[hidden] {
  display: none;
}

.refresh-menu {
  min-width: 150px;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  align-items: stretch;
}

.refresh-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 0 4px;
}

.refresh-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.refresh-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: slider-vertical;
  width: 24px;
  height: 140px;
  max-height: 140px;
  margin: 0;
  padding: 0;
}

.menu .menu-item {
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
}

.menu .menu-item:hover {
  background: rgba(87, 99, 87, 0.14);
  filter: none;
}

.menu .menu-item.danger-text {
  color: var(--danger);
  font-weight: 600;
}

.menu-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard {
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.value {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
}

.card.sensor-list-card {
  min-width: 0;
}

.sensor-list-card-value {
  max-height: 72px;
  overflow: auto;
  overscroll-behavior: contain;
  white-space: pre;
  font-size: 13px;
  line-height: 1.25;
}

.chart-collection {
  padding: 14px;
}

.chart-collection summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.chart-collection .timeline {
  margin-top: 14px;
}

.chart-panel {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.chart-series-select {
  position: relative;
  z-index: 1;
  width: min(100%, 300px);
  margin: 0 0 10px;
}

.chart-series-select summary {
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
}

.chart-series-select fieldset {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  margin: 0;
  padding: 8px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(30, 37, 32, 0.18);
}

.chart-series-select legend {
  font-size: 12px;
  color: var(--muted);
}

.chart-series-select label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 0;
  color: var(--ink);
}

.chart-series-select label input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.chart-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

.chart-zoom input {
  width: clamp(90px, 18vw, 220px);
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.chart-zoom-value {
  min-width: 2.5em;
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.chart-scroll-track {
  width: 100%;
  height: 1px;
}

.chart-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chart-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chart-range select {
  width: auto;
  margin: 0;
}

.chart-fullscreen {
  margin-left: auto;
  font-size: 20px !important;
  line-height: 1;
}

.main-chart {
  position: relative;
  width: 100%;
  height: clamp(280px, 42vw, 430px);
}

.chart-panel:fullscreen {
  overflow-y: auto;
  padding: 18px;
  background: #f3f6ee;
}

.chart-panel:fullscreen .panel-header {
  padding-right: 95px;
}

.chart-panel:fullscreen .chart-minimize {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.chart-panel:fullscreen .main-chart {
  height: max(280px, calc(100vh - 260px));
}

.chart-export-container {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1200px;
  height: 600px;
}

.chart-mobile-note {
  display: none;
}

.individual-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  margin-top: 14px;
}

.single-chart {
  min-width: 0;
  height: 280px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.single-chart h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.single-chart canvas {
  width: 100% !important;
  height: 230px !important;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.gallery-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.gallery-tool-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}
.gallery-tool-card h3 { margin: 0 0 8px; font-size: 15px; }
.gallery-tool-card .meta { margin: 0 0 12px; }
.gallery-actions { align-items: center; }
.gallery-period { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.gallery-period label { flex: 1 1 180px; }
.gallery-filename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.animation-preview {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  background: #111;
}

.gallery-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.gallery-link {
  display: block;
  background: rgba(87, 99, 87, 0.1);
}

.gallery-link img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-caption {
  padding: 10px;
}

.gallery-caption .meta {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(420px, 100%);
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 14px;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.captcha-image {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  min-height: 60px;
  min-width: 176px;
  background: #f7f9f2;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--danger);
}

.form-message.ok {
  color: var(--accent);
}

.admin-note {
  color: var(--muted);
  font-size: 13px;
}

#map,
.picker-map {
  height: 380px;
  border-radius: 14px;
  border: 1px solid var(--line);
  z-index: 0;
}

.picker-map {
  height: 260px;
  margin-top: 10px;
}

.pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  background: #8a8f8a;
}

.pin.online {
  background: var(--accent);
}

.pin.sensor.online {
  background: #2c5f77;
}

.pin.home {
  background: var(--accent-2);
  border-radius: 4px;
}

.device-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.device-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
}

.device-card h3 {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.device-card-coordinates {
  grid-column: 1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.device-card-actions {
  grid-column: 2;
  grid-row: 1 / 3;
}

.device-card .thumb,
.device-card .metrics,
.device-card-status,
.device-card-meta {
  display: none;
}

.device-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(87, 99, 87, 0.15);
  color: var(--muted);
  margin-right: 4px;
}

.badge.online {
  background: rgba(31, 122, 76, 0.18);
  color: var(--accent);
}

.badge.offline {
  background: rgba(157, 50, 38, 0.14);
  color: var(--danger);
}

.badge.ota-scheduled {
  background: #fff1bf;
  color: #604500;
  border: 1px solid #d5b75c;
  white-space: normal;
}

.warn-box .ota-scheduled {
  display: block;
  width: fit-content;
  margin-bottom: 8px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 10px;
  font-size: 14px;
}

.metrics span {
  color: var(--muted);
}

.meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.timeline li {
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  padding: 8px 12px;
}

.timeline .type-image {
  border-left-color: var(--accent-2);
}

.timeline img {
  margin-top: 8px;
  width: min(320px, 100%);
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.check-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(30, 37, 32, 0.5);
}

.modal {
  position: fixed;
  z-index: 1001;
  inset: 6vh 4vw auto;
  max-width: 680px;
  margin: 0 auto;
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 20px 70px rgba(30, 37, 32, 0.3);
}

.toast {
  position: fixed;
  z-index: 1100;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e2520;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
}

.code-input {
  font-family: "IBM Plex Mono", monospace;
  font-size: 28px !important;
  letter-spacing: 0.4em;
  text-align: center;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 12px;
  }

  .device-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .device-card .thumb {
    display: block;
  }

  .device-card .metrics {
    display: grid;
  }

  .device-card-status {
    display: inline-block;
  }

  .device-card-meta {
    display: block;
  }

  .device-card-coordinates {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 12px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 18px;
  }

  .brand-header {
    gap: 16px;
  }

  .brand-logo img {
    width: 60px;
    height: 60px;
  }

  .brand-logo .eyebrow {
    font-size: 10px;
  }

  .brand-header h1 {
    font-size: clamp(22px, 2.4vw, 30px);
  }

  .header-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
  }

  .header-links {
    justify-content: flex-end;
  }
}

@media (max-width: 620px) {
  .account-toggle-label,
  .account-chevron {
    display: none;
  }

  .chart-tools {
    width: 100%;
  }

  .chart-tools select {
    max-width: 100%;
  }

  .chart-mobile-note {
    display: block;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 300px;
  }
}

.pw-wrap {
  position: relative;
  display: block;
}

.pw-wrap input {
  width: 100%;
  padding-right: 44px;
}

button.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--ink);
  display: inline-flex;
  cursor: pointer;
}

/* FOTA and manual irrigation */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.warn-box { background: #fff6dc; border: 1px solid #e3c35e; border-radius: 10px; padding: 10px 14px; margin: 10px 0; color: #5b4a10; }
.warn-box p { margin: 4px 0 0; }
.manual-pump input[type=range] { width: 100%; accent-color: var(--accent); margin: 8px 0 2px; }
.slider-row { display: flex; justify-content: space-between; align-items: baseline; }
.slider-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8em; margin-bottom: 14px; }

/* Export and duration inputs */
.chart-tools{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
.export-bar{display:flex;gap:.4rem}
.export-bar .small{padding:.35rem .6rem;font-size:.85rem}
.dur{display:flex;gap:.4rem}
.dur input{flex:1;min-width:0}
.dur select{width:auto}

.individual-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.view-toggle .view-btn { border: 0; border-radius: 0; }
.view-toggle .view-btn.active { background: var(--accent); color: #fff; }
.individual-board:fullscreen { background: #f3f6ee; padding: 16px; overflow: auto; }
.gauge-board { margin-top: 14px; padding: 16px; border-radius: 14px; background: radial-gradient(circle at 50% 0%, #20282b, #0e1214); color: #dfe7e2; }
.individual-board:fullscreen .gauge-board { margin: 0; min-height: 100%; }
.gauge-board[hidden], .individual-charts[hidden] { display: none; }
.gauge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.gauge-cell { position: relative; padding: 10px; background: linear-gradient(#1a2124, #121719); border: 1px solid #2f3b3f; border-radius: 12px; text-align: center; }
.gauge-cell h3, .led-cell h3 { margin: 0; font-size: 14px; color: #b9c6bf; letter-spacing: 0.04em; text-transform: uppercase; }
.gauge-cell .gauge-cog { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; min-height: 0; padding: 4px; color: #c3d0c8; background: transparent; border: 0; }
.gauge-cell .gauge-cog:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.gauge-cog svg { width: 18px; height: 18px; }
.gauge-svg { width: 100%; max-height: 260px; }
.gauge-bezel { fill: none; stroke: #2c383c; stroke-width: 3; stroke-linecap: round; }
.gauge-band { fill: none; stroke-width: 9; }
.gauge-band.low { stroke: #3b8fd0; }
.gauge-band.ideal { stroke: #35b36b; }
.gauge-band.high { stroke: #d6492f; }
.gauge-tick { stroke: #aebbb4; stroke-width: 1.5; }
.gauge-scale { fill: #8fa097; font-size: 10px; }
.gauge-needle { transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gauge-needle-shape { fill: #f2f5f3; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8)); }
.gauge-hub { fill: #38464a; stroke: #aebbb4; stroke-width: 2; }
.gauge-value { fill: #fff; font-size: 24px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; }
.gauge-unit { fill: #8fa097; font-size: 11px; text-anchor: middle; }
.gauge-zone { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-anchor: middle; fill: #8fa097; }
.gauge-zone.low { fill: #5fb0f0; }
.gauge-zone.ideal { fill: #4fd486; }
.gauge-zone.high { fill: #ff7358; }
.led-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.led-cell { display: flex; align-items: center; gap: 14px; padding: 12px 18px; min-width: 220px; background: linear-gradient(#1a2124, #121719); border: 1px solid #2f3b3f; border-radius: 12px; }
.led-state { font-weight: 700; color: #fff; }
.led { width: 30px; height: 30px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #5a6469, #2a3135); border: 2px solid #0b0e0f; }
.led.off { background: radial-gradient(circle at 35% 30%, #5b3a37, #2b1b1a); }
.led.on.green { background: radial-gradient(circle at 35% 30%, #c8ffd9, #25c25f 60%); box-shadow: 0 0 14px 3px rgba(53, 220, 117, 0.7); }
.led.on.blue { background: radial-gradient(circle at 35% 30%, #d4ecff, #2a8fe6 60%); box-shadow: 0 0 14px 3px rgba(60, 160, 255, 0.7); }
.gauge-ts { width: 100%; margin: 12px 0 0; font-size: 12px; color: #8fa097; text-align: right; }

.fullscreen-hint { display: none; margin: 0 0 8px; font-size: 13px; color: var(--muted); text-align: center; }
.individual-board:fullscreen .fullscreen-hint { display: block; }
.individual-board:fullscreen .gauge-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.individual-board:fullscreen .gauge-svg { max-height: 360px; }
.gauge-head { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.gauge-head .ghost { color: #c3d0c8; border-color: #3a484d; }
.gauge-range { fill: #8fa097; font-size: 9px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.gauge-mark.min { fill: #7fd6ff; }
.gauge-mark.max { fill: #ffb35c; }

@keyframes gauge-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 60, 0); border-color: #2f3b3f; }
  50% { box-shadow: 0 0 16px 2px rgba(255, 90, 60, 0.75); border-color: #ff5a3c; }
}
@keyframes gauge-alert-low {
  0%, 100% { box-shadow: 0 0 0 0 rgba(60, 160, 255, 0); border-color: #2f3b3f; }
  50% { box-shadow: 0 0 16px 2px rgba(60, 160, 255, 0.75); border-color: #3ca0ff; }
}
.gauge-cell:has(.gauge-svg[data-zone="high"]) { animation: gauge-alert 1.2s ease-in-out infinite; }
.gauge-cell:has(.gauge-svg[data-zone="low"]) { animation: gauge-alert-low 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .gauge-cell:has(.gauge-svg[data-zone="high"]), .gauge-cell:has(.gauge-svg[data-zone="low"]) { animation: none; border-color: #ff5a3c; }
}

.gauge-board.light { background: linear-gradient(#f7faf5, #e7eee6); color: #1e2520; }
.gauge-board.light .gauge-cell, .gauge-board.light .led-cell { background: linear-gradient(#ffffff, #eef3ee); border-color: #cbd6cc; }
.gauge-board.light h3 { color: #3b4a40; }
.gauge-board.light .gauge-cog { color: #51615a; }
.gauge-board.light .gauge-cog:hover { color: #000; background: rgba(0, 0, 0, 0.08); }
.gauge-board.light .gauge-head .ghost { color: #3b4a40; border-color: #b9c6bc; }
.gauge-board.light .gauge-bezel { stroke: #cbd6cc; }
.gauge-board.light .gauge-tick { stroke: #51615a; }
.gauge-board.light .gauge-scale, .gauge-board.light .gauge-unit, .gauge-board.light .gauge-range, .gauge-board.light .gauge-ts { fill: #5a6a61; color: #5a6a61; }
.gauge-board.light .gauge-needle-shape { fill: #1e2520; filter: none; }
.gauge-board.light .gauge-hub { fill: #e0e8e1; stroke: #1e2520; }
.gauge-board.light .gauge-value, .gauge-board.light .led-state { fill: #111; color: #111; }
.gauge-board.light .gauge-zone.low { fill: #1f6fb5; }
.gauge-board.light .gauge-zone.ideal { fill: #1b8a4a; }
.gauge-board.light .gauge-zone.high { fill: #c23a22; }
.gauge-board.light .gauge-mark.min { fill: #1f8ac0; }
.gauge-board.light .gauge-mark.max { fill: #d9822b; }
.gauge-board.light .led { border-color: #7d8a82; }
