:root {
  --bg-main: linear-gradient(180deg, #1d2635 0%, #243040 100%);
  --bg-panel: #121b2a;
  --bg-panel-strong: #182335;
  --text-main: #edf2f8;
  --text-soft: #97a3b6;
  --border: rgba(163, 177, 198, 0.1);
  --accent: #4b89ff;
  --accent-green: #2bb673;
  --ok: #30d0b2;
  --ko: #ff6f86;
  --shadow: 0 18px 34px rgba(6, 12, 20, 0.22);
  --sidebar-bg: #111a29;
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --topbar-bg: rgba(18, 27, 42, 0.86);
  --footer-bg: rgba(12, 20, 32, 0.9);
  --chip-bg: rgba(255, 255, 255, 0.03);
  --chip-border: rgba(255, 255, 255, 0.06);
  --hero-card-bg: rgba(36, 50, 73, 0.72);
  --eyebrow: #73b5ff;
  --brand-primary: #1480e5;
  --brand-secondary: #2bb673;
  --brand-neutral: #f8fbff;
  --heartbeat: #5eb6ff;
  --heartbeat-shadow: rgba(76, 174, 255, 0.4);
  --plant-item-bg: rgba(5, 18, 28, 0.72);
  --plant-item-active: linear-gradient(180deg, rgba(75, 137, 255, 0.18), rgba(30, 40, 60, 0.25));
  --positive-bg: linear-gradient(180deg, rgba(17, 41, 59, 0.72), rgba(16, 33, 48, 0.92));
  --positive-text: #c6f6d5;
}

:root.light-mode {
  --bg-main: radial-gradient(circle at top center, #ffffff 0%, #edf4f8 52%, #d7e4ec 100%);
  --bg-panel: rgba(255, 255, 255, 0.97);
  --bg-panel-strong: #edf4f8;
  --text-main: #0e2233;
  --text-soft: #3e5a6f;
  --border: rgba(31, 85, 121, 0.18);
  --shadow: 0 18px 44px rgba(31, 55, 77, 0.1);
  --sidebar-bg: linear-gradient(180deg, #dbe8f0 0%, #eef4f8 100%);
  --sidebar-border: rgba(31, 85, 121, 0.12);
  --topbar-bg: linear-gradient(180deg, #f9fcff 0%, #edf4f8 100%);
  --footer-bg: rgba(249, 252, 255, 0.92);
  --chip-bg: rgba(255, 255, 255, 0.92);
  --chip-border: rgba(31, 85, 121, 0.16);
  --hero-card-bg: rgba(255, 255, 255, 0.84);
  --eyebrow: #2f79bf;
  --brand-primary: #1d74bf;
  --brand-secondary: #2a8f64;
  --brand-neutral: #ffffff;
  --heartbeat: #4a90d6;
  --heartbeat-shadow: rgba(74, 144, 214, 0.22);
  --plant-item-bg: rgba(255, 255, 255, 0.92);
  --plant-item-active: linear-gradient(180deg, rgba(20, 128, 229, 0.16), rgba(255, 255, 255, 0.98));
  --positive-bg: linear-gradient(180deg, rgba(231, 245, 237, 0.98), rgba(244, 251, 246, 0.98));
  --positive-text: #0f7a4b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: var(--app-font-family, "IBM Plex Sans", "Segoe UI", sans-serif);
  font-size: var(--font-size-base, 13px);
  background: var(--bg-main);
}

button,
input,
select,
textarea {
  font: inherit;
}

a,
button,
input[type="checkbox"],
select,
summary,
[role="button"] {
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  border-radius: 0;
  padding: 1rem 0.85rem;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1rem;
  min-height: 100vh;
  box-shadow: none;
}

.sidebar-head {
  display: grid;
  gap: 0.8rem;
}

.nav-home-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: flex-start;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8eb2ff;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-block {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.3rem 0.2rem;
  border-radius: 14px;
  border: 0;
  background: transparent;
}

.brand-mark {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--brand-primary) 52%, transparent), color-mix(in srgb, var(--brand-primary) 18%, transparent) 48%, color-mix(in srgb, var(--brand-primary) 4%, transparent) 80%);
  border: 1px solid color-mix(in srgb, var(--brand-primary) 34%, transparent);
}

.orbit {
  position: absolute;
  inset: 14px 5px;
  border: 2px solid color-mix(in srgb, var(--accent) 46%, transparent);
  border-radius: 50%;
}

.orbit-a {
  transform: rotate(22deg);
}

.orbit-b {
  transform: rotate(-38deg);
}

.planet {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.planet-a {
  width: 16px;
  height: 16px;
  right: 10px;
  top: 18px;
  background: var(--brand-neutral);
  box-shadow: 0 0 16px color-mix(in srgb, var(--brand-neutral) 82%, transparent);
}

.planet-b {
  width: 18px;
  height: 18px;
  left: 10px;
  top: 36px;
  background: var(--accent-green);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent-green) 65%, transparent);
}

.planet-c {
  width: 14px;
  height: 14px;
  right: 24px;
  bottom: 12px;
  background: color-mix(in srgb, var(--accent) 80%, transparent);
}

.brand-text h1,
.brand-text p {
  margin: 0;
  line-height: 1;
}

.brand-text h1 {
  font-size: 2.15rem;
  letter-spacing: 0.04em;
  color: var(--brand-primary);
}

.brand-text p {
  margin-top: 0.2rem;
  font-size: 1.55rem;
  color: var(--brand-secondary);
  font-weight: 500;
}

.brand-clock {
  display: grid;
  gap: 0.15rem;
  margin: 0.4rem 0.3rem 0.1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-panel-strong) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
}

.brand-clock-label {
  color: var(--text-soft);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-clock strong {
  font-size: 0.98rem;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.brand-clock span {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-primary);
  line-height: 1;
}

.brand-clock small {
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-heartbeat {
  padding: 0 0.3rem;
}

.brand-heartbeat svg {
  width: 100%;
  height: 26px;
  overflow: visible;
}

.brand-heartbeat path {
  fill: none;
  stroke: var(--heartbeat);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px var(--heartbeat-shadow));
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: heartbeatLine 3.2s ease-in-out infinite;
}

.sidebar-shortcuts {
  display: grid;
  gap: 0.5rem;
}

.sidebar-shortcut-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-start;
  background: var(--chip-bg);
  color: var(--text-main);
}

.sidebar-section {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  overflow: hidden;
}

.sidebar-group {
  display: grid;
  gap: 0.6rem;
}

.sidebar-nav-list {
  display: grid;
  gap: 0.35rem;
}

.sidebar-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border-color: transparent;
  color: var(--text-main);
  padding: 0.58rem 0.72rem;
}

.sidebar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-mini {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8eb2ff;
}

.nav-mini svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-label {
  margin: 0;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-list {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  overflow: auto;
}

.content-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.content {
  display: grid;
  padding: 1.25rem;
  min-height: 0;
  min-width: 0;
}

.app-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1rem;
  min-height: 38px;
  padding: 0.4rem 1.25rem 0.5rem;
  border-top: 1px solid var(--chip-border);
  background: var(--footer-bg);
}

.app-footer-link,
.app-footer-version {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.app-footer-link {
  justify-self: center;
  text-decoration: none;
  transition: color 0.18s ease;
}

.app-footer-link:hover {
  color: var(--text-main);
}

.app-footer-version {
  justify-self: end;
}

.topbar {
  margin: 0;
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  padding: 0.8rem 1.25rem;
  background: var(--topbar-bg);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  box-shadow: none;
}

.topbar-left,
.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  min-width: 0;
}

.topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
}

.topbar-stat-label {
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
  white-space: nowrap;
}

.topbar-stat strong {
  margin-left: auto;
  font-size: 1rem;
  color: var(--text-main);
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: color-mix(in srgb, var(--text-main) 88%, #ffffff);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar-title {
  color: color-mix(in srgb, var(--text-main) 88%, #ffffff);
  font-weight: 600;
}

.topbar-search,
.dashboard-search {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0 0.72rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
}

.topbar-search input,
.dashboard-search input {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
}

.topbar-search-icon {
  color: var(--text-soft);
}

.view-section {
  display: grid;
  gap: 1rem;
  min-height: 0;
}

.hidden {
  display: none;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.nested-panel {
  background: var(--bg-panel-strong);
  box-shadow: none;
}

.hero-panel,
.section-head,
.details-head,
.hero-actions,
.details-actions,
.form-actions,
.table-actions {
  display: flex;
  gap: 0.75rem;
}

.hero-panel,
.section-head,
.details-head {
  justify-content: space-between;
  align-items: flex-start;
}

.hero-panel > *,
.section-head > *,
.details-head > *,
.users-section-head > *,
.topbar-left {
  min-width: 0;
}

.hero-summary {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.dashboard-strip {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 360px);
  align-items: end;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
}

.hero-chart-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 16px;
  background: var(--hero-card-bg);
}

.hero-panel h2,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
}

.hero-panel h2 {
  font-size: 1.1rem;
}

.hero-actions-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  min-width: 0;
}

.hero-action-card {
  display: grid;
  justify-items: start;
  gap: 0.18rem;
  min-height: 78px;
  padding: 0.72rem;
  background: var(--hero-card-bg);
}

.hero-action-card strong,
.hero-action-card small {
  display: block;
}

.hero-action-card small {
  color: var(--text-soft);
  text-align: left;
}

.eyebrow {
  margin: 0 0 0.18rem;
  color: var(--eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
}

.subtle {
  color: var(--text-soft);
  margin: 0.12rem 0 0;
}

.plant-item {
  text-align: left;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.plant-item:hover {
  transform: translateY(-2px);
  border-color: rgba(116, 182, 255, 0.38);
}

.plant-item {
  background: var(--plant-item-bg);
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.25rem;
}

.plant-item.active {
  border-color: rgba(75, 137, 255, 0.38);
  background: var(--plant-item-active);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 156px));
  gap: 0.45rem;
}

.stats-grid-hero {
  justify-content: start;
  align-self: start;
}

.stat-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.42rem 0.55rem;
  min-height: 58px;
}

.stat-card strong {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1;
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.stat-dot {
  width: 12px;
  height: 12px;
  display: inline-flex;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.stat-dot-plants {
  background: #f4c542;
}

.stat-dot-devices {
  background: #2a84ff;
}

.stat-dot-offline {
  background: #ff5b6e;
}

.dashboard-donut {
  --donut-chart: conic-gradient(#f4c542 0 33%, #2a84ff 33% 66%, #ff5b6e 66% 100%);
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--donut-chart);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.donut-hole {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-panel);
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--border);
}

.donut-hole strong,
.donut-hole span {
  display: block;
}

.donut-hole strong {
  font-size: 1.35rem;
  line-height: 1;
}

.donut-hole span {
  color: var(--text-soft);
  font-size: 0.74rem;
}

.offline-list {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.offline-legend {
  display: grid;
  gap: 0.38rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.offline-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
}

.offline-legend .subtle {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.offline-panel {
  display: grid;
  align-content: start;
  min-height: 0;
}

.offline-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 111, 134, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(58, 21, 31, 0.4), rgba(24, 33, 45, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 111, 134, 0.06);
}

.offline-main {
  display: grid;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.history-block {
  display: grid;
  gap: 0.2rem;
  width: fit-content;
  max-width: 100%;
}

.history-bar {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  margin-top: 0.2rem;
}

.history-scale {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.2rem;
  width: 100%;
}

.history-scale small {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.history-segment {
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.history-up {
  background: #61e69a;
}

.history-down {
  background: #ff556f;
}

.offline-item p,
.offline-meta small,
.device-subtle {
  margin: 0.22rem 0 0;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.offline-meta {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
  text-align: right;
}

.offline-variations {
  display: grid;
  gap: 0.16rem;
  margin-top: 0.35rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 1rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.settings-stack {
  display: grid;
  gap: 1rem;
}

.settings-panel-wide,
.settings-panel-compact {
  display: grid;
  gap: 0.85rem;
}

#fixed-settings-form {
  gap: 0.9rem;
}

.fixed-settings-grid {
  align-items: start;
}

.cards-grid-2 {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.network-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.39fr) minmax(280px, 0.61fr);
  gap: 1rem;
}

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

.devices-column,
.network-side-column {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

.form-panel {
  max-width: 680px;
}

.add-network-stage {
  align-content: start;
  justify-items: center;
  padding-top: clamp(0.5rem, 5vh, 2.4rem);
}

.add-network-stage .section-head,
.add-network-stage .form-panel {
  width: min(760px, 100%);
}

.add-network-stage .section-head {
  justify-content: flex-start;
}

.add-network-stage .form-panel {
  margin: 0 auto;
}

.panel-details {
  display: grid;
  gap: 1rem;
}

form {
  display: grid;
  gap: 0.75rem;
}

.compact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.75rem;
}

.compact-form-grid-compact {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 0.6rem;
}

.field-span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.toggle-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.3rem;
  min-height: 44px;
  padding: 0.62rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(16, 23, 33, 0.78);
}

.toggle-card input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.settings-section {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid rgba(75, 137, 255, 0.12);
  border-radius: 14px;
  background: rgba(18, 27, 42, 0.92);
}

.dynamic-settings-split {
  align-items: start;
}

.dynamic-settings-split .settings-section {
  height: 100%;
}

.network-visibility-block {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(75, 137, 255, 0.12);
}

.network-visibility-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.network-visibility-head .subtle {
  margin: 0.22rem 0 0;
}

.network-visibility-list {
  display: grid;
  gap: 0.6rem;
}

.network-visibility-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.visibility-add-btn,
.visibility-remove-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

.visibility-add-btn .action-icon,
.visibility-remove-btn .action-icon {
  width: 16px;
  height: 16px;
  background: transparent;
}

.visibility-add-btn .action-icon svg,
.visibility-remove-btn .action-icon svg {
  width: 14px;
  height: 14px;
}

.visibility-user-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.72rem 0.8rem;
}

.visibility-user-card.is-inactive {
  opacity: 0.74;
}

.visibility-user-copy {
  display: grid;
  min-width: 0;
}

.visibility-user-copy strong {
  color: var(--text-main);
  font-size: 0.9rem;
}

.visibility-user-copy small {
  color: var(--text-soft);
  white-space: normal;
  overflow-wrap: anywhere;
}

.visibility-user-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.network-visibility-empty {
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--text-soft);
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.02);
}

.settings-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ec7ff;
}

.settings-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 1rem;
}

.settings-actions-inline {
  display: flex;
  justify-content: flex-end;
}

.settings-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 1rem;
}

.settings-guide-card {
  display: grid;
  gap: 0.7rem;
  padding: 1rem 1.05rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.settings-guide-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.48rem;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.settings-guide-list li {
  overflow-wrap: anywhere;
}

.settings-guide-list strong,
.settings-guide-list code {
  color: var(--text-main);
}

.settings-guide-list a {
  color: var(--accent);
  text-decoration: none;
}

.settings-guide-list a:hover {
  text-decoration: underline;
}

.field-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.field-help {
  margin-top: -0.04rem;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.field-help code {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.08rem 0.32rem;
  border-radius: 6px;
}

.settings-inline-note {
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(75, 137, 255, 0.14);
  background: rgba(39, 87, 146, 0.12);
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

.settings-inline-note strong {
  color: var(--text-main);
}

.settings-time-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.settings-time-box-copy {
  display: grid;
  gap: 0.24rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(75, 137, 255, 0.16);
  background: linear-gradient(180deg, rgba(39, 87, 146, 0.16), rgba(24, 40, 74, 0.16));
}

.settings-time-box-copy strong {
  color: var(--text-main);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-time-box-copy span {
  color: var(--brand-primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.backup-restore-note {
  margin-top: 0.15rem;
}

.field-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #8ec7ff;
  font-size: 0.78rem;
}

.field-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input,
select,
textarea,
button {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(57, 70, 92, 0.88);
  color: var(--text-main);
  padding: 0.62rem 0.72rem;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 220px;
}

button {
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--accent) 80%, #315dbf),
    color-mix(in srgb, var(--accent) 100%, #79a7ff)
  );
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(39, 92, 173, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease,
    background 0.18s ease, color 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(39, 92, 173, 0.22);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.plant-actions-row {
  flex-wrap: wrap;
  gap: 0.58rem;
}

.plant-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  min-width: 0;
  padding: 0.52rem 0.76rem;
  border-radius: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: none;
}

.plant-action-primary {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 86%, #5d90ff),
    color-mix(in srgb, var(--accent) 92%, #315dbf)
  );
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  color: #f7fbff;
}

.plant-action-secondary {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(163, 177, 198, 0.16);
  color: rgba(237, 242, 248, 0.94);
}

.plant-action-danger {
  background: linear-gradient(180deg, rgba(127, 40, 62, 0.72), rgba(108, 33, 52, 0.72));
  border-color: rgba(255, 111, 134, 0.26);
  color: #ffd3da;
}

.plant-action-btn:hover:not(:disabled) {
  box-shadow: 0 12px 24px rgba(6, 12, 20, 0.18);
}

.plant-action-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.plant-action-danger:hover:not(:disabled) {
  box-shadow: 0 12px 24px rgba(111, 28, 47, 0.2);
}

.danger-btn {
  background: linear-gradient(120deg, rgba(122, 32, 52, 0.72), rgba(164, 49, 72, 0.72));
  border-color: rgba(255, 111, 134, 0.4);
  color: #ffc8d1;
  box-shadow: 0 10px 22px rgba(111, 28, 47, 0.22);
}

.danger-btn:hover:not(:disabled) {
  box-shadow: 0 14px 28px rgba(111, 28, 47, 0.28);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.devices-box {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0.58rem 0.38rem;
  font-size: 0.84rem;
  vertical-align: top;
}

th {
  text-align: center;
  vertical-align: middle;
  color: var(--text-soft);
  font-weight: 600;
}

.table-head-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
}

.table-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #7da7d6;
}

.table-head-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notify-group-head,
.notify-col-head,
.notify-col-cell {
  text-align: center;
}

.notify-group-head {
  letter-spacing: 0.04em;
}

.notify-col-head,
.notify-col-cell {
  width: 58px;
  padding-left: 0.18rem;
  padding-right: 0.18rem;
}

.device-name {
  font-weight: 600;
}

.device-status-stack {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
}

.table-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.table-toggle input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0.25rem 0.62rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-up {
  color: var(--ok);
  border-color: rgba(48, 208, 178, 0.32);
  background: rgba(48, 208, 178, 0.09);
}

.badge-down {
  color: var(--ko);
  border-color: rgba(255, 111, 134, 0.32);
  background: rgba(255, 111, 134, 0.09);
}

.channel-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
}

.web-link-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    background 0.18s ease;
}

.web-link-btn.is-ready {
  color: #edf5ff;
  border-color: rgba(108, 154, 212, 0.3);
  background: linear-gradient(120deg, rgba(49, 105, 172, 0.86), rgba(91, 146, 210, 0.86));
}

.web-link-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: rgba(151, 163, 182, 0.8);
  border-color: rgba(151, 163, 182, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.web-link-btn.is-ready:hover {
  transform: translateY(-1px);
  color: #edf5ff;
  border-color: rgba(108, 154, 212, 0.3);
  background: linear-gradient(120deg, rgba(49, 105, 172, 0.9), rgba(91, 146, 210, 0.9));
}

.channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.channel-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-bulk-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.26rem 0.45rem 0.26rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.notification-bulk-label {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notification-bulk-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.channel-btn.active {
  color: #edf5ff;
  border-color: rgba(108, 154, 212, 0.3);
  box-shadow: 0 0 0 1px rgba(108, 154, 212, 0.16) inset;
}

.channel-btn.channel-mail.active,
.channel-btn[data-action="toggle-mail"].active {
  background: linear-gradient(120deg, rgba(66, 109, 178, 0.86), rgba(107, 149, 214, 0.86));
}

.channel-btn.channel-telegram.active,
.channel-btn[data-action="toggle-telegram"].active {
  background: linear-gradient(120deg, rgba(52, 133, 166, 0.86), rgba(93, 171, 201, 0.86));
}

.discovery-head,
.script-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.script-copy-btn {
  align-self: center;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  font-size: 0.78rem;
  gap: 0.46rem;
}

.script-copy-btn .action-icon {
  width: 15px;
  height: 15px;
}

.script-copy-btn .action-icon svg {
  width: 10px;
  height: 10px;
}

.compact-btn {
  width: auto;
  min-width: 0;
  padding: 0.62rem 0.8rem;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.78rem;
  padding: 0.42rem 0.58rem;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.action-icon {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: currentColor;
  flex: 0 0 auto;
  font-size: 0.72rem;
  line-height: 1;
}

.action-icon svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-icon-user svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-nav-btn {
  min-width: 0;
}

.icon-only-btn {
  width: 42px;
  min-width: 42px;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.profile-summary-card {
  gap: 0.9rem;
}

.password-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.password-fields {
  display: grid;
  gap: 0.75rem;
}

.password-actions {
  display: grid;
  gap: 0.65rem;
  align-content: center;
  min-width: 180px;
}

.password-actions .compact-btn,
.password-actions button {
  width: 100%;
}

.users-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
}

.users-section-list,
.users-section-editor {
  align-content: start;
}

.users-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.2rem;
}

.users-email-hint {
  margin-top: 0.85rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(74, 130, 198, 0.18);
  background: rgba(74, 130, 198, 0.08);
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

.users-email-hint strong {
  color: var(--text-main);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.75rem;
}

.profile-item {
  display: grid;
  gap: 0.12rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(75, 137, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.profile-label {
  color: var(--text-soft);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.users-table th,
.users-table td {
  text-align: left;
  vertical-align: middle;
}

.users-table td:last-child,
.users-table th:last-child {
  text-align: right;
}

.user-row-actions {
  display: inline-flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 700;
}

.pill-role {
  color: #cfe4ff;
  background: rgba(74, 130, 198, 0.16);
  border-color: rgba(74, 130, 198, 0.26);
}

.pill-status-on {
  color: #b9f0d7;
  background: rgba(43, 182, 115, 0.14);
  border-color: rgba(43, 182, 115, 0.24);
}

.pill-status-off {
  color: #ffc6cf;
  background: rgba(211, 76, 104, 0.14);
  border-color: rgba(211, 76, 104, 0.24);
}

.pill-alarm-open {
  color: #ffd8de;
  background: rgba(211, 76, 104, 0.18);
  border-color: rgba(211, 76, 104, 0.3);
}

.pill-alarm-ack {
  color: #ffe7bb;
  background: rgba(191, 133, 34, 0.18);
  border-color: rgba(191, 133, 34, 0.3);
}

.alarm-note {
  max-width: 320px;
  padding: 0.52rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(191, 133, 34, 0.24);
  background: rgba(191, 133, 34, 0.1);
  color: var(--text-main);
  font-size: 0.8rem;
  line-height: 1.45;
}

.alarm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.form-error {
  margin: 0;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  color: #ffd5dc;
  border: 1px solid rgba(211, 76, 104, 0.32);
  background: rgba(211, 76, 104, 0.14);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(7, 12, 20, 0.58);
  backdrop-filter: blur(10px);
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: min(460px, calc(100vw - 2rem));
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  box-shadow: 0 26px 60px rgba(6, 12, 20, 0.3);
}

.auth-brand {
  display: grid;
  gap: 0.4rem;
}

.auth-brand h2 {
  margin: 0;
}

.auth-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-align: center;
}

.hero-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: start;
}

.discovery-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 14, 24, 0.54);
  backdrop-filter: blur(6px);
}

.discovery-overlay.hidden {
  display: none;
}

.discovery-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 1.05rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(116, 182, 255, 0.22);
  background: rgba(10, 22, 34, 0.86);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.28);
}

.signal {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7dc3ff;
  opacity: 0.25;
  animation: networkPulse 1.2s infinite ease-in-out;
}

.signal-b {
  animation-delay: 0.16s;
}

.signal-c {
  animation-delay: 0.32s;
}

body.is-discovering #discover-btn {
  box-shadow: 0 0 0 1px rgba(116, 182, 255, 0.3) inset, 0 0 28px rgba(11, 123, 223, 0.3);
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--text-soft);
}

.empty-state-positive {
  display: grid;
  gap: 0.3rem;
  min-height: 220px;
  place-items: center;
  text-align: center;
  border-style: solid;
  background: var(--positive-bg);
}

.empty-state-positive strong {
  font-size: 1.35rem;
  color: var(--positive-text);
}

.empty-state-positive p {
  margin: 0;
}

.device-dialog {
  width: min(680px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  color: var(--text-main);
  background: var(--bg-panel);
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.34);
}

.device-dialog::backdrop {
  background: rgba(5, 14, 24, 0.7);
  backdrop-filter: blur(6px);
}

.device-dialog form {
  padding: 1rem;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

:root.light-mode .topbar-badge {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--brand-primary);
}

:root.light-mode .topbar-title,
:root.light-mode .brand-text h1 {
  color: var(--brand-primary);
}

:root.light-mode .brand-text p {
  color: var(--brand-secondary);
}

:root.light-mode .sidebar-shortcut-btn,
:root.light-mode .nav-home-btn,
:root.light-mode .plant-item,
:root.light-mode .notification-bulk-group,
:root.light-mode .toggle-card,
:root.light-mode .settings-section,
:root.light-mode .topbar-stat,
:root.light-mode .dashboard-search,
:root.light-mode .topbar-search,
:root.light-mode .secondary-btn {
  background: var(--chip-bg);
  border-color: var(--chip-border);
}

:root.light-mode .hero-action-card {
  background: var(--hero-card-bg);
  border-color: var(--chip-border);
}

:root.light-mode .nav-home-btn {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

:root.light-mode button:not(.secondary-btn):not(.danger-btn):not(.channel-btn):not(.web-link-btn) {
  color: #ffffff;
  border-color: rgba(74, 127, 179, 0.24);
  background: linear-gradient(120deg, #4f7db0, #78a7d6);
  box-shadow: 0 12px 26px rgba(67, 118, 166, 0.18);
}

:root.light-mode button:not(.secondary-btn):not(.danger-btn):not(.channel-btn):not(.web-link-btn):hover:not(:disabled) {
  box-shadow: 0 16px 30px rgba(67, 118, 166, 0.22);
  background: linear-gradient(120deg, #4877aa, #709fce);
}

:root.light-mode .settings-section {
  background: linear-gradient(180deg, rgba(248, 251, 253, 0.98), rgba(237, 244, 248, 0.98));
  border-color: rgba(31, 85, 121, 0.14);
  box-shadow: 0 10px 28px rgba(31, 55, 77, 0.05);
}

:root.light-mode .settings-inline-note {
  background: rgba(74, 130, 198, 0.08);
  border-color: rgba(31, 85, 121, 0.14);
}

:root.light-mode .field-help code {
  background: rgba(31, 85, 121, 0.08);
}

:root.light-mode .network-visibility-block {
  border-top-color: rgba(31, 85, 121, 0.12);
}

:root.light-mode .network-visibility-empty {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(31, 85, 121, 0.16);
}

:root.light-mode .settings-section-title {
  color: #0f5fb0;
}

:root.light-mode .settings-section label {
  color: #35556c;
}

:root.light-mode .settings-section .toggle-card span,
:root.light-mode .settings-section .field-title {
  color: var(--text-soft);
}

:root.light-mode .profile-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 250, 0.98));
  border-color: rgba(31, 85, 121, 0.12);
}

:root.light-mode .users-email-hint {
  background: rgba(74, 130, 198, 0.08);
  border-color: rgba(74, 130, 198, 0.14);
}

:root.light-mode .pill-role {
  color: #355f86;
  background: rgba(74, 130, 198, 0.12);
  border-color: rgba(74, 130, 198, 0.18);
}

:root.light-mode .pill-status-on {
  color: #117148;
  background: rgba(43, 182, 115, 0.12);
  border-color: rgba(43, 182, 115, 0.2);
}

:root.light-mode .pill-status-off {
  color: #9e2940;
  background: rgba(211, 76, 104, 0.12);
  border-color: rgba(211, 76, 104, 0.2);
}

:root.light-mode .form-error {
  color: #9f3047;
  background: rgba(255, 239, 242, 0.96);
  border-color: rgba(211, 76, 104, 0.2);
}

:root.light-mode .auth-overlay {
  background: rgba(217, 231, 239, 0.54);
}

:root.light-mode .table-head-icon {
  color: #4576a6;
}

:root.light-mode .web-link-btn {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(31, 85, 121, 0.16);
  color: #2a5f8c;
}

:root.light-mode .channel-btn {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(31, 85, 121, 0.16);
  color: #2a5f8c;
}

:root.light-mode .secondary-btn {
  color: #244761;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 250, 0.96));
  border-color: rgba(31, 85, 121, 0.18);
  box-shadow: none;
}

:root.light-mode .plant-action-primary {
  background: linear-gradient(180deg, #4f88da, #3b72c3);
  border-color: rgba(48, 102, 177, 0.22);
  color: #ffffff;
}

:root.light-mode .plant-action-secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 251, 0.96));
  border-color: rgba(31, 85, 121, 0.16);
  color: #294d69;
}

:root.light-mode .plant-action-danger {
  background: linear-gradient(180deg, rgba(196, 67, 93, 0.92), rgba(175, 57, 82, 0.92));
  border-color: rgba(184, 57, 81, 0.26);
  color: #fff7f8;
}

:root.light-mode .plant-action-secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(252, 254, 255, 0.99), rgba(236, 244, 249, 0.98));
}

:root.light-mode .secondary-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(233, 241, 247, 0.98));
  box-shadow: 0 10px 22px rgba(31, 55, 77, 0.08);
}

:root.light-mode .web-link-btn.is-ready {
  color: #ffffff;
  border-color: rgba(67, 118, 166, 0.24);
  background: linear-gradient(120deg, #4a7fb3, #77a8d9);
}

:root.light-mode .web-link-btn:disabled {
  color: rgba(88, 112, 130, 0.7);
  border-color: rgba(88, 112, 130, 0.16);
  background: rgba(238, 244, 248, 0.92);
}

:root.light-mode .channel-btn.active {
  color: #ffffff;
  border-color: rgba(67, 118, 166, 0.24);
  box-shadow: 0 0 0 1px rgba(67, 118, 166, 0.12) inset;
}

:root.light-mode .channel-btn.channel-mail.active,
:root.light-mode .channel-btn[data-action="toggle-mail"].active {
  background: linear-gradient(120deg, #537fb2, #81a8d6);
}

:root.light-mode .channel-btn.channel-telegram.active,
:root.light-mode .channel-btn[data-action="toggle-telegram"].active {
  background: linear-gradient(120deg, #4b8ca8, #78b6ca);
}

:root.light-mode .danger-btn {
  color: #ffffff;
  border-color: rgba(184, 57, 81, 0.34);
  background: linear-gradient(120deg, #c4435d, #e56b82);
  box-shadow: 0 12px 26px rgba(164, 49, 72, 0.18);
}

:root.light-mode .danger-btn:hover:not(:disabled) {
  background: linear-gradient(120deg, #bc3954, #de6079);
  box-shadow: 0 16px 30px rgba(164, 49, 72, 0.22);
}

:root.light-mode .plant-item.active {
  background: linear-gradient(180deg, rgba(20, 128, 229, 0.16), rgba(255, 255, 255, 0.98));
  border-color: rgba(20, 128, 229, 0.24);
}

:root.light-mode input,
:root.light-mode select,
:root.light-mode textarea {
  background: #ffffff;
  color: var(--text-main);
  border-color: rgba(31, 85, 121, 0.18);
}

:root.light-mode .action-icon,
:root.light-mode .field-icon {
  background: rgba(20, 128, 229, 0.1);
  color: #0f5fb0;
}

:root.light-mode .empty-state-positive {
  background: var(--positive-bg);
}

:root.light-mode .empty-state-positive strong {
  color: var(--positive-text);
}

:root.light-mode .offline-item {
  background: linear-gradient(180deg, rgba(255, 239, 242, 0.95), rgba(255, 255, 255, 0.98));
  border-color: rgba(201, 76, 108, 0.18);
}

:root.light-mode .offline-legend {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(31, 85, 121, 0.14);
}

@keyframes networkPulse {
  0%,
  100% {
    opacity: 0.22;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@keyframes heartbeatLine {
  0%,
  18% {
    stroke-dashoffset: 280;
    opacity: 0.25;
  }
  28%,
  58% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: -280;
    opacity: 0.2;
  }
}

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

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .topbar-stats,
  .stats-grid,
  .cards-grid,
  .cards-grid-2,
  .settings-layout,
  .settings-guide-grid,
  .settings-split,
  .compact-form-grid,
  .network-layout {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }
}

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

  .content {
    padding: 0.85rem;
  }

  .sidebar {
    padding: 0.8rem 0.75rem;
  }

  .hero-panel,
  .section-head,
  .details-head,
  .topbar,
  .discovery-head,
  .script-panel-head,
  .hero-actions,
  .details-actions,
  .form-actions,
  .table-actions,
  .offline-item {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .topbar-stat-label {
    white-space: normal;
  }

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

  .hero-chart-card {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions-cards {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .hero-panel {
    align-items: stretch;
  }

  .plant-actions-row .plant-action-btn,
  .topbar-actions .nav-action-btn {
    width: 100%;
    justify-content: center;
  }

  .details-actions,
  .topbar-actions {
    width: 100%;
  }

  .devices-column,
  .users-section-list {
    overflow-x: visible;
  }

  .devices-column table,
  .users-table {
    min-width: 0;
    width: 100%;
  }

  .devices-column thead,
  .users-table thead {
    display: none;
  }

  .devices-column table,
  .devices-column tbody,
  .users-table,
  .users-table tbody {
    display: block;
  }

  .devices-column tr,
  .users-table tr {
    display: grid;
    gap: 0.6rem;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--chip-bg);
  }

  .devices-column td,
  .users-table td {
    display: grid;
    gap: 0.28rem;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .devices-column td::before,
  .users-table td::before {
    content: attr(data-label);
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .devices-column .notify-col-cell,
  .devices-column td[data-label="Web"] {
    justify-items: start;
  }

  .devices-column .table-actions,
  .users-table .user-row-actions {
    justify-content: flex-start;
  }

  .history-block {
    width: 100%;
  }

  .offline-meta {
    text-align: left;
    justify-items: start;
  }

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

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

  .users-admin-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .password-form-layout {
    grid-template-columns: 1fr;
  }

  .password-actions {
    min-width: 0;
  }

}
