/* ===== WC Mobitruck — dark green glow theme ===== */
:root {
  /* Тёмная тема (по умолчанию) */
  --bg-0: #050807;
  --bg-1: #080d0b;
  --bg-2: #0b1310;
  --bg-3: #101b16;
  --line: #1a2a23;
  --line-soft: rgba(60, 220, 140, 0.10);
  --text: #d6f6e2;
  --text-dim: #7fb59a;
  --text-muted: #4f7e6a;
  --accent: #25e08c;
  --accent-hot: #5dffb6;
  --accent-deep: #0a8a52;
  --danger: #ff5a7a;
  --warn: #ffc857;
  --surface:        #0d1411;   /* карточки, сайдбар  */
  --surface-soft:   #182520;   /* вложенные блоки (stat, tile, point) — светлее карточек */
  --surface-strong: #11181d;   /* dialog / login-card — чуть светлее карточек */
  --input-bg:       #050807;   /* поля ввода и заголовки таблиц — утоплены под фон */
  --input-bg-strong:#030504;
  --shadow-glow: 0 0 24px rgba(37, 224, 140, 0.35), 0 0 60px rgba(37, 224, 140, 0.18);
  --shadow-soft: 0 6px 24px rgba(0, 0, 0, 0.45);
  --rad-md: 14px;
  --rad-lg: 20px;
}

body.theme-light {
  --bg-0: #f4f6f5;
  --bg-1: #ffffff;
  --bg-2: #eef2f0;
  --bg-3: #e2eae5;
  --line: #d2dcd6;
  --line-soft: rgba(20, 130, 80, 0.15);
  --text: #0e1f17;
  --text-dim: #3f5f4f;
  --text-muted: #6f8e7c;
  --accent: #14a063;
  --accent-hot: #18b56f;
  --accent-deep: #0a6f44;
  --danger: #d33656;
  --warn: #b88305;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-soft: rgba(255, 255, 255, 0.65);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --input-bg: #ffffff;
  --input-bg-strong: #ffffff;
  --shadow-glow: 0 0 16px rgba(20, 160, 99, 0.18), 0 0 40px rgba(20, 160, 99, 0.10);
  --shadow-soft: 0 8px 24px rgba(20, 70, 50, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.app, body.login-body {
  background: var(--bg-0);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hot); }

code, .mono { font-family: ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace; font-size: 0.92em; }

/* очень мягкий ambient glow — почти незаметен */
.bg-glow {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(50vw 40vw at 75% 15%, rgba(37, 224, 140, 0.025), transparent 70%),
    radial-gradient(45vw 40vw at 15% 90%, rgba(37, 224, 140, 0.020), transparent 70%);
}

/* ===== Layout ===== */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 72px 1fr; }
  .nav-label, .brand-text, .sidebar-foot span:last-child { display: none; }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 4px 22px;
}
.brand-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 35% 35%, var(--accent-hot), var(--accent) 50%, var(--accent-deep) 100%);
  box-shadow: var(--shadow-glow);
  position: relative;
}
.brand-logo::after {
  content: ""; position: absolute; inset: 4px;
  border-radius: 7px;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.55), transparent 50%);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-weight: 800; letter-spacing: 0.04em; font-size: 14px; }
.brand-sub { color: var(--text-muted); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: all .18s ease;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(37, 224, 140, 0.06);
  border-color: var(--line-soft);
}
.nav-item.is-active {
  color: var(--accent-hot);
  background: linear-gradient(90deg, rgba(37, 224, 140, 0.12), rgba(37, 224, 140, 0.02));
  border-color: rgba(37, 224, 140, 0.35);
  box-shadow: inset 0 0 0 1px rgba(37, 224, 140, 0.08), 0 0 16px rgba(37, 224, 140, 0.18);
}
.nav-ico {
  width: 22px; height: 22px;
  background: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 22px 22px; mask-size: 22px 22px;
  flex: 0 0 22px;
}
.nav-ico[data-ico="dashboard"] {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='9'/><rect x='14' y='3' width='7' height='5'/><rect x='14' y='12' width='7' height='9'/><rect x='3' y='16' width='7' height='5'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='9'/><rect x='14' y='3' width='7' height='5'/><rect x='14' y='12' width='7' height='9'/><rect x='3' y='16' width='7' height='5'/></svg>");
}
.nav-ico[data-ico="map"] {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21'/><line x1='8' y1='3' x2='8' y2='18'/><line x1='16' y1='6' x2='16' y2='21'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21'/><line x1='8' y1='3' x2='8' y2='18'/><line x1='16' y1='6' x2='16' y2='21'/></svg>");
}
.nav-ico[data-ico="toilets"] {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='3' width='16' height='18' rx='2'/><circle cx='12' cy='9' r='1'/><line x1='12' y1='13' x2='12' y2='18'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='3' width='16' height='18' rx='2'/><circle cx='12' cy='9' r='1'/><line x1='12' y1='13' x2='12' y2='18'/></svg>");
}
.nav-ico[data-ico="settings"] {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3h.1a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8v.1a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3h.1a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8v.1a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/></svg>");
}

.sidebar-foot {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Theme toggle */
.theme-toggle {
  position: relative;
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color .2s ease;
  overflow: hidden;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: calc(50% - 3px); height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(37, 224, 140, 0.45);
  transition: transform .25s cubic-bezier(.4, .8, .3, 1);
}
body.theme-light .theme-toggle-thumb { transform: translateX(100%); }
.theme-toggle-lbl {
  position: relative; z-index: 1;
  flex: 1; text-align: center;
  transition: color .2s ease;
  font-weight: 600;
}
.theme-toggle-lbl-dark { color: #03130c; }
.theme-toggle-lbl-light { color: var(--text-dim); }
body.theme-light .theme-toggle-lbl-dark { color: var(--text-dim); }
body.theme-light .theme-toggle-lbl-light { color: #ffffff; }

@media (max-width: 880px) {
  .theme-toggle-lbl { display: none; }
  .theme-toggle { width: 44px; padding: 3px; }
  .theme-toggle-thumb { width: calc(50% - 3px); }
}

/* ===== Content ===== */
.content {
  padding: 22px 28px 60px;
  width: 100%;
  min-width: 0;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0 18px;
}
.page-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.user-box { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-dim); font-size: 14px; }

.inline { display: inline; }

/* ===== Buttons ===== */
.btn {
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  background: var(--surface-soft);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  transition: background-color .15s ease, border-color .2s ease, box-shadow .2s ease, color .15s ease, transform .15s ease;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow:
    0 0 10px rgba(37, 224, 140, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft));
  box-shadow:
    0 0 20px rgba(37, 224, 140, 0.30),
    0 0 40px rgba(37, 224, 140, 0.10);
}
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: 0 0 8px rgba(37, 224, 140, 0.08);
}
.btn-ghost:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(37, 224, 140, 0.25);
}

.btn-primary {
  border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 35%, transparent), color-mix(in srgb, var(--accent-deep) 50%, transparent));
  color: #ecffef;
  box-shadow:
    0 0 18px rgba(37, 224, 140, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.btn-primary:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-deep) 60%, transparent));
  box-shadow:
    0 0 28px rgba(37, 224, 140, 0.55),
    0 0 60px rgba(37, 224, 140, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-danger-ghost {
  background: var(--surface-soft);
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
  color: var(--danger);
  box-shadow: 0 0 8px rgba(255, 90, 122, 0.12);
}
.btn-danger-ghost:hover {
  color: #ffaab9;
  border-color: var(--danger);
  box-shadow: 0 0 22px rgba(255, 90, 122, 0.35);
}

/* Светлая тема — приглушаем фон кнопок чтобы glow читался на белом */
body.theme-light .btn {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow:
    0 0 10px rgba(20, 160, 99, 0.10),
    0 1px 2px rgba(20, 70, 50, 0.05);
}
body.theme-light .btn:hover {
  background: color-mix(in srgb, var(--accent) 7%, #ffffff);
  box-shadow:
    0 0 18px rgba(20, 160, 99, 0.25),
    0 0 38px rgba(20, 160, 99, 0.10);
}
body.theme-light .btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #ffffff;
  border-color: var(--accent-deep);
  box-shadow:
    0 0 18px rgba(20, 160, 99, 0.40),
    inset 0 1px 0 rgba(255,255,255,0.30);
}
body.theme-light .btn-primary:hover {
  box-shadow:
    0 0 28px rgba(20, 160, 99, 0.60),
    0 0 58px rgba(20, 160, 99, 0.20),
    inset 0 1px 0 rgba(255,255,255,0.40);
}
body.theme-light .btn-ghost { background: #ffffff; }
body.theme-light .btn-danger-ghost { background: #ffffff; }

/* ===== Cards ===== */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--rad-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.card-flat { padding: 0; overflow: hidden; }
.card-flat .card-head { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 17px; letter-spacing: 0.02em; }
.head-actions { display: inline-flex; gap: 8px; align-items: center; }

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }

/* ===== Stats ===== */
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
  flex: 1 1 160px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--rad-md);
  padding: 16px 18px;
}
.stat-num { font-size: 32px; font-weight: 700; letter-spacing: 0.02em; }
.stat-lbl { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.2em; }
.stat.is-on { border-color: rgba(37, 224, 140, 0.35); box-shadow: 0 0 18px rgba(37, 224, 140, 0.1); }
.stat.is-on .stat-num { color: var(--accent-hot); }
.stat.is-off { border-color: rgba(255, 90, 122, 0.3); }
.stat.is-off .stat-num { color: var(--danger); }

/* ===== Grids ===== */
.grid { display: grid; gap: 14px; }
.grid-tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-points { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid-inputs { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* ===== Tile (toilet card) ===== */
.tile {
  border: 1px solid var(--line);
  border-radius: var(--rad-md);
  padding: 14px 16px;
  background: var(--surface-soft);
  display: block;
  position: relative;
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 224, 140, 0.45);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 24px rgba(37, 224, 140, 0.18);
}
.tile-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.tile-status {
  flex: 0 0 12px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #555;
}
.tile-status.is-on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.tile-status.is-off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.tile-name { font-weight: 700; font-size: 16px; }
.tile-sub { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 12px; }
.tile-foot { color: var(--text-dim); margin-top: 10px; font-size: 13px; }

/* ===== Point cards (relays/inputs) ===== */
.point {
  border: 1px solid var(--line);
  border-radius: var(--rad-md);
  background: var(--surface-soft);
  padding: 12px 14px;
  position: relative;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.point.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(37, 224, 140, 0.14);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.point-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.point-num { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-muted); letter-spacing: 0.1em; }
.point-led {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2a3b34;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
}
.point.is-on .point-led {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
  animation: ledBlink 1.6s ease-in-out infinite;
}
@keyframes ledBlink { 0%,100% { opacity: 1 } 50% { opacity: 0.55 } }
.point-label { font-weight: 600; cursor: pointer; min-height: 22px; }
.point-label:hover { color: var(--accent-hot); }
.point-type { font-size: 12px; margin-top: 2px; }
.btn-toggle {
  margin-top: 10px;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  background: var(--input-bg);
  color: var(--text);
  padding: 8px 0;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .2s ease, color .15s ease, box-shadow .2s ease;
  box-shadow: 0 0 8px rgba(37, 224, 140, 0.10);
}
.btn-toggle:hover {
  color: var(--accent-hot);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(37, 224, 140, 0.30);
}
.point.is-on .btn-toggle {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-hot);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(37, 224, 140, 0.35);
}
.point.is-on .btn-toggle:hover { box-shadow: 0 0 22px rgba(37, 224, 140, 0.50); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--rad-md); border: 1px solid var(--line); }
.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.t th { background: var(--input-bg); color: var(--text-dim); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; }
.t tr:last-child td { border-bottom: none; }
.t tr:hover td { background: rgba(37, 224, 140, 0.04); }
/* Узкая, центрированная колонка-индикатор */
.t th:first-child, .t td:first-child { text-align: center; width: 84px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Последняя колонка таблицы — действия — прижаты к правому краю */
.t th:last-child, .t td:last-child { text-align: right; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #555; }
.dot.is-on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot.is-off { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.badge-on { background: rgba(37, 224, 140, 0.14); color: var(--accent-hot); border: 1px solid rgba(37,224,140,0.4); }
.badge-off { background: rgba(255, 90, 122, 0.12); color: #ffaab9; border: 1px solid rgba(255, 90, 122, 0.3); }
.badge-input { background: rgba(80,180,255,0.1); color: #9cd3ff; border: 1px solid rgba(80,180,255,0.3); }
.badge-relay { background: rgba(255,200,87,0.1); color: var(--warn); border: 1px solid rgba(255,200,87,0.3); }

.empty {
  padding: 32px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--line); border-radius: var(--rad-md);
}

/* ===== Login ===== */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 20px;
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  padding: 32px 28px 28px;
  background: var(--surface-strong);
  border: 1px solid rgba(37, 224, 140, 0.2);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 40px rgba(37,224,140,0.10);
  text-align: center;
  animation: cardIn .55s ease both;
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(12px) scale(.98) }
  100% { opacity: 1; transform: translateY(0) scale(1) }
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 35% 30%, var(--accent-hot), var(--accent) 50%, var(--accent-deep) 100%);
  box-shadow: 0 0 30px rgba(37,224,140,0.45), 0 0 80px rgba(37,224,140,0.2);
  position: relative;
}
.login-logo::after {
  content: ""; position: absolute; inset: 8px;
  border-radius: 12px;
  background: radial-gradient(circle at 40% 25%, rgba(255,255,255,0.6), transparent 55%);
}
.login-title { margin: 6px 0 4px; font-size: 22px; letter-spacing: 0.08em; }
.login-sub { margin: 0 0 22px; color: var(--text-muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.login-form input,
.dlg input, .dlg textarea, .dlg select {
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  outline: none;
  transition: all .15s ease;
}
.login-form input:focus,
.dlg input:focus, .dlg textarea:focus, .dlg select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,224,140,0.15);
}
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.alert-err { background: rgba(255,90,122,0.1); border: 1px solid rgba(255,90,122,0.4); color: #ffaab9; }

/* ===== Dialogs ===== */
.dlg {
  border: 1px solid var(--line);
  border-radius: var(--rad-lg);
  padding: 0;
  background: var(--surface-strong);
  color: var(--text);
  width: min(520px, calc(100% - 32px));
  box-shadow: 0 24px 80px rgba(0,0,0,0.45), 0 0 30px rgba(37,224,140,0.10);
}
.dlg::backdrop { background: rgba(0,8,4,0.55); backdrop-filter: blur(4px); }
body.theme-light .dlg::backdrop { background: rgba(20, 50, 40, 0.35); }
body.theme-light .leaflet-container { background: #e8edea !important; }
body.theme-light .leaflet-control-attribution { background: rgba(255,255,255,0.85) !important; }
body.theme-light .leaflet-bar a { background: #ffffff !important; color: var(--text) !important; }
.dlg form { padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0 0 4px; font-size: 18px; }
.dlg label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.hint { color: var(--text-muted); font-size: 12px; }

/* ===== Map ===== */
.map { height: calc(100vh - 220px); min-height: 480px; border-radius: 0 0 var(--rad-lg) var(--rad-lg); }
.leaflet-container { background: #0a0d0c !important; }
.leaflet-control-attribution { background: rgba(8, 12, 10, 0.7) !important; color: var(--text-muted) !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-bar a { background: #0e1612 !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: #14201a !important; color: var(--accent) !important; }

.addr-row { display: flex; gap: 8px; }
.addr-row input { flex: 1; }
.mini-map { height: 220px; border-radius: 10px; border: 1px solid var(--line); margin-top: 6px; }
.geo-ok { color: var(--accent); }
.geo-err { color: var(--danger); }

.info-rows { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); }
.info-k { color: var(--text-muted); }
.info-v { font-weight: 600; }
.link { color: var(--accent); }
