:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fbff;
  --ink: #17202c;
  --muted: #5d6b7c;
  --line: #d9e2ed;
  --blue: #2563eb;
  --green: #0f9f6e;
  --amber: #b7791f;
  --red: #c2413b;
  --cyan: #0891b2;
  --violet: #6d5bd0;
  --shadow: 0 12px 36px rgba(31, 45, 61, 0.08);
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 10px 0 40px;
}

.topbar,
.panel-head,
.status-strip,
.segmented,
.legend {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 760;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.status-strip {
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

#logoutButton {
  min-width: 82px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 700;
}

.status-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary-card {
  min-height: 116px;
  padding: 18px;
  border-radius: 8px;
}

.summary-card span,
.summary-card small,
.value-card span,
.value-card small {
  display: block;
  color: var(--muted);
}

.summary-card span,
.value-card span {
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin: 10px 0 6px;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.summary-card #roomStatus.quality-ok {
  color: var(--green);
}

.summary-card #roomStatus.quality-error,
.summary-card #roomStatus.quality-offline {
  color: var(--red);
}

.summary-card small,
.value-card small {
  font-size: 13px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.asset-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.asset-card:hover,
.asset-card:focus {
  border-color: var(--blue);
}

.asset-card span,
.asset-card small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.asset-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.asset-card b {
  display: block;
  margin-top: 8px;
  text-transform: uppercase;
}

.quality-ok {
  color: var(--green);
}

.quality-error {
  color: var(--red);
}

.quality-offline {
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(520px, 1.2fr);
  gap: 16px;
}

.dashboard-grid-single {
  grid-template-columns: 1fr;
}

.asset-console-document {
  color-scheme: light dark;
}

.asset-console-page {
  --bg: #f3f6fa;
  --active-surface: #eef5ff;
  --connection-cover: rgb(250 252 254 / 86%);
  --button-ink: #fff;
  --alarm-surface: #fee8e8;
  --ok-surface: #e6f7ee;
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  .asset-console-page {
    --bg: #141819;
    --panel: #1e2426;
    --panel-strong: #282f32;
    --ink: #edf2f4;
    --muted: #b7c4cc;
    --line: #465258;
    --blue: #80bdff;
    --green: #5bdaa3;
    --amber: #f4c471;
    --red: #ff9898;
    --cyan: #70d6e7;
    --violet: #bcb0ff;
    --active-surface: #283b4c;
    --connection-cover: rgb(20 24 25 / 90%);
    --button-ink: #11202c;
    --alarm-surface: #462b2e;
    --ok-surface: #203d32;
    --shadow: 0 10px 30px rgb(0 0 0 / 16%);
  }

  .asset-console-header .zvalgis-brand img {
    background: #f3f6fa;
    border-radius: 50%;
  }
}

.asset-console-page .primary-button,
.asset-console-page .segmented .active {
  color: var(--button-ink);
}

.asset-console-page .segmented button:not(.active),
.asset-console-page .command-field input,
.asset-console-page .command-field select {
  background: var(--panel-strong);
}

.asset-console-page .scada-host,
.asset-console-page .scada-svg {
  background: var(--panel);
}

.asset-console-workspace .scada-svg {
  width: 100%;
  max-width: none;
}

.asset-console-shell {
  width: min(760px, calc(100% - 28px));
  padding-top: 14px;
}

.asset-console-header {
  display: grid;
  grid-template-columns: auto minmax(145px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 10px 4px 14px;
}

.zvalgis-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zvalgis-brand img {
  width: 48px;
  height: 48px;
}

.zvalgis-brand span,
.asset-console-title span,
.asset-primary-value span {
  display: grid;
}

.asset-console-header .zvalgis-brand span {
  display: none;
}

.zvalgis-brand strong {
  color: #071827;
  font-size: 17px;
  letter-spacing: 2px;
}

.zvalgis-brand small {
  color: #4d8f2c;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 2px;
}

.asset-console-title {
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.asset-console-title span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.asset-console-title h1 {
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-header-readings {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.asset-system-value {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 76px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.asset-system-control {
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.asset-system-control:not(:disabled):hover strong {
  color: var(--blue);
}

.asset-system-control:not(:disabled):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

.asset-system-control:disabled {
  cursor: default;
  opacity: 1;
}

.asset-system-value > span:last-child,
.asset-primary-value {
  display: grid;
}

.asset-system-value small,
.asset-primary-value span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.asset-system-value strong {
  margin-top: 3px;
  font-size: 15px;
}

.asset-primary-value {
  min-width: 112px;
}

.asset-primary-value strong {
  display: block;
  margin-top: 2px;
  color: var(--blue);
  font-size: 22px;
  line-height: 1.05;
  white-space: nowrap;
}

.asset-connections {
  display: grid;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.asset-connection-state {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 8px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--muted);
  font-size: 13px;
}

.asset-connection-state + .asset-connection-state {
  border-top: 1px solid var(--line);
}

.asset-connection-state > svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.6;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a1ab;
}

.asset-connection-state.checking .connection-dot {
  background: var(--amber);
  animation: connection-pulse 1.4s ease-in-out infinite;
}

.asset-connection-state.online .connection-dot {
  background: var(--green);
}

.asset-connection-state.offline .connection-dot {
  background: var(--red);
}

.asset-connection-state strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.asset-connection-state.offline strong {
  color: var(--red);
}

.asset-connection-state.online strong {
  color: var(--green);
}

.asset-connection-state.unknown strong {
  color: var(--muted);
}

.connection-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  padding: 48px 16px 24px;
  border-radius: inherit;
  background: var(--connection-cover);
  opacity: 1;
  visibility: visible;
  transition: opacity 240ms ease, visibility 240ms;
}

.connection-layer[data-state="ready"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.connection-panel {
  position: sticky;
  top: 24px;
  width: min(100%, 360px);
  margin: 0 auto;
  padding: 22px 22px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.connection-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.connection-heading > div {
  flex: 1;
  min-width: 0;
}

.connection-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  height: 24px;
  color: var(--blue);
}

.connection-symbol svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.connection-symbol .connection-error-icon {
  display: none;
}

.connection-loader {
  animation: connection-rotate 1.3s linear infinite;
}

.connection-layer[data-state="error"] .connection-loader {
  display: none;
}

.connection-layer[data-state="error"] .connection-error-icon {
  display: block;
  color: var(--red);
}

.connection-heading h2 {
  margin: 2px 0 6px;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.connection-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.connection-heading .connection-retry {
  flex: 0 0 30px;
  width: 30px;
  min-height: 30px;
  height: 30px;
}

.connection-retry svg {
  width: 16px;
  height: 16px;
}

@keyframes connection-rotate {
  to { transform: rotate(360deg); }
}

@keyframes connection-pulse {
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .connection-layer { transition: none; }
  .connection-loader,
  .asset-connection-state.checking .connection-dot { animation: none; }
}

.asset-status-dot {
  display: block;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
}

.asset-status-dot.ok {
  background: var(--green);
}

.asset-status-dot.offline {
  background: var(--red);
}

.asset-status-dot.idle {
  background: #94a3b8;
}

.asset-console-workspace {
  width: min(100%, 760px);
  margin: 0 auto;
}

.asset-console-workspace .schematic-panel {
  position: relative;
  min-height: 320px;
  margin-bottom: 0;
}

.asset-console-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.asset-console-nav a,
.asset-console-nav button {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.asset-console-nav a:hover,
.asset-console-nav a:focus-visible,
.asset-console-nav a.active,
.asset-console-nav button:hover,
.asset-console-nav button:focus-visible,
.asset-console-nav button.active {
  background: var(--active-surface);
  color: var(--blue);
}

.asset-console-nav a:focus-visible,
.asset-console-nav button:focus-visible {
  outline: 2px solid #9fc4ff;
  outline-offset: -2px;
}

.asset-console-nav svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.nav-icon-wrap {
  position: relative;
  display: grid;
  width: 24px;
  height: 21px;
  place-items: center;
}

.nav-alarm-count {
  position: absolute;
  top: -7px;
  right: -11px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  padding: 0 4px;
  background: #ef2f36;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.asset-view[hidden] {
  display: none;
}

.quick-trends-view,
.alarms-view {
  min-height: 680px;
  padding: 22px;
  overflow: visible;
}

.quick-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.quick-view-head h2 {
  margin-top: 3px;
  font-size: 24px;
}

.quick-periods {
  flex: 0 0 auto;
}

.quick-trend-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-period-button {
  min-width: 62px;
}

.quick-chart-reset {
  display: grid;
  height: 40px;
  place-items: center;
  background: var(--panel);
}

.quick-chart-reset svg {
  width: 17px;
  height: 17px;
}

.quick-point-select {
  display: grid;
  gap: 6px;
  max-width: 440px;
  padding-bottom: 14px;
}

.quick-point-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-point-select select {
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.quick-trend-chart {
  width: 100%;
  height: 380px;
  min-height: 380px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chart-empty {
  display: grid;
  height: 100%;
  place-items: center;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.quick-analysis {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 0 0;
}

.quick-analysis p:last-child {
  max-width: 72ch;
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.alarm-count {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 900;
}

.active-alarm-list {
  border-top: 1px solid var(--line);
}

.active-alarm-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.active-alarm-row div,
.alarm-clear {
  display: grid;
  gap: 3px;
}

.active-alarm-row small,
.alarm-clear small {
  color: var(--muted);
}

.alarm-indicator {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--alarm-surface, #fee8e8);
  color: var(--red);
  font-weight: 900;
}

.alarm-clear {
  justify-items: center;
  padding: 90px 20px;
  text-align: center;
}

.alarm-clear span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--ok-surface, #e6f7ee);
  color: var(--green);
  font-size: 28px;
  font-weight: 900;
}

.empty-view {
  margin: 0;
  color: var(--muted);
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

.schematic-panel {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}

.scada-host {
  display: flex;
  justify-content: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

[hidden] {
  display: none !important;
}

.primary-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.primary-button:disabled {
  border-color: var(--amber);
  background: var(--amber);
  color: #fff;
  opacity: 1;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.command-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.command-dialog {
  width: min(430px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.command-head,
.command-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.command-description,
.command-current,
.command-status {
  margin: 14px 0 0;
}

.command-description {
  color: var(--muted);
  line-height: 1.45;
}

.command-current {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  font-weight: 800;
}

.command-field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.command-field input,
.command-field select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.setting-dialog {
  width: min(520px, 100%);
}

.setting-meta,
.setting-details {
  display: grid;
  gap: 8px;
}

.setting-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.setting-meta span,
.setting-details div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
}

.setting-meta small,
.setting-details span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.setting-meta strong,
.setting-details strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.setting-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.setting-long-description {
  max-height: 220px;
  margin-top: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  white-space: pre-wrap;
}

.setting-advanced {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.setting-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-modal-input {
  width: 100%;
  max-width: 100%;
}

.setting-number-control {
  display: grid;
  gap: 8px;
}

.setting-special-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setting-special-values button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.command-status {
  min-height: 22px;
  color: var(--muted);
  font-weight: 750;
}

.command-status.ok {
  color: var(--green);
}

.command-status.pending {
  color: var(--amber);
}

.command-status.error {
  color: var(--red);
}

.command-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.command-actions button {
  min-width: 96px;
}

.template-preview-dialog {
  width: min(820px, 100%);
}

.template-preview-source {
  margin: 10px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.template-preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.template-preview-summary span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.template-preview-summary strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 18px;
}

.template-preview-table-wrap {
  max-height: 48vh;
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.template-preview-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.data-table.template-preview-table th,
.data-table.template-preview-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
  line-height: 1.35;
}

.template-preview-table th:first-child,
.template-preview-table td:first-child {
  width: 38%;
}

.template-preview-table th:nth-child(2),
.template-preview-table td:nth-child(2),
.template-preview-table th:nth-child(3),
.template-preview-table td:nth-child(3) {
  width: 16%;
}

.template-preview-table th:last-child,
.template-preview-table td:last-child {
  width: 30%;
}

.template-preview-table code {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.template-preview-table td:first-child strong {
  display: block;
}

.template-preview-status {
  font-weight: 800;
}

.template-preview-status.change {
  color: var(--blue);
}

.template-preview-status.same {
  color: var(--green);
}

.template-preview-status.not-read {
  color: var(--amber);
}

.template-preview-status.review {
  color: var(--amber);
}

.template-review-message {
  display: block;
  max-width: 190px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
}

.template-preview-issues {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #f2c7c4;
  border-radius: 7px;
  background: #fff7f6;
  color: var(--red);
  font-size: 13px;
}

.template-preview-issues ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 750;
}

#refreshButton {
  min-width: 96px;
}

.segmented {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.period-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

select {
  min-height: 38px;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 34px 0 12px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

input[type="search"],
input[type="date"] {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.range-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 14px;
}

.range-row label {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 96px;
  gap: 5px;
}

.range-row span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented button {
  min-width: 54px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

.segmented .active {
  background: var(--blue);
  color: #fff;
}

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

.value-card {
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.value-main {
  margin: 12px 0 8px;
  font-size: 32px;
  font-weight: 800;
}

.quality-ok {
  color: var(--green);
}

.quality-degraded,
.quality-invalid {
  color: var(--amber);
}

.quality-error,
.quality-offline {
  color: var(--red);
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.plotly-chart {
  width: 100%;
  height: min(68vh, 620px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdff;
}

.legend {
  gap: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.line {
  display: inline-block;
  width: 28px;
  height: 4px;
  margin-right: 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.temp1 {
  background: var(--blue);
}

.temp2 {
  background: var(--cyan);
}

.binding-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.scada-svg {
  display: block;
  width: 100%;
  height: auto;
  background: #fbfdff;
}

.scada-svg-portrait {
  width: min(100%, 720px);
  max-width: 720px;
}

.scada-svg-landscape {
  width: 100%;
}

.scada-host:empty {
  min-height: 320px;
}

.room-shell {
  fill: #dbeafe;
  stroke: #91b5df;
  stroke-width: 3;
}

.room-core {
  fill: url(#roomFill);
  stroke: #b8cfe8;
  stroke-width: 2;
}

.pipe {
  fill: none;
  stroke-linecap: round;
  stroke-width: 13;
}

.pipe.liquid {
  stroke: #2563eb;
}

.pipe.suction {
  stroke: #0891b2;
}

.pipe.discharge {
  stroke: #c2413b;
}

.pipe.return {
  stroke: #6d5bd0;
}

.device-block rect,
.compressor circle {
  fill: #ffffff;
  stroke: #c9d6e5;
  stroke-width: 2;
}

.fan circle {
  fill: #ecfeff;
  stroke: #67c6d6;
  stroke-width: 2;
}

.fan path {
  fill: #0891b2;
}

.compressor circle {
  fill: #fff7ed;
  stroke: #f0a36b;
}

.valve path {
  fill: #f5f3ff;
  stroke: var(--violet);
  stroke-width: 2;
}

.svg-action {
  cursor: pointer;
}

.scada-clickable {
  cursor: pointer;
}

.scada-clickable:focus {
  outline: none;
}

.scada-clickable:hover {
  filter: brightness(1.06);
}

.scada-clickable:focus-visible {
  filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.55));
}

.command-pending {
  animation: command-pending 0.8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.65));
}

.scada-toggle > rect,
.scada-toggle rect:first-child {
  fill: #ffffff !important;
  stroke: #9aa8b8 !important;
}

.scada-toggle.command-toggle-on > rect,
.scada-toggle.command-toggle-on rect:first-child {
  stroke: var(--green) !important;
}

.scada-toggle.command-toggle-off > rect,
.scada-toggle.command-toggle-off rect:first-child {
  stroke: var(--red) !important;
}

.command-error-badge {
  pointer-events: none;
  animation: command-error-badge 1.5s ease-out forwards;
  filter: drop-shadow(0 3px 8px rgba(194, 65, 59, 0.35));
}

.command-error-badge circle {
  fill: var(--red);
  stroke: #ffffff;
  stroke-width: 3;
}

.command-error-badge text {
  fill: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: 900;
}

.svg-action rect {
  fill: #ffffff;
  stroke: #b8cfe8;
  stroke-width: 2;
}

.svg-action path {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.svg-action circle {
  fill: #ffffff;
  stroke: var(--blue);
  stroke-width: 4;
}

.svg-action text {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.svg-action:hover rect,
.svg-action:focus rect {
  fill: #eef7ff;
  stroke: var(--blue);
}

.svg-title {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 800;
}

.svg-large-value {
  fill: var(--blue);
  font-size: 56px;
  font-weight: 850;
}

.svg-small-value {
  fill: var(--muted);
  font-size: 21px;
  font-weight: 750;
}

.alarm-shape {
  fill: #fee2e2;
  stroke: var(--red);
  stroke-width: 3;
}

.alarm-mark {
  fill: var(--red);
  font-size: 42px;
  font-weight: 900;
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

.spin {
  animation: rotate-center 2.8s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.smooth-blink {
  animation: smooth-blink 2.4s ease-in-out infinite;
}

.smooth-blink.hidden,
.hidden .smooth-blink {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .scada-host .spin,
  .smooth-blink { animation: none !important; }
}

.schema-error {
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red);
  background: #fff7f7;
  font-weight: 800;
}

.back-button {
  min-width: 104px;
}

.nav-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 700;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.data-table input {
  width: 140px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.settings-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 10px;
  margin: -4px 0 14px;
}

.settings-template-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-template-tools select {
  min-width: 220px;
}

.template-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.template-status.ok {
  color: var(--green);
}

.template-status.pending,
.template-status.warning {
  color: var(--amber);
}

.template-status.error {
  color: var(--red);
}

.settings-toolbar input,
.settings-toolbar select {
  max-width: none;
  width: 100%;
}

.settings-table {
  min-width: 640px;
}

.settings-table td {
  vertical-align: middle;
}

.settings-click-row {
  cursor: pointer;
}

.settings-click-row.settings-read-locked {
  cursor: wait;
  opacity: 0.62;
}

.settings-device-row td,
.settings-group-row td {
  padding: 8px 0;
  border-bottom: 0;
}

.settings-device-button,
.settings-group-button {
  display: grid;
  align-items: center;
  width: 100%;
  min-height: 44px;
  text-align: left;
}

.settings-device-button {
  grid-template-columns: 32px 1fr auto;
  padding: 0 14px;
  border-color: #b7c7d8;
  background: #eef4fb;
  font-size: 16px;
}

.settings-group-button {
  grid-template-columns: 32px 1fr auto;
  margin-left: 22px;
  width: calc(100% - 22px);
  padding: 0 12px;
  background: #f8fbff;
  color: var(--ink);
}

.settings-device-button small,
.settings-group-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.group-icon {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--blue);
}

.group-icon::before,
.group-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.group-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.group-icon.is-open::after {
  opacity: 0;
}

.settings-click-row:hover {
  background: #f8fbff;
}

.settings-click-row.settings-read-locked:hover {
  background: transparent;
}

.settings-click-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.parameter-cell {
  min-width: 250px;
  white-space: normal !important;
}

.parameter-cell strong {
  display: block;
}

.parameter-cell strong {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.settings-table code {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 13px;
}

.settings-row-status {
  display: inline-flex;
  min-width: 130px;
  color: var(--muted);
  font-weight: 750;
  white-space: normal;
}

.settings-row-status.ok {
  color: var(--green);
}

.settings-row-status.pending {
  color: var(--amber);
}

.settings-row-status.error {
  color: var(--red);
}

.config-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.fact-list div,
.mapping-item,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.fact-list div {
  min-height: 72px;
  padding: 12px;
}

.fact-list dt,
.profile-card small,
.mapping-item span,
.muted-text {
  color: var(--muted);
}

.fact-list dt {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fact-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 760;
}

.profile-list,
.mapping-list {
  display: grid;
  gap: 8px;
}

.profile-card {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.profile-card strong {
  overflow-wrap: anywhere;
}

.profile-card small {
  font-size: 12px;
  font-weight: 750;
}

.profile-card code,
.mapping-item code,
.config-table code {
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef4fb;
  color: var(--ink);
  font-size: 13px;
}

.mapping-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(160px, 1.2fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
}

.mapping-item span {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.compact-search {
  width: min(360px, 100%);
}

.config-table {
  min-width: 880px;
}

.config-table td {
  vertical-align: middle;
}

.config-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.muted-text {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.config-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.config-tab {
  min-width: 120px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.config-tab.active {
  border-bottom-color: var(--blue);
  color: var(--ink);
}

.config-page-status {
  min-height: 20px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.config-page-status.ok {
  color: var(--green);
}

.config-page-status.pending {
  color: var(--amber);
}

.config-page-status.error {
  color: var(--red);
}

.config-form-panel {
  max-width: 920px;
}

.config-form,
.config-modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.config-form label,
.config-modal-form > label,
.history-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.config-form input,
.config-form select,
.config-modal-form input,
.config-modal-form select,
.config-point-tools input,
.config-point-tools select,
.history-toolbar input,
.history-toolbar select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.config-check-line {
  display: flex !important;
  align-items: center;
  align-self: end;
  min-height: 42px;
  padding: 0 2px;
}

.config-check-line input,
.config-check-grid input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
}

.config-form-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.config-form-actions button {
  min-width: 130px;
}

.config-device-table,
.config-connection-table,
.config-point-table {
  min-width: 800px;
}

.config-device-table small,
.config-point-table small,
.history-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-action-button {
  min-width: 64px;
  min-height: 34px;
}

.config-connection-table-wrap {
  margin-top: 18px;
}

.config-points-head {
  align-items: flex-end;
}

.config-point-tools {
  display: grid;
  grid-template-columns: 210px minmax(240px, 360px);
  gap: 8px;
}

.usage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 400px;
}

.usage-list span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.config-dialog {
  width: min(560px, 100%);
}

.config-dialog-meta {
  margin: 7px 0 16px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.config-modal-form {
  grid-template-columns: 1fr;
}

.config-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.config-check-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.config-form-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.config-form-split label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-toolbar {
  display: grid;
  grid-template-columns: 180px 180px minmax(150px, 1fr) 150px minmax(220px, 1.3fr) auto;
  gap: 10px;
  align-items: end;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-actions button {
  min-width: 78px;
}

.history-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-table {
  min-width: 1160px;
}

.history-time {
  font-variant-numeric: tabular-nums;
}

.history-result {
  display: inline-flex;
  min-width: 68px;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--panel-strong);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-result.ok {
  background: #e8f8f1;
  color: var(--green);
}

.history-result.error {
  background: #fff0f0;
  color: var(--red);
}

.history-result.pending {
  background: #fff8e8;
  color: var(--amber);
}

.history-message {
  max-width: 260px;
  white-space: normal;
}

.history-empty {
  padding: 34px !important;
  color: var(--muted);
  text-align: center !important;
}

.readonly-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.row-pending {
  background: #fffaf0;
}

.graphs-layout {
  grid-template-columns: minmax(260px, 0.45fr) minmax(560px, 1.55fr);
}

.check-list {
  display: grid;
  gap: 8px;
}

.variable-toolbar {
  margin-bottom: 14px;
}

.variable-toolbar input {
  width: 100%;
}

.check-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  font-weight: 750;
}

.check-row small {
  max-width: 170px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variable-details {
  margin-top: 16px;
}

.variable-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

.all-variable-list {
  max-height: 420px;
  margin-top: 12px;
  overflow: auto;
}

.variable-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  font-weight: 750;
}

.variable-row small {
  max-width: 170px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.star-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
}

.star-button.active {
  border-color: #f3c14b;
  background: #fff7d6;
  color: #b7791f;
}

#downloadCsv {
  margin-top: 14px;
  min-width: 132px;
}

@keyframes rotate-center {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes smooth-blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

@keyframes command-pending {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.55;
  }
}

@keyframes command-error-badge {
  0% {
    opacity: 0;
  }

  16% {
    opacity: 1;
  }

  82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .summary-grid,
  .dashboard-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .value-grid {
    grid-template-columns: 1fr;
  }

  .history-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-search,
  .history-actions {
    grid-column: 1 / -1;
  }

  .asset-console-workspace {
    width: min(100%, 760px);
  }

}

@media (max-width: 640px) {
  .command-backdrop {
    padding: 10px;
  }

  .command-dialog {
    max-height: calc(100dvh - 20px);
    padding: 16px;
  }

  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 6px;
  }

  .asset-console-shell {
    width: min(100% - 16px, 1440px);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .asset-console-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    min-height: 60px;
    padding-top: 4px;
  }

  .zvalgis-brand img {
    width: 40px;
    height: 40px;
  }

  .zvalgis-brand span {
    display: none;
  }

  .asset-console-title {
    padding-left: 12px;
  }

  .asset-console-title h1 {
    font-size: 18px;
  }

  .asset-header-readings {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .asset-system-value,
  .asset-primary-value {
    width: 50%;
  }

  .asset-primary-value {
    min-width: 0;
    padding-left: 12px;
  }

  .asset-primary-value strong {
    font-size: 20px;
  }

  .connection-layer {
    padding: 24px 12px;
  }

  .connection-panel {
    padding: 18px 16px 4px;
  }

  .asset-console-nav {
    position: relative;
    margin-top: 8px;
    padding: 5px;
  }

  .asset-console-nav a,
  .asset-console-nav button {
    min-width: 0;
    min-height: 48px;
    padding: 0 3px;
    font-size: 10px;
  }

  .asset-console-nav svg {
    width: 18px;
    height: 18px;
  }

  .quick-trends-view,
  .alarms-view {
    min-height: 600px;
    padding: 14px;
  }

  .quick-view-head,
  .quick-analysis {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .quick-view-head {
    display: grid;
  }

  .quick-periods {
    flex: 1;
  }

  .quick-trend-controls {
    width: 100%;
  }

  .quick-period-button {
    flex: 1;
  }

  .quick-trend-chart {
    height: 330px;
    min-height: 330px;
  }

  .quick-analysis .primary-button {
    width: 100%;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .back-button,
  .topbar-actions .nav-button {
    flex: 1;
  }

  .chart-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .period-controls,
  .range-row {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  select,
  input[type="date"],
  .segmented {
    width: 100%;
  }

  .settings-toolbar {
    grid-template-columns: 1fr;
  }

  .config-form,
  .config-form-split,
  .config-check-grid,
  .config-point-tools,
  .history-toolbar {
    grid-template-columns: 1fr;
  }

  .config-point-tools,
  .config-point-tools input,
  .config-point-tools select {
    width: 100%;
  }

  .config-tabs {
    margin-right: -10px;
    margin-left: -10px;
    padding: 0 10px;
  }

  .config-tab {
    min-width: 104px;
  }

  .history-search,
  .history-actions {
    grid-column: auto;
  }

  .history-actions button {
    flex: 1;
  }

  .settings-template-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .settings-template-tools select,
  .settings-template-tools .template-status {
    grid-column: 1 / -1;
    width: 100%;
  }

  .template-preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-preview-table-wrap {
    overflow-x: hidden;
  }

  .template-preview-table,
  .template-preview-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .template-preview-table thead {
    display: none;
  }

  .template-preview-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 11px;
    border-bottom: 1px solid var(--line);
  }

  .template-preview-table tr:last-child {
    border-bottom: 0;
  }

  .template-preview-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .template-preview-table tr > td:nth-child(n) {
    width: auto;
  }

  .template-preview-table td:first-child {
    grid-column: 1 / -1;
  }

  .template-preview-table td:nth-child(n + 2)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .template-preview-table td:nth-child(2)::before {
    content: "Current";
  }

  .template-preview-table td:nth-child(3)::before {
    content: "New";
  }

  .template-preview-table td:nth-child(4)::before {
    content: "Status";
  }

  .table-wrap {
    overflow-x: visible;
  }

  .settings-table,
  .settings-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .settings-table thead {
    display: none;
  }

  .settings-table .settings-device-row,
  .settings-table .settings-group-row {
    display: block;
  }

  .settings-table .settings-device-row td,
  .settings-table .settings-group-row td {
    display: block;
    width: 100%;
  }

  .settings-table .settings-click-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 6px 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
  }

  .settings-table .settings-click-row td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .settings-table .settings-click-row td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .settings-table .settings-current-value {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    text-align: right;
    white-space: nowrap;
  }

  .settings-table .settings-click-row td:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    max-width: 150px;
    text-align: right;
  }

  .settings-row-status {
    min-width: 0;
    justify-content: flex-end;
    font-size: 12px;
  }

  .parameter-cell,
  .parameter-cell strong {
    min-width: 0;
    max-width: none;
  }

  .settings-group-button {
    margin-left: 12px;
    width: calc(100% - 12px);
  }

  .history-table,
  .history-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .history-table thead {
    display: none;
  }

  .history-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    padding: 13px 2px;
    border-bottom: 1px solid var(--line);
  }

  .history-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .history-table td:nth-child(1),
  .history-table td:nth-child(2),
  .history-table td:nth-child(6),
  .history-table td:nth-child(7) {
    color: var(--muted);
    font-size: 12px;
  }

  .history-table td:nth-child(3) {
    grid-column: 1 / -1;
  }

  .history-table td:nth-child(4),
  .history-table td:nth-child(5) {
    grid-row: 3;
  }

  .history-table td:nth-child(4)::before,
  .history-table td:nth-child(5)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .history-table td:nth-child(4)::before {
    content: "Old";
  }

  .history-table td:nth-child(5) {
    grid-column: 2;
    text-align: right;
  }

  .history-table td:nth-child(5)::before {
    content: "New";
  }

  .history-table td:nth-child(8) {
    grid-column: 1 / -1;
  }

  .history-message {
    max-width: none;
  }

  .history-empty {
    display: block !important;
  }

  .config-point-table,
  .config-point-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .config-point-table thead {
    display: none;
  }

  .config-point-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
  }

  .config-point-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .config-point-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .config-point-table td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-wrap: anywhere;
  }

  .config-point-table td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .config-point-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
  }

  .fact-list,
  .mapping-item {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
