/* Sensor UI is isolated from the equipment grid and never changes its geometry. */
.environment-sidebar { margin-top: auto; min-width: 0; flex: 0 0 auto; }
.environment-card { --env: #95a7b9; --env-soft: #95a7b914; position: relative; padding: 13px 11px 10px; border: 1px solid color-mix(in srgb,var(--env) 27%,var(--line)); border-radius: 12px; background: radial-gradient(ellipse at 50% 25%,var(--env-soft),transparent 65%),var(--surface-2); color: var(--ink); overflow: hidden; }
.environment-card[data-env-state="COMFORT"] { --env: #20ecad; --env-soft: #20ecad18; }
.environment-card[data-env-state="ALERT"] { --env: #ff9455; --env-soft: #ff704525; }
.environment-card header { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.environment-card h2 { margin: 2px 0 0; font-size: 13px; line-height: 1.35; }
.environment-card header small { display: block; font-size: 8px; line-height: 1.3; letter-spacing: .09em; color: var(--muted); }
.environment-card header button { padding: 3px; min-width: 27px; min-height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.environment-card header button:hover { background: var(--surface); color: var(--env); }
.environment-card button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.env-scene { width: 94px; height: 94px; position: relative; margin: 5px auto 0; color: var(--env); }
.env-orbit { width: 100%; height: 100%; position: absolute; inset: 0; fill: none; stroke: currentColor; stroke-width: .7; opacity: .7; }
.env-orbit-track { stroke-width: 1.8; stroke-dasharray: 64 200; }
.env-satellite { fill: currentColor; }
.env-face { position: absolute; inset: 17%; width: 66%; height: 66%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px var(--env-soft)); }
.env-face-bg { fill: var(--env-soft); stroke-width: 1.3; }
.env-leaf { fill: var(--env-soft); stroke-width: 2; }
.env-air { position: absolute; height: 1px; width: 22px; background: linear-gradient(90deg,transparent,var(--env),transparent); opacity: 0; left: -3px; top: 32%; }
.env-air-two { top: 65%; left: 74%; }
[data-env-state="COMFORT"] .env-orbit, [data-env-state="ALERT"] .env-orbit { animation: env-orbit 12s linear infinite; }
[data-env-state="COMFORT"] .env-face { animation: env-breathe 4s ease-in-out infinite; }
[data-env-state="COMFORT"] .env-air { animation: env-air 3s ease-in-out infinite; }
[data-env-state="COMFORT"] .env-air-two { animation-delay: 1.5s; }
[data-env-state="ALERT"] .env-face { animation: env-warm 2.4s ease-in-out infinite; }
[data-env-state="ALERT"] .env-heat { animation: env-heat 1.8s ease-in-out infinite; }
.env-status { font-size: 10px; text-align: center; font-weight: 750; color: var(--env); line-height: 1.4; min-height: 15px; }
.env-values { margin: 10px 0 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.env-value { min-width: 0; }
.env-value + .env-value { border-left: 1px solid var(--line); padding-left: 7px; }
.env-value > span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.env-value strong { font-size: 23px; line-height: 1.15; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.env-value strong small { font-size: 10px; letter-spacing: 0; margin-left: 2px; color: var(--muted); }
.env-value.over strong { color: #ff895b; }
.env-limits, .env-hint { font-size: 9px; line-height: 1.5; color: var(--muted); text-align: center; margin: 3px 0; }
.environment-card footer { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 8px; line-height: 1.3; display: flex; justify-content: space-between; gap: 3px; color: var(--muted); font-variant-numeric: tabular-nums; }
.environment-settings-card { grid-column: 1/-1; max-width: none; }
.environment-settings-card > form { max-width: 860px; }
.environment-settings-card .field { min-width: 0 !important; }
.env-enable { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; }
.env-enable input { width: 20px; height: 20px; accent-color: var(--cyan); }
.env-form-note { padding: 10px 12px; margin: 0; border-left: 3px solid var(--cyan); background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.7; }
.env-advanced { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.env-advanced summary { cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 650; }
.env-advanced > div { margin-top: 14px; }
.env-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.env-form-message { min-height: 18px; font-size: 13px; color: var(--cyan); line-height: 1.6; }
.env-form-message.error { color: var(--red,#ff657a); }
html[data-theme="light"] .environment-card[data-env-state="COMFORT"] { --env: #00856a; --env-soft: #00856a12; }
html[data-theme="light"] .environment-card[data-env-state="ALERT"] { --env: #b74412; --env-soft: #b7441212; }
html[data-theme="light"] .env-value.over strong { color: #b74412; }
@keyframes env-orbit { to { transform: rotate(360deg); } }
@keyframes env-breathe { 50% { transform: translateY(-2px) scale(1.035); } }
@keyframes env-air { 50% { opacity: .6; transform: translateX(13px); } }
@keyframes env-warm { 50% { transform: scale(1.05); filter: drop-shadow(0 0 7px #ff774855); } }
@keyframes env-heat { 50% { opacity: .45; transform: translateY(-2px); } }
/* Native TV address bars can reduce a 1080p page to 900px of CSS height. */
@media (min-width: 981px) and (max-height: 1000px) {
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab { min-height: 29px; padding: 2px 7px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tabs { gap: 2px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tabs::before { margin-bottom: 5px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab i { width: 22px; height: 22px; }
  html[lang="vi"][data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab > span > b { font-size: 11px; line-height: 1.1; }
  html[lang="vi"] .environment-card h2 { font-size: 11px; }
  html[lang="vi"] .env-status { font-size: 9px; line-height: 1.3; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-actions { margin-top: 4px; padding-top: 4px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-actions .button { min-height: 28px; padding: 4px 7px; }
  .environment-card { padding: 9px; display: grid; grid-template-columns: 46px minmax(0,1fr); align-items: center; column-gap: 5px; }
  .environment-card header { grid-column: 1/-1; }
  .env-scene { width: 46px; height: 46px; margin: 2px 0 0; grid-column: 1; grid-row: 2; }
  .env-status { grid-column: 2; grid-row: 2; }
  .env-values { grid-column: 1/-1; margin: 7px 0 4px; }
  .env-limits, .environment-card footer { grid-column: 1/-1; }
  .env-value strong { font-size: 21px; }
  .env-hint { display: none; }
  .environment-card footer { margin-top: 5px; padding-top: 5px; }
}
@media (min-width: 981px) and (max-height: 760px) {
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab { min-height: 25px; padding: 1px 7px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab i { width: 20px; height: 20px; }
  html[lang="vi"][data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab > span > b { font-size: 10px; line-height: 1.05; }
  .env-scene { width: 34px; height: 34px; }
  .env-values { margin-top: 3px; margin-bottom: 2px; }
  .environment-card footer { margin-top: 3px; padding-top: 3px; }
  .environment-card header small { display: none; }
}
@media (min-width: 981px) and (max-height: 690px) {
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab { min-height: 25px; padding: 2px 7px; }
  html[data-ui-design="modern"][data-viewport-fit="auto"] .app-shell:not(.wallboard) .nav-tab i { width: 20px; height: 20px; }
  .env-scene, .environment-card header small, .env-limits { display: none; }
  .env-status { grid-column: 1/-1; margin-top: 4px; }
}
@media (max-width: 980px) {
  .environment-sidebar { margin-top: 8px; }
  .environment-card { display: grid; grid-template-columns: minmax(130px,1fr) minmax(110px,1fr) minmax(140px,1fr); align-items: center; gap: 3px 12px; padding: 8px 12px; }
  .env-scene { display: none; }
  .env-values { grid-column: 2; grid-row: 1/3; margin: 0; }
  .env-status { grid-column: 3; grid-row: 1; }
  .env-limits { grid-column: 3; }
  .env-hint, .environment-card footer { display: none; }
  .environment-card header { grid-column: 1; grid-row: 1/3; }
}
.wallboard .environment-sidebar { margin: 0 0 0 auto; }
.wallboard .environment-card { display: flex; gap: 12px; align-items: center; padding: 4px 10px; }
.wallboard .environment-card header small, .wallboard .env-scene, .wallboard .env-hint, .wallboard .env-limits, .wallboard .environment-card footer { display: none; }
.wallboard .env-values { margin: 0; }
.wallboard .env-value strong { font-size: 18px; }
.wallboard .env-value > span { display: none; }
@media (max-width: 540px) { .environment-card { grid-template-columns: 1fr 1fr; } .env-status { grid-column: 1; grid-row: 2; text-align: left; } .env-limits { display: none; } .environment-card header { grid-row: 1; } }
@media (prefers-reduced-motion: reduce) { .environment-card *, .environment-card *::before, .environment-card *::after { animation: none !important; } }
