:root {
  --bg: #031226;
  --panel: rgba(3, 26, 61, 0.88);
  --panel-deep: rgba(2, 20, 49, 0.94);
  --line: #075cae;
  --line-soft: rgba(40, 142, 255, 0.36);
  --title: #e8f5ff;
  --text: #d8ecff;
  --muted: #8db8dc;
  --cyan: #3fb9ff;
  --blue: #1476e7;
  --green: #24f66b;
  --red: #ff4545;
  --yellow: #ffd43b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 0, rgba(17, 100, 206, 0.45), transparent 36%),
    linear-gradient(180deg, #031834 0%, #020b1f 100%);
  overflow-x: hidden;
}

.screen {
  width: 100%;
  height: 100vh;
  min-height: 820px;
  margin: 0 auto;
  padding: clamp(10px, 1vw, 18px) clamp(12px, 1.25vw, 24px) clamp(12px, 1.1vw, 20px);
  position: relative;
  background:
    linear-gradient(rgba(2, 11, 31, 0.16), rgba(2, 11, 31, 0.34)),
    radial-gradient(circle at 50% 42%, rgba(9, 73, 140, 0.42), transparent 38%);
  transform-origin: top center;
}

.header {
  height: clamp(72px, 7.6vh, 88px);
  display: grid;
  grid-template-columns: 320px 1fr 430px;
  align-items: start;
  position: relative;
}

.header::before,
.header::after {
  content: "";
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: 6px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #39a5ff, #8bd3ff, #39a5ff, transparent);
  box-shadow: 0 0 18px #3a9cff;
}

.header::after {
  left: 34%;
  right: 34%;
  bottom: 0;
  height: 10px;
  clip-path: polygon(0 0, 12% 0, 17% 100%, 83% 100%, 88% 0, 100% 0, 90% 100%, 10% 100%);
}

.brand,
.header-right {
  padding-top: 10px;
  color: #eef7ff;
  font-size: 18px;
}

.brand-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #44b6ff, #176ee7);
  color: white;
  font-size: 16px;
}

.title-wrap {
  text-align: center;
}

.header h1 {
  margin: 0;
  text-align: center;
  color: #f5fbff;
  font-size: clamp(32px, 2.2vw, 42px);
  letter-spacing: 8px;
  text-shadow: 0 0 15px rgba(87, 170, 255, 0.9), 0 2px 0 #173d84;
}

.title-wrap p {
  margin: 5px 0 0;
  color: rgba(210, 235, 255, 0.88);
  font-size: clamp(12px, 0.8vw, 15px);
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(74, 171, 255, 0.55);
}

.header-right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.header-tool-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(67, 165, 255, 0.55);
  border-radius: 5px;
  background: rgba(5, 50, 104, 0.72);
  color: #d7ecff;
  font-size: 13px;
}

.full-icon {
  width: 50px;
  height: auto;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.95fr) minmax(560px, 1.65fr) minmax(330px, 0.95fr);
  grid-template-rows: minmax(360px, 45.5vh) minmax(210px, 21.5vh);
  grid-template-areas:
    "weather map sensor"
    "valve camera machine";
  gap: clamp(10px, 0.8vw, 16px);
  align-items: stretch;
}

.left-col,
.right-col,
.center-col {
  display: contents;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(5, 37, 84, 0.92), rgba(3, 24, 56, 0.9));
  box-shadow: inset 0 0 28px rgba(20, 111, 225, 0.18), 0 0 18px rgba(0, 35, 90, 0.38);
  overflow: hidden;
}

.panel-title,
.chart-title {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(90deg, #0654bd, rgba(5, 53, 114, 0.28));
  color: #f3f9ff;
  font-weight: 700;
  font-size: 20px;
  text-shadow: 0 0 7px rgba(89, 170, 255, 0.9);
}

.panel-title em {
  color: var(--green);
  font-size: 13px;
  font-style: normal;
  text-shadow: none;
}

.title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #ffd76b;
}

.device-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd43b;
  box-shadow: 0 0 8px rgba(255, 212, 59, 0.9);
  animation: statusPulse 1.35s ease-in-out infinite;
}

.device-status b {
  font-weight: 700;
}

.device-status.status-dot-only {
  gap: 0;
}

.device-status.status-dot-only b {
  display: none;
}

.device-status.is-online {
  color: #36f78a;
}

.device-status.is-online i {
  background: #36f78a;
  box-shadow: 0 0 9px rgba(54, 247, 138, 0.85);
  animation: none;
}

.device-status.is-cache {
  color: #ffd76b;
}

@keyframes statusPulse {
  0%,
  100% {
    opacity: 0.48;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.panel-title em.is-running {
  color: #ffd43b;
}

.panel-title em.is-offline {
  color: var(--red);
}

.task-view-btn {
  width: auto;
  min-width: 56px;
  height: 26px;
  padding: 0 10px;
  margin-left: auto;
  border: 1px solid rgba(67, 165, 255, 0.62);
  border-radius: 5px;
  background: linear-gradient(180deg, #0b6dc2, #064f96);
  color: #eaf6ff;
  font-size: 14px;
}

.title-actions .task-view-btn {
  margin-left: 0;
}

.weather-panel {
  grid-area: weather;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.weather-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 0.5vw, 8px);
  padding: 10px 12px 8px;
  flex: 0 0 auto;
}

.weather-cards article {
  min-height: clamp(74px, 7.7vh, 96px);
  position: relative;
  padding: 14px;
  border: 1px solid rgba(37, 126, 229, 0.45);
  border-radius: 7px;
  background: rgba(4, 30, 73, 0.9);
}

.weather-cards span {
  display: block;
  color: #b8d7f4;
  font-size: 15px;
  margin-bottom: 14px;
}

.weather-cards strong {
  color: #f0f8ff;
  font-size: 28px;
}

.weather-cards small { font-size: 15px; }

.wind-card {
  padding-right: 70px;
}

.wind-card strong {
  display: block;
  max-width: 98px;
  line-height: 1.2;
}

.wind-card small {
  display: block;
  margin-top: 2px;
}

.weather-cards b {
  position: absolute;
  right: 16px;
  bottom: 12px;
  color: #43aaff;
  font-size: 36px;
  font-weight: 400;
}

.weather-cards svg {
  position: absolute;
  left: 14px;
  bottom: 12px;
  width: 76px;
  height: 28px;
  fill: none;
  stroke: #35a5ff;
  stroke-width: 3;
}

.weather-cards article:nth-child(2) svg { stroke: #20d36e; }

.rain-bars {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: end;
  gap: 4px;
}

.rain-bars i {
  width: 5px;
  height: 9px;
  background: #0bd36c;
  box-shadow: 0 0 8px rgba(11, 211, 108, 0.7);
}

.rain-bars i:nth-child(2) { height: 21px; }
.rain-bars i:nth-child(3) { height: 13px; }
.rain-bars i:nth-child(4) { height: 28px; }
.rain-bars i:nth-child(5) { height: 16px; }
.rain-bars i:nth-child(6) { height: 10px; }
.rain-bars i:nth-child(7) { height: 24px; }

.compass {
  position: absolute;
  right: 14px;
  bottom: 16px;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(88, 178, 255, 0.5);
  border-radius: 50%;
}

.compass::before,
.compass::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1px;
  height: 52px;
  background: rgba(141, 184, 220, 0.36);
  transform: translate(-50%, -50%);
}

.compass::after {
  width: 52px;
  height: 1px;
}

.compass i {
  position: absolute;
  left: 20px;
  top: 9px;
  width: 13px;
  height: 29px;
  background: linear-gradient(140deg, #f9d949 0 46%, #3bbcff 47%);
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  transform: rotate(45deg);
}

.forecast {
  margin: 2px 12px 10px;
  border: 1px solid rgba(37, 126, 229, 0.45);
  border-radius: 6px;
  background: rgba(3, 22, 56, 0.82);
  flex: 0 0 clamp(158px, 16.5vh, 190px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.forecast h3 {
  margin: 0;
  height: 28px;
  padding: 4px 12px;
  color: white;
  background: linear-gradient(90deg, #0759c0, transparent);
  font-size: 17px;
}

.days {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 8px 8px;
  flex: 1;
  min-height: 0;
}

.days div {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 0 7px;
  border-right: 1px solid rgba(44, 128, 224, 0.36);
  text-align: center;
}

.days div:last-child { border-right: 0; }
.days span, .days em, .days small { color: #d6e9ff; font-style: normal; font-size: 13px; }
.days b { font-size: 25px; line-height: 1; }
.days strong { color: white; font-size: 14px; }

.project-card {
  margin: 0 12px 12px;
  padding: 10px 12px 11px;
  border: 1px solid rgba(37, 126, 229, 0.45);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(5, 36, 80, 0.88), rgba(3, 22, 56, 0.82));
  flex: 1;
  min-height: 82px;
}

.project-card h3 {
  margin: 0 0 6px;
  color: #ffffff;
  font-size: 16px;
}

.project-card p {
  margin: 0;
  color: #c9e5ff;
  font-size: 13px;
  line-height: 1.45;
}

.project-card div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.project-card span {
  padding: 5px 6px;
  border: 1px solid rgba(63, 185, 255, 0.25);
  border-radius: 4px;
  background: rgba(4, 30, 73, 0.7);
  color: #dff2ff;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.valve-panel {
  grid-area: valve;
  height: 100%;
  min-height: 0;
}

.valve-list {
  padding: 16px 16px 14px;
  display: grid;
  height: calc(100% - 38px);
  align-content: space-evenly;
  gap: clamp(12px, 1.8vh, 24px);
}

.task-control-panel {
  display: flex;
  flex-direction: column;
}

.task-overview {
  height: calc(100% - 38px);
  min-height: 0;
  padding: 10px 12px 12px;
}

.task-overview .task-section {
  min-height: 0;
}

.task-overview h4 {
  font-size: 15px;
}

.task-list--home {
  min-height: 0;
  max-height: none;
  height: 100%;
  gap: 6px;
  padding-right: 4px;
  scrollbar-width: none;
}

.task-list--home::-webkit-scrollbar {
  display: none;
}

.valve-list div {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) 52px 50px 42px 52px 62px;
  gap: 8px;
  align-items: center;
  color: #dcefff;
  font-size: 16px;
}

.valve-list strong {
  border-right: 1px solid rgba(101, 164, 238, 0.45);
  font-size: 20px;
}

.open { color: var(--green); }
.closed { color: var(--red); }
.valve-list em { color: white; font-style: normal; text-align: right; }

.valve-switch {
  width: 46px;
  height: 24px;
  justify-self: center;
  position: relative;
  border: 1px solid rgba(93, 157, 225, 0.55);
  border-radius: 999px;
  background: linear-gradient(180deg, #293f5e, #17263f);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.valve-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c3d7ec;
  box-shadow: 0 0 8px rgba(195, 215, 236, 0.72);
  transition: transform 0.2s ease;
}

.valve-switch.is-on {
  border-color: rgba(36, 246, 107, 0.65);
  background: linear-gradient(180deg, #15934d, #0b6337);
}

.valve-switch.is-on::before {
  transform: translateX(21px);
  background: white;
  box-shadow: 0 0 10px rgba(36, 246, 107, 0.9);
}

.config-btn {
  height: 26px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid rgba(67, 165, 255, 0.46);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(12, 81, 157, 0.96), rgba(5, 44, 100, 0.96));
  box-shadow: inset 0 0 10px rgba(63, 185, 255, 0.16);
  color: #dff2ff;
  font-size: 13px;
  white-space: nowrap;
}

.config-btn:hover {
  border-color: rgba(98, 194, 255, 0.85);
  color: #ffffff;
}

.map-wrap {
  grid-area: map;
  height: 100%;
  min-height: 100px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(22, 112, 220, 0.35);
  background:
    linear-gradient(rgba(3, 18, 44, 0.46), rgba(2, 18, 44, 0.55)),
    url("imgs/bg.png") center 35% / cover ;
}

.map-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 52%, transparent 0 40%, rgba(1, 10, 28, 0.52) 80%);
  pointer-events: none;
}

.device-summary {
  position: absolute;
  top: 10px;
  left: 48px;
  right: 48px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.device-summary div {
  height: 78px;
  display: grid;
  grid-template-columns: 54px 38px 1fr;
  align-items: center;
  padding: 0 16px;
  border: 1px solid rgba(71, 167, 255, 0.36);
  border-radius: 9px;
  background: rgba(2, 32, 73, 0.76);
  box-shadow: inset 0 0 18px rgba(60, 146, 255, 0.18);
}

.device-summary span { font-size: 38px; color: #5db8ff; }
.device-summary strong { color: white; font-size: 31px; }
.device-summary em { color: white; font-style: normal; font-size: 14px; }

.vineyard-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.route {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, transparent, #1789ff, transparent);
  box-shadow: 0 0 10px #1789ff;
  opacity: 0.72;
}

.route-a { width: 520px; left: 180px; top: 355px; transform: rotate(39deg); }
.route-b { width: 430px; right: 150px; top: 360px; transform: rotate(-36deg); }
.route-c { width: 410px; left: 410px; top: 400px; transform: rotate(0deg); }

.tower {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 3;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid rgba(90, 177, 255, 0.55);
  background: rgba(1, 17, 44, 0.82);
  color: white;
}

.tower::before {
  content: "☈";
  display: block;
  color: white;
  font-size: 78px;
  line-height: 65px;
  text-align: center;
  text-shadow: 0 0 10px #7fc2ff;
}

.marker {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
}

.marker i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid #4e9dff;
  border-radius: 50%;
  background: rgba(3, 16, 44, 0.88);
  box-shadow: 0 0 0 4px rgba(20, 118, 231, 0.24), 0 0 12px #1476e7;
  font-style: normal;
}

.marker::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 42px;
  width: 8px;
  height: 20px;
  border-left: 2px solid #117cff;
}

.marker span {
  min-width: 96px;
  padding: 8px 12px;
  border: 1px solid rgba(90, 177, 255, 0.62);
  border-radius: 4px;
  background: rgba(2, 17, 42, 0.8);
  color: white;
  font-size: 15px;
}

.marker b { color: var(--green); }
.marker .bad { color: var(--red); }
.m1 { left: 690px; top: 100px; }
.m2 { right: 580px; top: 428px; }
.m3 { left: 860px; bottom: 32px; }
.m4 { left: 800px; top: 292px; }
.m5 { left: 850px; top: 340px; }
.m6 { right: 310px; bottom: 424px; }
.m7 { right: 270px; bottom: 374px; }

.mid-row {
  display: contents;
}

.camera-panel,
.machine-panel {
  height: 100%;
  min-height: 0;
}

.camera-panel { grid-area: camera; }
.machine-panel { grid-area: machine; }

.camera-nav {
  display: flex;
  gap: 6px;
}

.camera-nav button {
  width: 26px;
  height: 24px;
  border: 1px solid rgba(158, 213, 255, 0.62);
  border-radius: 4px;
  background: rgba(3, 33, 78, 0.72);
  color: #f3f9ff;
  font-size: 22px;
  line-height: 18px;
  cursor: pointer;
}

.camera-nav button:hover {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(28, 108, 204, 0.78);
}

.camera-grid {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  height: calc(100% - 38px);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.camera-grid::-webkit-scrollbar {
  display: none;
}

.camera-grid.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.camera-grid article {
  position: relative;
  flex: 0 0 calc((100% - 20px) / 3);
  height: 100%;
  min-height: 0;
  padding: 10px 9px 28px;
  border: 1px solid rgba(38, 128, 237, 0.56);
  border-radius: 6px;
  background: rgba(2, 22, 55, 0.82);
  scroll-snap-align: start;
}

.camera-grid span {
  display: block;
  margin-bottom: 9px;
  color: white;
  font-size: 15px;
}

.camera-frame {
  position: relative;
  display: block;
  width: 100%;
  height: calc(100% - 52px);
  min-height: 130px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 8, 22, 0.82);
  cursor: pointer;
}

.camera-frame video,
.camera-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-frame video {
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.camera-frame img {
  z-index: 0;
}

.camera-card.has-snapshot .camera-frame img {
  z-index: 1;
}

.camera-frame b {
  position: absolute;
  left: 8px;
  bottom: 7px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(2, 16, 38, 0.76);
  color: rgba(244, 251, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.camera-card.is-live .camera-frame video {
  opacity: 1;
}

.camera-card.is-live .camera-frame b {
  display: none;
}

.camera-card.has-snapshot .camera-frame b {
  display: none;
}

.camera-card.is-error em {
  color: #ff7777;
}

.camera-grid em {
  position: absolute;
  right: 9px;
  bottom: 8px;
  color: var(--green);
  font-size: 13px;
  font-style: normal;
}

.machine-body {
  display: grid;
  grid-template-columns: minmax(148px, 0.68fr) minmax(150px, 0.78fr) minmax(158px, 0.82fr);
  gap: 10px;
  padding: 8px 16px 10px;
  height: calc(100% - 38px);
  min-height: 118px;
}

.machine-left {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.machine-visual {
  height: 100%;
  min-height: 110px;
  position: relative;
  border-bottom: 6px solid rgba(150, 184, 219, 0.62);
}

.pipe,
.pipe::before,
.pipe::after {
  position: absolute;
  content: "";
  background: #7ba5b7;
  box-shadow: 0 0 8px rgba(74, 195, 255, 0.65);
}

.pipe { left: 26px; top: 34px; width: 158px; height: 6px; }
.pipe::before { left: 0; top: 0; width: 6px; height: 76px; }
.pipe::after { right: 0; top: 0; width: 6px; height: 76px; }
.pipe.p2 { left: 36px; top: 58px; width: 132px; }

.tank {
  position: absolute;
  left: 70px;
  bottom: 0;
  width: 60px;
  height: 88px;
  border-radius: 21px 21px 5px 5px;
  background: linear-gradient(90deg, #d8e8ef, #789db4);
}

.box {
  position: absolute;
  right: 3px;
  top: 28px;
  width: 78px;
  height: 92px;
  border: 4px solid #8bb0c6;
  background: #d8e4eb;
}

.box::before {
  content: "";
  display: block;
  width: 36px;
  height: 23px;
  margin: 9px auto;
  background: #467581;
  border: 3px solid #85969b;
}

.filter {
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 58px;
  background: linear-gradient(#1b77b7, #0b2f5d);
  border-radius: 5px;
}

.f1 { right: 68px; }
.f2 { right: 42px; }
.f3 { right: 16px; }

.switches {
  display: grid;
  gap: 8px;
  align-content: stretch;
  min-width: 0;
}

.switches div,
.valve-list--compact div {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 52px 52px;
  gap: 6px;
  align-items: center;
  min-height: 0;
  padding: 4px 8px;
  border: 1px solid rgba(48, 137, 238, 0.45);
  border-radius: 6px;
  background: rgba(2, 23, 55, 0.76);
}

button {
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, #126f3f, #0b5a34);
  color: white;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

button.off { background: linear-gradient(180deg, #29405d, #1d2d45); }
button.warn { background: linear-gradient(180deg, #a33c4d, #71303b); }

.switches button:not(.is-active),
.valve-list--compact button:not(.is-active) {
  opacity: 0.56;
}

.switches button.off.is-active,
.valve-list--compact button.off.is-active {
  opacity: 1;
  background: linear-gradient(180deg, #a33c4d, #71303b);
}

.valve-list--compact {
  height: auto;
  padding: 0;
  gap: 8px;
  align-content: stretch;
}

.valve-list--compact div {
  font-size: 14px;
}

.schedule-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(0, 9, 24, 0.72);
  backdrop-filter: blur(4px);
}

.schedule-dialog.is-open {
  display: grid;
}

.schedule-dialog__panel {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 20px 22px 18px;
  border: 1px solid rgba(67, 165, 255, 0.65);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(4, 39, 86, 0.98), rgba(1, 20, 48, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.44), inset 0 0 18px rgba(35, 148, 255, 0.16);
  color: #eaf6ff;
}

.schedule-dialog__panel h3 {
  margin: 0 0 16px;
  font-size: 22px;
  color: white;
}

.schedule-dialog__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  padding: 0;
  background: rgba(22, 55, 92, 0.7);
  font-size: 22px;
  line-height: 1;
}

.schedule-dialog label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #9fc7ea;
  font-size: 15px;
}

.schedule-dialog label[hidden],
.schedule-dialog div[hidden] {
  display: none !important;
}

.schedule-dialog input,
.schedule-dialog select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(67, 165, 255, 0.48);
  border-radius: 6px;
  outline: 0;
  background: rgba(1, 18, 43, 0.88);
  color: white;
  font: inherit;
}

.schedule-dialog input:focus,
.schedule-dialog select:focus {
  border-color: rgba(36, 246, 107, 0.72);
  box-shadow: 0 0 0 3px rgba(36, 246, 107, 0.12);
}

.schedule-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.schedule-dialog__message {
  min-height: 22px;
  margin: 4px 0 12px;
  color: #24f66b;
  font-size: 14px;
}

.schedule-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.automation-dialog__panel {
  width: min(760px, calc(100vw - 32px));
}

.automation-block {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(67, 165, 255, 0.36);
  border-radius: 6px;
  background: rgba(1, 18, 43, 0.48);
}

.automation-block header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #dcefff;
  font-size: 15px;
}

.automation-block header button {
  width: 92px;
  height: 28px;
  font-size: 14px;
}

.automation-conditions,
.automation-actions {
  display: grid;
  gap: 8px;
}

.automation-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 86px 120px 64px;
  gap: 8px;
  align-items: center;
}

.automation-action {
  grid-template-columns: minmax(180px, 1fr) 120px 64px;
}

.automation-row select,
.automation-row input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid rgba(67, 165, 255, 0.48);
  border-radius: 5px;
  outline: 0;
  background: rgba(1, 18, 43, 0.88);
  color: white;
  font: inherit;
}

.automation-row button {
  height: 34px;
  font-size: 14px;
}

.task-dialog__panel {
  width: min(860px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.task-dialog__content {
  min-height: 0;
  overflow: hidden;
}

.task-section {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.task-section h4 {
  margin: 0;
  color: #dcefff;
  font-size: 17px;
}

.task-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 260px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.task-card {
  padding: 10px 12px;
  border: 1px solid rgba(67, 165, 255, 0.38);
  border-radius: 6px;
  background: rgba(1, 18, 43, 0.72);
}

.task-card strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: white;
  font-size: 15px;
}

.task-card span,
.task-card p {
  display: block;
  margin: 6px 0 0;
  color: #b9d7f4;
  font-size: 13px;
  line-height: 1.45;
}

.task-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-delete-btn,
.task-toggle-btn,
.task-detail-btn {
  width: 72px;
  height: 30px;
  color: white;
  font-size: 14px;
}

.task-detail-btn {
  background: rgba(22, 96, 170, 0.88);
  border-color: rgba(102, 189, 255, 0.62);
}

.task-delete-btn {
  background: rgba(170, 45, 58, 0.82);
  border-color: rgba(255, 108, 120, 0.58);
}

.task-toggle-btn.is-enabled {
  background: rgba(183, 133, 30, 0.86);
  border-color: rgba(255, 196, 73, 0.58);
}

.task-toggle-btn.is-disabled {
  background: rgba(20, 126, 70, 0.86);
  border-color: rgba(36, 246, 107, 0.58);
}

.task-delete-btn:disabled,
.task-toggle-btn:disabled,
.task-detail-btn:disabled {
  opacity: 0.62;
  cursor: default;
}

.task-empty {
  padding: 16px;
  border: 1px dashed rgba(67, 165, 255, 0.36);
  border-radius: 6px;
  color: #9fc7ea;
  text-align: center;
}

.task-list--home {
  min-height: 0;
  max-height: none;
  gap: 5px;
  padding-right: 4px;
}

.task-list--home .task-card {
  padding: 6px 8px;
  border-radius: 5px;
}

.task-list--merged {
  overflow-y: auto;
}

.task-card--row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.task-card--single {
  min-height: 38px;
}

.task-card__main {
  min-width: 0;
}

.task-type-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-right: 7px;
  padding: 0 8px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: none;
}

.task-pill--quick {
  background: linear-gradient(180deg, #0f9e55, #08743c);
  border: 1px solid rgba(82, 255, 158, 0.45);
}

.task-pill--schedule {
  background: linear-gradient(180deg, #b77900, #765000);
  border: 1px solid rgba(255, 213, 87, 0.55);
}

.task-pill--automation {
  background: linear-gradient(180deg, #087ec8, #07518c);
  border: 1px solid rgba(108, 213, 255, 0.52);
}

.task-card--row strong {
  align-items: center;
  min-width: 0;
  justify-content: flex-start;
}

.task-card--row strong em {
  flex: 0 0 auto;
  margin-left: auto;
}

.task-name {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list--home .task-card strong {
  font-size: 13px;
}

.task-list--home .task-card--single {
  min-height: 34px;
}

.task-list--home .task-card span,
.task-list--home .task-card p {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
}

.task-list--home .task-card__actions {
  margin-top: 0;
}

.task-list--home .task-delete-btn,
.task-list--home .task-toggle-btn,
.task-list--home .task-detail-btn {
  width: 58px;
  height: 24px;
  font-size: 12px;
}

.task-card--single .task-type-pill {
  flex: 0 0 auto;
  margin-top: 0;
}

.task-card--single .task-name {
  display: inline-block;
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.task-card--single .task-card__actions {
  margin-top: 0;
}

.task-detail-dialog__panel {
  width: min(460px, calc(100vw - 32px));
}

.task-detail-body {
  display: grid;
  gap: 8px;
  max-height: 240px;
  margin: 4px 0 10px;
  overflow: auto;
}

.task-detail-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(67, 165, 255, 0.32);
  border-radius: 6px;
  background: rgba(2, 23, 55, 0.72);
}

.task-detail-row span {
  color: #9fc7ea;
  font-size: 13px;
}

.task-detail-row strong {
  min-width: 0;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.machine-metrics {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(48, 137, 238, 0.45);
  border-radius: 6px;
  background: rgba(2, 23, 55, 0.76);
  color: #b9d7f4;
  font-size: 16px;
}

.flow-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.flow-metrics span {
  display: grid;
  grid-template-rows: 18px 28px;
  align-items: end;
  gap: 2px;
  min-width: 0;
}

.flow-metrics em {
  color: #9fc7ea;
  font-style: normal;
  font-size: 14px;
  white-space: nowrap;
}

.flow-metrics b {
  display: block;
  color: white;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}

.flow-metrics small {
  color: #d5eaff;
  font-size: 13px;
  font-weight: 400;
}

.sensor-panel {
  grid-area: sensor;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sensor-card {
  margin: 7px 12px 0;
  padding: 6px 12px 7px;
  border: 1px solid rgba(38, 128, 237, 0.5);
  border-radius: 6px;
  background: rgba(5, 36, 80, 0.82);
}

.sensor-card h3,
.soil-box h3 {
  margin: 0 0 5px;
  color: #bcdfff;
  font-size: 14px;
}

.sensor-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.sensor-grid span {
  display: grid;
  gap: 3px;
  padding-left: 10px;
  border-right: 1px solid rgba(75, 149, 231, 0.38);
  color: #b3d3ee;
  font-size: 12px;
}

.sensor-grid span:last-child { border-right: 0; }
.sensor-grid b { color: white; font-size: 16px; font-weight: 500; }
.sensor-grid small { font-size: 10px; }

.soil-box {
  display: grid;
  grid-template-columns: 1fr 66px;
  gap: 8px;
  margin: 7px 12px 0;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(38, 128, 237, 0.5);
  border-radius: 6px;
  background: rgba(5, 36, 80, 0.82);
  flex: 0 0 auto;
  min-height: 98px;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: white;
  font-size: 13px;
}

td, th {
  padding: 3px 4px;
  text-align: left;
  font-weight: 400;
}

th { color: #b7d7f2; }

.soil-tube {
  height: 98px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg,
      rgba(48, 181, 70, 0.88) 0 24%,
      rgba(117, 75, 40, 0.96) 24% 49%,
      rgba(90, 55, 31, 0.98) 49% 74%,
      rgba(62, 38, 25, 1) 74% 100%);
}

.soil-tube::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 23%, rgba(255,255,255,.22) 24%, transparent 25%, transparent 48%, rgba(255,255,255,.2) 49%, transparent 50%, transparent 73%, rgba(255,255,255,.16) 74%, transparent 75%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 2px, transparent 2px 16px);
  pointer-events: none;
}

.soil-tube::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 8px;
  height: 78px;
  transform: translateX(-50%);
  background: #d7eef1;
  box-shadow: 0 0 10px white;
}

.soil-tube i {
  display: block;
  position: absolute;
  z-index: 2;
  right: 12px;
  color: white;
  font-size: 12px;
  font-style: normal;
}

.soil-tube i:nth-child(1) { top: 20px; }
.soil-tube i:nth-child(2) { top: 48px; }
.soil-tube i:nth-child(3) { top: 76px; }

.soil-viz {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(132px, 0.75fr);
  gap: 8px;
  margin: 7px 12px 8px;
  min-height: 0;
  flex: 1 1 auto;
}

.soil-viz-chart,
.soil-viz-metrics {
  min-width: 0;
  border: 1px solid rgba(38, 128, 237, 0.5);
  border-radius: 6px;
  background: rgba(5, 36, 80, 0.82);
}

.soil-viz-chart {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 7px 8px 6px;
}

.soil-viz-chart h3 {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: #bcdfff;
  font-size: 13px;
}

.soil-heatmap-tabs {
  display: inline-flex;
  justify-self: end;
  gap: 3px;
}

.soil-heatmap-legend {
  display: grid;
  grid-template-columns: auto 72px auto;
  align-items: center;
  gap: 5px;
  color: #bcdfff;
  font-size: 10px;
  white-space: nowrap;
}

.soil-heatmap-legend i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f6fd6 0%, #17b6a3 50%, #24d35d 100%);
  box-shadow: 0 0 8px rgba(36, 211, 93, 0.34);
}

.soil-heatmap-tabs button {
  width: 34px;
  height: 20px;
  padding: 0;
  border-color: rgba(67, 165, 255, 0.46);
  background: rgba(5, 50, 104, 0.72);
  color: #bcdfff;
  font-size: 11px;
}

.soil-heatmap-tabs button.is-active {
  border-color: rgba(36, 246, 107, 0.72);
  background: rgba(22, 126, 70, 0.86);
  color: #ffffff;
}

.soil-viz-chart canvas {
  display: block;
  width: 100%;
  height: 172px;
  flex: 1 1 auto;
  min-height: 164px;
}

.soil-viz-metrics {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.soil-index {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 8px;
  color: #b3d3ee;
  font-size: 12px;
}

.soil-index strong {
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.soil-index i {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(74, 150, 231, 0.18);
}

.soil-index b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20d46b, #40b9ff);
  box-shadow: 0 0 10px rgba(64, 185, 255, 0.48);
}

.login-screen,
.admin-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(0, 9, 24, 0.78);
  backdrop-filter: blur(6px);
}

.login-screen.is-open,
.admin-dialog.is-open {
  display: grid;
}

.auth-page,
.config-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 10%, rgba(35, 143, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #020c22 0%, #001a3e 100%);
}

.login-page {
  display: grid;
}

.login-card,
.admin-panel {
  border: 1px solid rgba(67, 165, 255, 0.65);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(4, 39, 86, 0.98), rgba(1, 20, 48, 0.98));
  box-shadow: 0 0 28px rgba(42, 147, 255, 0.28);
}

.login-card {
  width: min(360px, calc(100vw - 32px));
  padding: 24px;
}

.login-card h2,
.admin-panel h2 {
  margin: 0 0 16px;
  color: #ffffff;
}

.login-subtitle {
  margin: -8px 0 18px;
  color: #9fc9ee;
  line-height: 1.55;
}

.login-card label,
.admin-grid label,
.soil-cal-row label {
  display: grid;
  gap: 6px;
  color: #bcdfff;
  font-size: 13px;
}

.login-card input,
.admin-grid input,
.phenology-config-table input,
.soil-cal-row input,
.report-panel textarea {
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(67, 165, 255, 0.48);
  border-radius: 5px;
  outline: 0;
  background: rgba(0, 19, 48, 0.92);
  color: #ffffff;
}

.login-message,
.admin-message,
.admin-help {
  min-height: 20px;
  margin: 10px 0;
  color: #24f66b;
  font-size: 13px;
}

.login-card button,
.admin-actions button,
.admin-tabs button {
  height: 34px;
  color: #ffffff;
}

.login-card button {
  width: 100%;
  background: rgba(20, 126, 70, 0.88);
  border-color: rgba(36, 246, 107, 0.58);
}

.admin-panel {
  position: relative;
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 20px 22px;
}

.config-shell {
  min-height: 100vh;
  padding: 26px clamp(20px, 4vw, 64px);
}

.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  color: #d7ecff;
}

.config-header h1 {
  margin: 0 0 6px;
  color: #ffffff;
  font-size: 30px;
  letter-spacing: 0;
}

.config-header p {
  margin: 0;
  color: #9fc9ee;
}

.config-header nav {
  display: flex;
  gap: 10px;
}

.config-header .header-tool-btn {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  text-decoration: none;
}

.config-admin-panel {
  width: 100%;
  max-height: none;
}

.admin-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  padding: 0;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-tabs button {
  width: 104px;
  background: rgba(5, 50, 104, 0.72);
}

.admin-tabs button.is-active {
  background: rgba(22, 126, 70, 0.86);
  border-color: rgba(36, 246, 107, 0.68);
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.phenology-config-table,
.soil-calibration-table,
.soil-cal-table {
  display: grid;
  gap: 8px;
}

.phenology-row,
.soil-cal-row {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 0.8fr 0.8fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(67, 165, 255, 0.32);
  border-radius: 6px;
  background: rgba(2, 23, 55, 0.72);
  color: #d7ecff;
  font-size: 13px;
}

.soil-cal-row {
  grid-template-columns: 1.1fr repeat(3, minmax(0, 1fr));
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.admin-actions span {
  margin-right: auto;
  color: #24f66b;
  font-size: 13px;
}

.admin-actions button {
  width: 110px;
}

.config-hint {
  margin: -4px 0 12px;
  color: #9fc9ee;
  font-size: 13px;
}

.config-file-editor textarea {
  width: 100%;
  min-height: 52vh;
  padding: 12px;
  border: 1px solid rgba(67, 165, 255, 0.42);
  border-radius: 6px;
  outline: 0;
  resize: vertical;
  background: rgba(0, 16, 40, 0.92);
  color: #dff2ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.config-file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.config-file-actions button {
  height: 34px;
  min-width: 110px;
  color: #ffffff;
}

.config-file-actions button:last-child {
  background: rgba(20, 126, 70, 0.88);
  border-color: rgba(36, 246, 107, 0.58);
}

.report-panel textarea {
  width: 100%;
  height: 72px;
  padding: 8px 10px;
  resize: vertical;
}

.report-output {
  min-height: 260px;
  max-height: 48vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(67, 165, 255, 0.32);
  border-radius: 6px;
  background: rgba(2, 23, 55, 0.72);
  color: #d7ecff;
  line-height: 1.75;
}

.report-output h3,
.report-output h4,
.report-output h5,
.report-output p,
.report-output ul {
  margin: 0 0 10px;
}

.report-output h3 {
  color: #ffffff;
  font-size: 20px;
}

.report-output h4 {
  color: #54c7ff;
  font-size: 16px;
}

.report-output h5 {
  color: #d7ecff;
  font-size: 14px;
}

.report-output ul {
  padding-left: 18px;
}

.report-output li {
  margin-bottom: 6px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(460px, 1.28fr) minmax(350px, 0.92fr) minmax(520px, 1.34fr) minmax(330px, 0.84fr);
  gap: clamp(10px, 0.8vw, 16px);
  margin-top: clamp(8px, 0.65vw, 12px);
  align-items: stretch;
}

.bottom-grid .panel {
  height: clamp(230px, 24vh, 305px);
  min-height: 0;
}

.phenology-main {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 12px 0;
}

.phenology-main img {
  width: 136px;
  height: clamp(92px, 10vh, 116px);
  object-fit: cover;
  object-position: 50% 48%;
  border-radius: 4px;
}

.phenology-main span { color: #b8d7f4; }
.phenology-main strong {
  display: block;
  margin: 4px 0 6px;
  color: var(--green);
  font-size: clamp(20px, 1.15vw, 24px);
}

.phenology-main p {
  margin: 4px 0;
  color: white;
  font-size: 15px;
  line-height: 1.25;
}

.phenology-main label {
  display: grid;
  grid-template-columns: 45px 1fr 42px;
  gap: 9px;
  align-items: center;
  margin-top: 6px;
}

.phenology-main label i {
  height: 9px;
  background: rgba(82, 147, 223, 0.42);
  border-radius: 20px;
  overflow: hidden;
}

.phenology-main label b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.phenology-main label em {
  color: white;
  font-style: normal;
  font-size: 14px;
  text-align: right;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: start;
  gap: 1px;
  padding: 8px 10px 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 34px;
  right: 34px;
  top: 24px;
  height: 2px;
  background: #2f8dff;
}

.timeline div {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #c9e5ff;
  font-size: 12px;
  line-height: 1.28;
}

.timeline i {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto 7px;
  border-radius: 50%;
  background: #d9f3ff;
  box-shadow: 0 0 12px #40b9ff;
}

.timeline .active i {
  width: 16px;
  height: 16px;
  margin: 0 auto 7px;
  background: #1e6aff;
  border: 2px solid #2aff70;
  box-shadow: 0 0 0 5px rgba(42, 255, 112, 0.18), 0 0 18px #2aff70;
}

.timeline .active span {
  display: inline-block;
  padding: 3px 5px;
  border-radius: 3px;
  background: rgba(3, 94, 61, 0.9);
  color: var(--green);
  white-space: nowrap;
  font-size: 11px;
}

.advice-panel {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.advice-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 10px;
  scrollbar-width: none;
  user-select: none;
}

.advice-scroll::-webkit-scrollbar {
  display: none;
}

.advice-scroll::selection,
.advice-scroll *::selection {
  background: transparent;
  color: inherit;
}

.advice-scroll article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  margin: 6px 12px 0;
  padding: 6px 11px;
  border: 1px solid rgba(38, 128, 237, 0.42);
  border-radius: 7px;
  background: rgba(5, 36, 80, 0.82);
}

.advice-scroll i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #1976df, #0d489b);
  font-style: normal;
  font-size: 18px;
}

.advice-scroll article:nth-child(2) i { background: linear-gradient(180deg, #30b96c, #147541); }
.advice-scroll article:nth-child(3) i { background: linear-gradient(180deg, #d7a82d, #987115); }
.advice-scroll article:nth-child(4) i { background: linear-gradient(180deg, #d85362, #9a2d3d); }

.advice-scroll strong {
  color: white;
  font-size: 15px;
}

.advice-scroll p {
  margin: 3px 0 0;
  color: #c9e5ff;
  font-size: 13px;
  line-height: 1.38;
}

.chart-panel {
  padding-bottom: 8px;
}

.chart-title {
  background: linear-gradient(90deg, #064eb0, transparent);
  font-size: 18px;
}

.chart-title em {
  color: #9fc7ea;
  font-size: 13px;
  font-style: normal;
  text-shadow: none;
}

.chart-panel canvas {
  display: block;
  width: calc(100% - 22px);
  height: calc(100% - 62px);
  min-height: 170px;
  margin: 14px 11px 0;
}

.trend-body {
  height: calc(100% - 38px);
  padding: 9px 10px 10px;
}

.trend-gallery {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(180px, 0.95fr);
  gap: 8px;
}

.trend-chart-main,
.model-card,
.model-matrix {
  min-height: 0;
  border: 1px solid rgba(67, 165, 255, 0.28);
  border-radius: 6px;
  background: radial-gradient(circle at 50% 0%, rgba(20, 115, 220, 0.22), rgba(3, 24, 56, 0.64) 64%);
  overflow: hidden;
}

.trend-models {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, 50px) minmax(0, 1fr);
  gap: 7px;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px 46px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 0 8px;
  padding: 5px 8px;
}

.model-card span,
.model-matrix span {
  color: #9fc7ea;
  font-size: 12px;
  line-height: 1;
}

.model-card strong {
  grid-row: span 2;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
}

.model-card i {
  height: 8px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(82, 147, 223, 0.28);
}

.model-card i b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #31f36b, #ffd43b, #ff5c6b);
}

.model-card em {
  grid-column: 3;
  color: #c9e5ff;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.model-matrix {
  position: relative;
  padding-top: 20px;
}

.model-matrix span {
  position: absolute;
  left: 8px;
  top: 6px;
}

.trend-panel canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.farm-record-panel {
  display: flex;
  flex-direction: column;
}

.farm-record-list {
  display: grid;
  gap: 3px;
  align-content: start;
  padding: 5px 10px 8px;
  overflow: auto;
}

.farm-record-item {
  display: grid;
  grid-template-columns: minmax(88px, 0.75fr) minmax(150px, 1fr) 128px;
  align-items: center;
  gap: 8px;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid rgba(67, 165, 255, 0.32);
  border-radius: 6px;
  background: rgba(1, 18, 43, 0.58);
}

.farm-record-item strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #ffffff;
  font-size: 13px;
  min-width: 0;
}

.farm-record-item em {
  color: #24f66b;
  font-size: 12px;
  font-style: normal;
}

.farm-record-item span,
.farm-record-item time {
  display: block;
  margin-top: 0;
  color: #b9d7f4;
  font-size: 12px;
  white-space: nowrap;
}

.data-export-link {
  border: 0;
  background: transparent;
  color: #cfe9ff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.data-export-link:hover {
  color: white;
  text-decoration: underline;
}

.farm-record-empty {
  padding: 18px;
  border: 1px dashed rgba(67, 165, 255, 0.36);
  border-radius: 6px;
  color: #9fc7ea;
  text-align: center;
}

canvas { max-width: 100%; }

@media (max-width: 1500px) {
  .header {
    grid-template-columns: 260px 1fr 260px;
  }

  .header h1 {
    font-size: 34px;
    letter-spacing: 5px;
  }

  .title-wrap p {
    font-size: 12px;
  }

  .content-grid {
    grid-template-columns: minmax(310px, 0.95fr) minmax(520px, 1.55fr) minmax(310px, 0.95fr);
  }

  .weather-cards strong {
    font-size: 24px;
  }

  .device-summary {
    left: 28px;
    right: 28px;
    gap: 10px;
  }

  .device-summary div {
    grid-template-columns: 42px 28px 1fr;
    padding: 0 10px;
  }

  .device-summary span {
    font-size: 28px;
  }

  .device-summary strong {
    font-size: 25px;
  }

  .bottom-grid {
    grid-template-columns: minmax(390px, 1.28fr) minmax(300px, 0.9fr) minmax(430px, 1.26fr) minmax(290px, 0.82fr);
  }
}

@media (max-width: 1180px) {
  body {
    overflow-x: hidden;
  }

  .screen {
    min-height: auto;
  }

  .header {
    height: auto;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 18px;
  }

  .brand,
  .header-right,
  .header h1,
  .title-wrap {
    justify-content: center;
    text-align: center;
  }

  .header-right {
    justify-content: center;
  }

  .content-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "map map"
      "weather sensor"
      "valve machine"
      "camera camera";
  }

  .map-wrap {
    height: clamp(430px, 56vw, 620px);
  }

  .weather-panel,
  .sensor-panel,
  .valve-panel,
  .camera-panel,
  .machine-panel {
    height: auto;
  }

  .weather-panel,
  .sensor-panel {
    min-height: 520px;
  }

  .valve-panel,
  .machine-panel {
    min-height: 300px;
  }

  .camera-panel {
    min-height: 300px;
  }

  .camera-grid article {
    flex-basis: calc((100% - 10px) / 2);
  }
}

@media (max-width: 760px) {
  .content-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .phenology-panel,
  .trend-panel,
  .advice-panel,
  .farm-record-panel {
    grid-column: 1;
  }

  .content-grid {
    grid-template-areas:
      "map"
      "weather"
      "sensor"
      "machine"
      "camera"
      "valve";
  }

  .header h1 {
    font-size: 26px;
    letter-spacing: 2px;
  }

  .title-wrap p {
    font-size: 11px;
    line-height: 1.35;
  }

  .weather-cards,
  .days,
  .machine-body,
  .machine-metrics,
  .sensor-grid,
  .soil-box,
  .phenology-main {
    grid-template-columns: 1fr;
  }

  .farm-record-item {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .camera-grid article {
    flex-basis: min(88%, 340px);
  }

  .weather-cards .wind-card {
    grid-column: span 1;
  }

  .device-summary {
    grid-template-columns: repeat(2, 1fr);
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .map-wrap {
    height: 520px;
  }

  .marker {
    transform: scale(0.82);
    transform-origin: left top;
  }

  .m1 { left: 42%; top: 150px; }
  .m2 { right: 8%; top: 230px; }
  .m3 { left: 44%; bottom: 100px; }
  .m4 { left: 8%; top: 250px; }
  .m5 { left: 12%; top: 340px; }
  .m6 { right: 8%; top: 335px; }
  .m7 { right: 18%; top: 390px; }

  .bottom-grid .panel {
    height: auto;
    min-height: 300px;
  }
}
