:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --line: #334155;
  --border: #334155;
  --bg2: #0b1220;
  --accent: #38bdf8;
  --brand: #ed1a3b;
  --page-x: 32px;
  --page-y: 24px;
  --dw-spark-h: 138px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--page-x);
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-top {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--line);
}
header strong { font-size: 18px; }
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex: 1 1 520px;
}
nav .tab, .btn {
  background: #334155;
  color: var(--text);
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}
nav .tab.active {
  background: #0ea5e9;
  color: #0f172a;
  font-weight: 600;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dash-sum {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}
.dash-sum-item {
  background: var(--panel, #111827);
  border: 1px solid var(--line, #1e293b);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.dash-sum-item:active {
  transform: scale(0.98);
}
.dash-sum-item.is-active {
  border-color: var(--accent, #38bdf8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}
.dash-sum-on.is-active {
  border-color: var(--ok, #22c55e);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}
.dash-sum-off.is-active {
  border-color: var(--danger, #f87171);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.dash-sum-n {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text, #e2e8f0);
}
.dash-sum-l {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted, #94a3b8);
  line-height: 1.25;
}
.dash-sum-on .dash-sum-n { color: var(--ok, #22c55e); }
.dash-sum-off .dash-sum-n { color: var(--danger, #f87171); }
.dash-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}
.dash-groups-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}
.dash-groups-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line, #1e293b);
  background: var(--panel, #111827);
  color: inherit;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.dash-group-chip:active { transform: scale(0.98); }
.dash-group-chip.is-active {
  border-color: var(--accent, #38bdf8);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.28);
}
.dash-group-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}
.dash-group-chip-n {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  min-width: 1.1em;
  text-align: center;
}
.dash-group-chip.is-active .dash-group-chip-n { color: var(--accent, #38bdf8); }
.dash-group-add {
  border-style: dashed;
  color: var(--muted, #94a3b8);
}
.dash-group-add:hover {
  color: inherit;
  border-color: var(--accent, #38bdf8);
}
html.is-app .dash-groups,
html.is-mobile-chrome .dash-groups { margin-bottom: 10px; }
html.is-app .dash-group-chip,
html.is-mobile-chrome .dash-group-chip {
  padding: 8px 12px;
  min-height: 36px;
  font-size: 13px;
}
html.is-app .dash-sum {
  margin: 0 0 10px;
  gap: 6px;
}
html.is-app .dash-sum-item {
  padding: 8px 6px;
  border-radius: 10px;
}
html.is-app .dash-sum-n { font-size: 20px; }
html.is-app .dash-sum-l { font-size: 10px; }

.home-page .page-head { margin-bottom: 8px; }
.home-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin: 8px 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(1200px 200px at 10% -40%, rgba(56, 189, 248, 0.18), transparent 60%),
    linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.home-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #0f172a;
  background: linear-gradient(145deg, #7dd3fc, #38bdf8);
  flex-shrink: 0;
}
.home-user-main { flex: 1; min-width: 0; }
.home-user-name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.home-user-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.home-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.55);
}
.home-pill.is-ok { border-color: rgba(34, 197, 94, 0.45); color: var(--ok); }
.home-pill.is-bad { border-color: rgba(239, 68, 68, 0.45); color: var(--bad); }
.home-user-line { line-height: 1.4; }
.home-user-fleet { text-align: right; flex-shrink: 0; }
.home-fleet-pct { font-size: 34px; font-weight: 800; line-height: 1; }
.home-period {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.home-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  min-width: 0;
}
.home-card h3 { margin: 0 0 4px; font-size: 15px; }
.home-card-note { margin: 0 0 12px; }
.home-card-wide { grid-column: 1 / -1; }
.home-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.home-donut { flex-shrink: 0; }
.home-donut-val {
  fill: var(--text);
  font-size: 22px;
  font-weight: 700;
  font-family: inherit;
}
.home-donut-sub {
  fill: var(--muted);
  font-size: 11px;
  font-family: inherit;
}
.home-legend { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.home-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.home-dot { width: 10px; height: 10px; border-radius: 50%; }
.home-bars { display: block; overflow: visible; }
.home-bar-label, .home-bar-val, .home-axis {
  fill: var(--muted);
  font-size: 11px;
  font-family: inherit;
}
.home-bar-val { fill: var(--text); }
.home-grid-line {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}
.home-area-wrap {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: stretch;
  min-height: 200px;
}
.home-area-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0 22px;
  text-align: right;
}
.home-area-y-lab {
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.home-area-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}
.home-area-plot {
  position: relative;
  height: 180px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  overflow: hidden;
}
.home-area {
  display: block;
  width: 100%;
  height: 100%;
}
.home-area-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.home-area-mark {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
  pointer-events: auto;
  cursor: default;
}
.home-area-x {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  min-height: 18px;
  padding: 0 2px;
}
.home-area-x-lab {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.home-area-x-lab.is-hide {
  visibility: hidden;
  pointer-events: none;
}
.home-legend-item.home-tip-hit,
.home-bar-row.home-tip-hit,
.home-area-mark.home-tip-hit,
.home-area-x-lab.home-tip-hit {
  cursor: pointer;
}
.home-legend-item.home-tip-hit:hover,
.home-bar-row.home-tip-hit:hover {
  background: rgba(56, 189, 248, 0.08);
  border-radius: 8px;
}
.home-donut-arc:hover {
  filter: brightness(1.15);
}
.home-bars-html {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
}
.home-bar-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-bar-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.65);
  overflow: hidden;
}
.home-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}
.home-bar-num {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted);
}
.home-tip {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 16px));
  max-height: min(70vh, 420px);
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background:
    radial-gradient(420px 120px at 0% 0%, color-mix(in srgb, var(--tip-c, #38bdf8) 22%, transparent), transparent 70%),
    linear-gradient(180deg, #111827 0%, #0b1220 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.4);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  pointer-events: auto;
  overflow: hidden;
}
.home-tip[hidden] {
  display: none !important;
}
.home-tip-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
  flex: 0 0 auto;
}
.home-tip-badge {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--tip-c, #38bdf8);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tip-c, #38bdf8) 22%, transparent);
  flex-shrink: 0;
}
.home-tip-head-text { min-width: 0; flex: 1; }
.home-tip-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0;
}
.home-tip-meta {
  margin: 3px 0 0;
  font-size: 12px;
}
.home-tip-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 8px;
  -webkit-overflow-scrolling: touch;
}
.home-tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.home-tip-section {
  margin: 8px 6px 4px;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  border: 0;
}
.home-tip-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  border-radius: 10px;
  border: 0;
}
.home-tip-row:hover {
  background: rgba(56, 189, 248, 0.08);
}
.home-tip-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #64748b;
}
.home-tip-row.is-ok .home-tip-dot { background: #22c55e; }
.home-tip-row.is-warn .home-tip-dot { background: #f59e0b; }
.home-tip-row.is-bad .home-tip-dot { background: #ef4444; }
.home-tip-row-main { min-width: 0; }
.home-tip-row-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-tip-row-sub {
  font-size: 11px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-tip-row-val {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  padding-top: 1px;
}
.home-tip-empty {
  padding: 16px 8px;
  text-align: center;
}
.home-tip-foot {
  flex: 0 0 auto;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(51, 65, 85, 0.7);
  font-size: 11px;
}
.home-area-mark.home-tip-hit:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-user-card { flex-wrap: wrap; }
  .home-user-fleet { text-align: left; width: 100%; }
  .home-area-plot { height: 150px; }
  .home-area-wrap { grid-template-columns: 34px minmax(0, 1fr); }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.kpi, .card, .tile {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--line);
}
.kpi, .tile { cursor: pointer; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 700; margin: 6px 0; }
.tile h3 { margin: 0 0 8px; font-size: 15px; }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tile-head h3 { margin: 0; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.chip {
  background: #1e293b;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}
.value { font-size: 32px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.status-ok { color: var(--ok); }
.status-bad { color: var(--bad); }
.status-warn { color: var(--warn); }
.login {
  position: relative;
  max-width: 380px;
  margin: 12vh auto;
  background: var(--card);
  padding: 28px 24px 24px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(237, 26, 59, 0.08),
    0 18px 40px rgba(2, 6, 23, 0.35);
}
.login::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 8%, var(--brand) 50%, transparent 92%);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}
.login-logo {
  height: 38px;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 16px rgba(237, 26, 59, 0.38));
}
.login-product {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.login h2 {
  margin: 0 0 16px;
  text-align: center;
  font-size: 22px;
  font-weight: 650;
}
.login-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 4px 0 0;
}
.login-actions .btn,
.login-actions #do-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.login-side {
  display: flex;
  justify-content: center;
  margin: 14px 0 0;
  padding: 0;
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}
.login-remember input {
  width: 18px;
  height: 18px;
  accent-color: #0ea5e9;
}
.login-accounts {
  margin: 0 0 16px;
}
.login-accounts-title {
  margin: 0 0 8px;
  font-size: 12px;
}
.login-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-account-chip {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  width: 100%;
  text-align: left;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.login-account-chip:active {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.08);
}
.login-account-name {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  font-size: 14px;
}
.login-account-login {
  grid-column: 1;
  grid-row: 2;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.login-account-remove {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.login-account-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.login-apk {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--muted, #94a3b8);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: center;
  cursor: pointer;
}
.login-apk:hover {
  color: var(--accent, #38bdf8);
  background: none;
  border: 0;
}
.login-ios-hint {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--muted, #94a3b8);
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
}
.login-ios-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
}
input, select {
  width: 100%;
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}
.toolbar label { min-width: 180px; }
.dev-search-bar { align-items: center; }
.dash-search-bar { margin-bottom: 12px; gap: 8px 16px; }
.dev-search-wrap { flex: 1 1 280px; max-width: 520px; min-width: 220px; }
.dev-search-wrap input[type="search"] {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
}
.dev-search-wrap input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.al-toolbar { gap: 10px; }
.al-en-toggle { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.dash-toggle.yn-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.dash-toggle.yn-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}
.table-wrap { overflow-x: auto; }
.alarm-report-table { min-width: 960px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th:first-child, td:first-child { padding-left: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  justify-content: flex-end;
}
.page-head-actions .import-bar { margin: 0; }
.create-menu-wrap { position: relative; }
.create-menu-wrap .caret { opacity: 0.85; font-size: 12px; margin-left: 2px; }
.create-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 300px;
  max-width: min(420px, 92vw);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.create-drop-item {
  width: 100%;
  justify-content: center;
  text-align: center;
}
.create-drop-sep {
  height: 1px;
  margin: 10px 0;
  background: var(--line);
}
.create-drop-title { margin: 0 0 8px; font-size: 13px; }
.import-bar-menu {
  padding: 0;
  border: none;
  background: transparent;
}
.import-bar-menu .import-hint .hint { max-width: none; }
.sensors-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  margin-bottom: 10px;
}
.import-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
}
.import-bar-label { font-size: 13px; white-space: nowrap; }
.import-file-btn { cursor: pointer; margin: 0; }
.import-hint { font-size: 12px; }
.import-hint summary { cursor: pointer; color: var(--muted); list-style: none; }
.import-hint summary::-webkit-details-marker { display: none; }
.import-hint .hint { margin: 6px 0 0; max-width: 420px; font-size: 12px; }
.import-result {
  flex: 1 1 100%;
  font-size: 13px;
  line-height: 1.45;
}
.import-result:not([hidden]) { display: block; }
.import-summary.ok strong { color: var(--ok); }
.import-details { font-size: 12px; margin: 4px 0 0; }
.import-log-preview {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: #1e293b;
  border-radius: 6px;
  font-size: 11px;
  max-height: 110px;
  overflow: auto;
  white-space: pre-wrap;
}
.page-head h1 { margin: 0; }
.btn.primary { background: #0ea5e9; color: #0f172a; font-weight: 600; }
.btn-sm { padding: 6px 10px; font-size: 13px; vertical-align: middle; }
.bs-name { display: flex; align-items: center; gap: 10px; }
.bs-icon { width: 28px; height: 36px; flex-shrink: 0; display: block; }
.bs-icon .led { fill: #22c55e; }
.bs-icon.offline .led { fill: #ef4444; }
.model-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.model-icon-lg { width: 48px; height: 48px; }
.model-icon-inline { display: inline-flex; align-items: center; min-height: 32px; margin: 6px 0; }
.with-icon { display: flex; align-items: center; gap: 12px; }
h1.with-icon { margin: 0 0 8px; }
.page-head h1.with-icon { margin: 0; }
.tile-head { align-items: center; }
.tile-head .model-icon { width: 36px; height: 36px; }
.gw-chart-head .model-icon { width: 40px; height: 40px; }
.uptime-svg { width: 100%; height: 22px; display: block; border-radius: 6px; background: #0f172a; }
.uptime-svg.compact { height: 14px; border-radius: 4px; min-width: 140px; }
.uptime-chart { width: 100%; min-width: 0; }
.uptime-chart.compact { flex: 1 1 auto; }
.uptime-axis {
  position: relative;
  height: 15px;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  user-select: none;
}
.uptime-axis-days {
  height: 18px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}
.uptime-chart.multi-day .uptime-svg {
  border-radius: 4px;
}
.uptime-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  pointer-events: none;
}
.uptime-axis-days .uptime-tick i {
  height: 5px;
  background: #94a3b8;
}
.uptime-tick.align-start { transform: translateX(0); align-items: flex-start; }
.uptime-tick.align-end { transform: translateX(-100%); align-items: flex-end; }
.uptime-tick i {
  display: block;
  width: 1px;
  height: 4px;
  background: #64748b;
}
.uptime-tick em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.uptime-legend { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.uptime-legend-inline { margin: 0; align-items: center; font-size: 12px; gap: 10px; }
.gw-toolbar { align-items: center; }
.gw-list-hint { margin: -4px 0 12px; }
.page.gw-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 58px);
  max-height: calc(100dvh - 58px);
  padding-top: 12px;
  padding-bottom: 12px;
  overflow: hidden;
  box-sizing: border-box;
}
.gw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.gw-head h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}
.gw-head-tools {
  display: flex;
  align-items: center;
  gap: 12px 14px;
  flex-wrap: wrap;
}
.gw-period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  min-width: 0 !important;
}
.gw-period select {
  margin: 0;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
}
.gw-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.gw-table { min-width: 720px; width: 100%; margin: 0; table-layout: fixed; border-collapse: collapse; }
.gw-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1e293b;
  box-shadow: 0 1px 0 var(--line);
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  text-align: left;
}
.gw-table td, .gw-table th { padding: 8px 10px; vertical-align: middle; }
.gw-table tbody tr { border-top: 1px solid rgba(51, 65, 85, 0.55); }
.gw-table tbody tr:hover { background: rgba(15, 23, 42, 0.45); }
.gw-table .gw-col-name { width: 22%; }
.gw-table .gw-col-status { width: 7%; }
.gw-table .gw-col-seen { width: 8%; }
.gw-table .gw-col-uptime { width: 57%; }
.gw-table .gw-col-actions { width: 6%; }
.gw-name-cell { width: 22%; min-width: 140px; }
.gw-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gw-id .bs-name { min-width: 0; }
.gw-id .bs-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16em;
  display: inline-block;
  vertical-align: middle;
}
.gw-id-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-left: 32px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}
.gw-id-model { flex: 0 0 auto; color: #94a3b8; }
.gw-id-eui {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  opacity: 0.9;
}
.gw-status-cell { width: 7%; padding-left: 4px !important; padding-right: 4px !important; }
.gw-st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
.gw-st::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.gw-st-on { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.gw-st-off { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }
.gw-st-repl { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
.gw-seen-cell {
  width: 8%;
  white-space: nowrap;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
}
.gw-uptime-cell { width: 57%; min-width: 320px; max-width: none; }
.gw-table td.actions {
  width: 6%;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 6px;
}
.gw-table td.actions .icon-btn { width: 30px; height: 30px; padding: 0; }
.gw-uptime-wrap {
  position: relative;
  display: block;
  cursor: default;
  outline: none;
}
.gw-uptime-main { display: flex; align-items: center; gap: 10px; }
.gw-uptime-wrap .uptime-svg { width: 100%; }
.gw-uptime-hint {
  flex: 0 0 auto;
  min-width: 40px;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.gw-uptime-hint b { font-weight: 700; }
.gw-uptime-hint small {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
}
.gw-uptime-hint.gw-uptime-ok { color: #86efac; }
.gw-uptime-hint.gw-uptime-bad { color: #fca5a5; }
.gw-uptime-pop { display: none !important; }
.gw-uptime-float {
  position: fixed;
  z-index: 1200;
  min-width: 200px;
  max-width: min(320px, 92vw);
  max-height: min(240px, 50vh);
  overflow: auto;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}
.gw-uptime-pop-head,
.gw-uptime-float .gw-uptime-pop-head {
  font-weight: 600;
  margin-bottom: 6px;
  color: #e2e8f0;
}
.gw-outage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gw-outage-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.gw-outage-range { color: #cbd5e1; }
.gw-outage-dur { color: #fca5a5; font-weight: 600; white-space: nowrap; }
.gw-uptime-pop-more { margin: 6px 0 0; font-size: 11px; }
.gw-table .bs-name .bs-icon,
.gw-table .bs-name .model-icon { width: 24px; height: 24px; }
.gw-table .bs-name { gap: 8px; font-size: 14px; }
.uptime-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}
.uptime-legend .dot.on { background: #22c55e; }
.uptime-legend .dot.off { background: #ef4444; }
.uptime-legend .dot.unk { background: #475569; }
.tab-badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  vertical-align: 1px;
}
.link-obj {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.link-obj:hover { color: var(--accent); }
.al-count { font-variant-numeric: tabular-nums; font-weight: 600; }
#al-err { color: var(--bad); }
.icon-btn {
  background: #334155;
  color: var(--text);
  border: 0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  margin-right: 4px;
}
.icon-btn:hover { background: #475569; }
.actions { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.form-card { max-width: 560px; }
.form-card.wide { max-width: 980px; }
.form-card.wide.remote-form { max-width: none; }
.remote-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(280px, 0.95fr);
  gap: 20px 24px;
  align-items: start;
}
.remote-right { position: sticky; top: 12px; }
.remote-notes { font-size: 12px; line-height: 1.4; margin: 0 0 12px; }
.remote-fields { display: flex; flex-direction: column; gap: 8px; }
.remote-field { margin: 0; }
.remote-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0;
}
.remote-row span { font-size: 13px; }
.remote-row input, .remote-row select { margin: 0; width: 100%; padding: 7px 8px; }
.reported {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0 0;
  padding-left: calc(140px + 8px);
}
.reported.from-dev { color: var(--ok); }
.rep-time { color: var(--muted); margin-left: 8px; font-size: 11px; }
.remote-status-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  background: #0f172a;
}
.remote-status-box h3, .remote-log-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.remote-status-box p { margin: 6px 0 0; }
.remote-meta { width: 100%; border-collapse: collapse; }
.remote-meta th, .remote-meta td {
  border: 0;
  padding: 3px 8px 3px 0;
  font-size: 13px;
}
.remote-meta th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  width: 88px;
  vertical-align: top;
}
.page table.remote-log th, .page table.remote-log td { padding: 6px 8px; }
.remote-log-wrap { max-height: 360px; overflow: auto; }
.page table.remote-log { min-width: 0; font-size: 12px; }
.page table.remote-log td:last-child {
  max-width: 320px;
  white-space: normal;
  overflow: visible;
}
@media (max-width: 900px) {
  .remote-layout { grid-template-columns: 1fr; }
  .remote-right { position: static; }
  .reported { padding-left: 0; }
}
.sec {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px 6px;
  margin: 0 0 16px;
}
.sec.remote-sec { padding: 8px 12px 10px; margin: 0 0 12px; }
.sec legend, .sec-title {
  font-size: 14px;
  font-weight: 600;
  padding: 0 6px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}
.subnav .tab {
  padding: 6px 12px;
  font-size: 13px;
  background: #334155;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
}
.subnav .tab.active {
  background: #0ea5e9;
  color: #0f172a;
  font-weight: 600;
}
.kind-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #334155;
  color: var(--muted);
}
.kind-batt, .kind-temp, .kind-board { color: inherit; }
.kind-board { color: #94a3b8; }
.board-ico, .batt-type-ico { display: block; flex-shrink: 0; }
.batt-text, .temp-text { gap: 0; }
.batt-compact .batt-pct, .temp-compact .temp-val { font-weight: 700; }
.sensor-card .value .batt-text .batt-pct,
.sensor-card .value .temp-text .temp-val {
  font-size: inherit;
  font-weight: 700;
}
.batt, .temp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.batt-ico, .temp-ico { display: block; flex-shrink: 0; }
.batt-pct, .temp-val { font-weight: 700; }
.kpi-label { display: inline-flex; align-items: center; gap: 6px; }
.batt-kpi { display: flex; align-items: center; gap: 10px; }
.pkt-sum .batt, .pkt-sum .temp { font-size: 13px; }
.tile-head h3 { display: inline-flex; align-items: center; gap: 6px; }
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.sensor-card .value {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.sensor-card .value .batt,
.sensor-card .value .temp {
  font-size: inherit;
  gap: 12px;
  width: 100%;
}
.sensor-card .batt-pct,
.sensor-card .temp-val {
  font-size: inherit;
  font-weight: 700;
}
.sensor-card .batt-ico { width: 48px; height: 24px; }
.sensor-card .temp-ico { width: 22px; height: 44px; }
.pkt-hex { font-family: ui-monospace, Consolas, monospace; font-size: 11px; word-break: break-all; }
.pkt-detail td { background: #0b1220; }
.chart-svg { width: 100%; height: 380px; min-height: 380px; display: block; background: #0f172a; border-radius: 8px; cursor: crosshair; }
.chart-stage.is-grab,
.chart-stage.is-grab .chart-svg { cursor: grab; }
.chart-stage.is-panning,
.chart-stage.is-panning .chart-svg { cursor: grabbing; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chart-legend label,
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.chart-legend label:hover,
.chart-legend-item:hover { background: #0b1220; border-color: var(--line); }
.chart-legend input,
.chart-legend-item input { width: 16px; height: 16px; margin: 0; cursor: pointer; flex-shrink: 0; }
.chart-legend-dot { flex-shrink: 0; }
.chart-legend-group { margin: 8px 0 12px; }
.chart-legend-group strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chart-active-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}
.chart-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 13px;
  background: #0b1220;
  color: var(--text);
  cursor: pointer;
}
.chart-chip:hover { background: #111827; }
.chart-chip-x { font-size: 16px; line-height: 1; color: var(--muted); }
.chart-chip:hover .chart-chip-x { color: #ef4444; }
.chart-loading { opacity: 0.65; pointer-events: none; }
.chart-sel-overlay {
  position: absolute;
  pointer-events: none;
  background: rgba(56, 189, 248, 0.12);
  border: 1px dashed #38bdf8;
  border-radius: 2px;
  z-index: 1;
}
.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 8px 0 14px;
}
.chart-toolbar label { min-width: auto; }
.chart-toolbar input[type="datetime-local"] {
  width: auto;
  min-width: 210px;
  margin: 4px 0 0;
}
.chart-stage { position: relative; user-select: none; }
.chart-tip {
  position: absolute;
  z-index: 2;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  pointer-events: none;
  max-width: 460px;
  line-height: 1.45;
}
.chart-tip-time { color: var(--muted); margin-bottom: 6px; font-size: 12px; }
.chart-tip-row { font-weight: 600; white-space: nowrap; }
.chart-tip-delta { white-space: normal; }
.chart-delta { margin-top: 12px; }
.chart-delta td, .chart-delta th { font-size: 13px; }
.packets-bar, .chart-data-bar {
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.packets-bar #packets-count,
.chart-data-bar #chart-data-count { margin: 0; }
.chart-data-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
}
.chart-data-table { margin: 0; }
.chart-data-table th {
  position: sticky;
  top: 0;
  background: #0b1220;
  z-index: 1;
}
.chart-data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dev-table { min-width: 980px; }
.al-table { min-width: 920px; }
.dev-table .dev-eui { font-size: 12px; color: var(--text); white-space: nowrap; }
.lw-id { margin: 0 0 12px; font-size: 14px; color: var(--text); }
.dev-table .th-sort,
.al-table .th-sort {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.dev-table .th-sort:hover,
.dev-table .th-sort.active,
.al-table .th-sort:hover,
.al-table .th-sort.active { color: var(--accent); }
.dev-row { cursor: pointer; }
.dev-row.dev-open { background: #1e293b; }
.dev-chevron {
  display: inline-block;
  width: 1em;
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}
.dev-sensors td {
  background: #0b1220;
  padding: 8px 12px 10px;
}
.dev-sensors .sensor-compact-list { margin: 0; }
.sensor-compact-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  margin: 6px 0 2px;
}
.sensor-plank {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: 7px 10px 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #152238 0%, #0f172a 100%);
  border: 1px solid #243044;
  border-left: 3px solid #3b82f6;
  min-width: 0;
  min-height: 56px;
}
.sensor-plank-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  margin-bottom: 0;
  min-height: 18px;
  height: 18px;
}
.sensor-plank-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sensor-plank-meta .kind-badge {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 0 6px;
  line-height: 16px;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sensor-plank-val {
  flex: 0 0 auto;
  min-height: 22px;
  font-size: 16px;
  font-weight: 800;
  line-height: 22px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sensor-plank-val .batt-pct,
.sensor-plank-val .temp-val,
.sensor-plank-val .val-colored {
  font-weight: 800;
}
.sensor-plank-chain {
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 520px) {
  .sensor-compact-list { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
}
.page table.dev-nested { min-width: 0; margin: 0; }
.click-name { cursor: pointer; display: inline-flex; align-items: center; }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.lw-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px 4px;
  margin: 8px 0 12px;
}
.lw-box legend { padding: 0 6px; font-size: 13px; }
.abp-only[hidden], .otaa-only[hidden] { display: none; }
.form-card textarea {
  width: 100%;
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  font-family: inherit;
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
#gw-err, #dev-err { color: var(--bad); }
.page {
  overflow-x: auto;
  padding: var(--page-y) var(--page-x) 40px;
}
.page h1 { margin: 0 0 12px; font-size: 22px; }
.page table { min-width: 720px; }
.page table.dev-table { min-width: 920px; }
.page table.ch-table { min-width: 480px; }
.page table.gw-nested { min-width: 0; }
.gw-rx-detail td {
  background: #0b1220;
  padding: 12px 14px 16px;
}
.gw-rx-summary {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 0.92em;
  line-height: 1.45;
}
.air-device-cell { min-width: 240px; line-height: 1.4; }
.air-device-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.air-device-title strong { font-size: 1.02em; }
.air-device-model { font-size: 0.9em; }
.air-device-ids { margin-top: 3px; font-size: 0.86em; color: #94a3b8; }
.air-device-note { margin-top: 5px; font-size: 0.82em; max-width: 420px; line-height: 1.35; }
.air-reg-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.76em;
  font-weight: 600;
  white-space: nowrap;
}
.air-reg-badge.status-ok { background: #14532d; color: #86efac; }
.air-reg-badge.status-warn { background: #422006; color: #fcd34d; }
.warn-text { color: var(--warn); }
.air-reg-badge.muted { background: #1e293b; color: #94a3b8; }
.gw-stats-row.gw-rx-open { background: #1e293b; }
.gw-rx-toggle { font-variant-numeric: tabular-nums; }
.gw-pending { margin: 0 0 16px; padding: 12px 14px; }
.gw-pending-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.gw-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111827;
}
.gw-detail-title { min-width: 0; flex: 1 1 240px; }
.gw-detail-title h1 { margin: 0 0 6px; }
.gw-detail-title .muted {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.gw-link-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #64748b;
}
.gw-link-dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.gw-link-dot.off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }
.gw-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.gw-detail-actions .btn {
  margin: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gw-detail-toolbar {
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.gw-detail-toolbar label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.gw-detail-toolbar select { margin: 0; }
.gw-detail-hint { margin: 0 0 12px; }
.page h2 { margin: 20px 0 8px; font-size: 16px; }
pre {
  background: #0f172a;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
  font-size: 12px;
}
.icon-btn {
  background: #334155;
  border: 0;
  color: var(--text);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.icon-btn.danger { background: #3f1d2a; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; }
.sensor-table { width: 100%; }
.sensor-table th, .sensor-table td {
  vertical-align: middle;
  padding: 8px 10px;
}
.sensor-table .sensor-name {
  white-space: nowrap;
}
.sensor-table .cell-mid {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  line-height: 1.2;
  vertical-align: middle;
}
.sensor-table .temp,
.sensor-table .batt,
.sensor-table .kind-badge,
.sensor-table .celsius-ico {
  vertical-align: middle;
}
.sensor-table .temp, .sensor-table .batt { font-size: 13px; gap: 4px; }
.sensor-table .temp-ico { width: 11px; height: 22px; }
.sensor-table .batt-ico { width: 16px; height: 8px; }
.sensor-table .chip-ico { width: 18px; height: 22px; object-fit: contain; }
.sensor-table .dash-toggle { white-space: nowrap; margin: 0; font-size: 13px; }
.sensor-table .dash-toggle.yn-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.sensor-table .dash-toggle.yn-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}
.sensor-table .yn-cell { text-align: center; }
.yn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.yn-badge.yn-yes {
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.38);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.12);
}
.yn-badge.yn-no {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.32);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.08);
}
.model-with-rev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rev-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: lowercase;
  vertical-align: middle;
  white-space: nowrap;
}
.rev-badge.rev-v1 {
  color: #fde68a;
  background: rgba(202, 138, 4, 0.18);
  border: 1px solid rgba(202, 138, 4, 0.42);
}
.rev-badge.rev-v2 {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.dash-toggle.yn-toggle:hover .yn-badge.yn-yes {
  background: rgba(34, 197, 94, 0.24);
  border-color: rgba(34, 197, 94, 0.5);
}
.dash-toggle.yn-toggle:hover .yn-badge.yn-no {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
}
.sensor-table .dash-toggle input { width: auto; margin: 0; }
.chip-ico { display: inline-block; vertical-align: middle; object-fit: contain; flex-shrink: 0; }
.kind-dallas { gap: 4px; }
.celsius-ico { display: block; flex-shrink: 0; color: #7dd3fc; }
.color-field { margin: 10px 0 4px; }
.color-field-title { font-size: 13px; margin-bottom: 8px; }
.color-pick {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 16px;
  align-items: start;
  margin-top: 4px;
}
.color-swatch-wrap {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  margin: 0;
  cursor: pointer;
}
.color-swatch-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: repeating-conic-gradient(#334155 0% 25%, #1e293b 0% 50%) 50% / 12px 12px;
  font-size: 12px;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35);
}
.color-swatch-lg:not(.empty) { color: transparent; }
.color-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.color-sliders {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.color-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.color-pick-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hex-code {
  width: 110px;
  font-family: ui-monospace, Consolas, monospace;
  text-transform: lowercase;
}
.hue-bar,
.sat-bar,
.lit-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  border-radius: 9px;
  outline: none;
  cursor: pointer;
}
.hue-bar {
  background: linear-gradient(to right, #ef4444, #f59e0b, #eab308, #22c55e, #14b8a6, #3b82f6, #8b5cf6, #ef4444);
}
.sat-bar,
.lit-bar {
  background: #334155;
}
.hue-bar::-webkit-slider-thumb,
.sat-bar::-webkit-slider-thumb,
.lit-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0f172a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.hue-bar::-moz-range-thumb,
.sat-bar::-moz-range-thumb,
.lit-bar::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0f172a;
  cursor: pointer;
}
.color-preview {
  min-width: 72px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-family: ui-monospace, Consolas, monospace;
}
.color-hint { margin-top: 6px; }
.gradient-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0;
}
@media (max-width: 900px) {
  .gradient-color-grid { grid-template-columns: 1fr; }
}
.color-field-compact .color-pick {
  grid-template-columns: 1fr;
}
.color-field-compact .color-swatch-wrap {
  width: 56px;
  height: 56px;
}
.color-field-compact .color-swatch-lg {
  width: 56px;
  height: 56px;
}
.grad-preview {
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 4px 0 12px;
}
.val-colored { font-weight: inherit; }
.sensor-card .value:not(.muted) { color: var(--text); }
@media (max-width: 700px) {
  .color-pick { grid-template-columns: 1fr; }
}
.sensor-table .chain-cell { font-size: 12px; color: #94a3b8; max-width: 280px; }
.chain-summary { font-size: 11px; line-height: 1.35; margin: 2px 0 4px; }
.chain-summary-detail { color: #94a3b8; }
.chain-steps {
  margin: 4px 0 0;
  padding-left: 1.15rem;
  font-size: 12px;
  line-height: 1.45;
}
.chain-steps li { margin: 0 0 4px; }
.chain-steps strong { color: var(--text); font-weight: 600; }
.sensor-chain-props { margin: 12px 0; }
.sensor-chain-props h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.chain-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.2fr 1fr 0.8fr 1.2fr auto;
  gap: 6px;
  margin: 0 0 8px;
  align-items: end;
}
.chain-fld {
  display: contents;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.chain-fld-name { display: none; }
.chain-fld input,
.chain-fld select { margin: 0; }
@media (max-width: 1100px) {
  .chain-row { grid-template-columns: 1fr 1fr; }
  .chain-fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .chain-fld-name { display: block; }
}
.chain-head { margin: 8px 0; font-size: 12px; }
.calib-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .calib-layout { grid-template-columns: 1fr; }
}
.cal-table input { width: 100%; }
.calib-chart-wrap {
  background: #0f172a;
  border-radius: 10px;
  padding: 8px;
}
.label-row, .day-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.label-row.alarm-rule, fieldset.label-row, fieldset.alarm-rule {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 14px;
}
.rule-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 10px; }
.field-off { opacity: 0.35; }
.field-off input { pointer-events: none; }
.alarm-rule { margin: 0 0 16px; }
.day-chk { margin-right: 8px; }

.dw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 8px;
  align-items: stretch;
}
.dw-wide { grid-column: span 2; }
@media (max-width: 720px) {
  .dw-wide { grid-column: span 1; }
}
.dw {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 360px;
  height: 100%;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.dw.tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0.75;
}
.dw-edit { cursor: grab; touch-action: none; user-select: none; }
.dw-edit:active { cursor: grabbing; }
html.is-app .dw-edit,
html.is-narrow .dw-edit {
  touch-action: pan-y;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
html.is-app .dw-edit img,
html.is-app .dw-edit svg,
html.is-narrow .dw-edit img,
html.is-narrow .dw-edit svg {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
html.is-app .dw-edit.dw-hold-ready,
html.is-app .dw-edit.dw-dragging,
html.is-narrow .dw-edit.dw-hold-ready,
html.is-narrow .dw-edit.dw-dragging {
  touch-action: none;
  cursor: grabbing;
}
html.dw-holding,
html.dw-holding body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.dw-edit .dw-grip {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px 0 -2px;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0.7;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}
.dw-edit:hover .dw-grip { opacity: 1; color: var(--text); }
@keyframes dw-jiggle {
  0%, 100% { transform: rotate(-0.35deg); }
  50% { transform: rotate(0.35deg); }
}
.dw-edit {
  animation: dw-jiggle 0.5s ease-in-out infinite;
  animation-delay: calc(var(--jiggle-phase, 0) * 0.06s);
}
.dw-grid--dragging .dw-edit {
  animation: none;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.dw-grid--dragging .dw-edit.dw-slot {
  transition: none;
}
.dw-dragging.dw-slot {
  opacity: 1;
  cursor: grabbing;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  outline: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -2px;
  box-shadow: none;
}
.dw-dragging.dw-slot::before {
  opacity: 0.25;
}
.dw-dragging.dw-slot > * {
  visibility: hidden;
}
.dw-drag-clone {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  opacity: 1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  cursor: grabbing;
  animation: none !important;
  will-change: transform;
  transform-origin: center center;
}
@keyframes dw-settle-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}
.dw-settle {
  animation: dw-settle-pulse 0.52s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .dw-edit { animation: none; }
  .dw-settle { animation: none; }
}
.dw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-shrink: 0; }
.dw-head h3 { margin: 0; font-size: 15px; flex: 1 1 auto; min-width: 0; }
.dw-tools { display: flex; gap: 4px; flex-shrink: 0; }
.dw-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 0;
}
.dw-chart-block {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.dw-meta {
  flex-shrink: 0;
  text-align: center;
  padding: 0 6px 2px;
  line-height: 1.35;
}
.dw-meta .dw-name { font-size: 13px; color: var(--muted); }
.dw-meta .dw-dev { font-size: 12px; margin-top: 1px; }
.dw-compare-meta { padding-bottom: 0; }
.dw-row { display: flex; flex-direction: column; gap: 6px; }
.dw-row-viz { gap: 8px; }
.dw-row-auto .dw-val-hero { font-size: 30px; font-weight: 800; }
.dw-name { font-size: 13px; color: var(--muted); }
.dw-dev { font-size: 12px; }
.dw-val { font-size: 22px; font-weight: 700; line-height: 1.2; }
.dw-val .batt, .dw-val .temp { font-size: inherit; }
.dw-val-sm { font-size: 16px; }
.dw-center { align-items: center; text-align: center; }
.dw-num { font-size: 42px; font-weight: 800; line-height: 1.1; }
.dw-row-number .dw-num { font-size: 52px; letter-spacing: -0.02em; }

/* Виджеты дашборда — SVG в стиле интерфейса */
.dw-viz { width: 100%; max-width: 320px; margin: 0 auto; }
.dw-viz-gauge { max-width: 280px; }
.dw-gauge-svg { width: 100%; height: auto; display: block; }
.dw-arc-track { fill: none; stroke: #1e293b; stroke-linecap: round; }
.dw-arc-grad-dim, .dw-arc-grad-lit { fill: none; }
.dw-arc-hub { fill: #334155; stroke: #0f172a; stroke-width: 2; }
.dw-arc-needle { stroke-width: 2.5; stroke-linecap: round; }
.dw-tick { stroke: #64748b; stroke-width: 1.5; }
.dw-tick-min { stroke: #475569; stroke-width: 1; opacity: 0.75; }
.dw-tick-label { fill: #94a3b8; font-size: 8.5px; text-anchor: middle; dominant-baseline: middle; }

.dw-donut-wrap { position: relative; display: grid; place-items: center; width: 100%; max-width: 220px; margin: 0 auto; }
.dw-donut-reading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.dw-donut-reading .dw-viz-reading { margin-top: 0; text-align: center; }
.dw-donut-reading .dw-viz-num {
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.dw-donut-reading .dw-viz-unit { display: block; margin: 2px 0 0; margin-left: 0; font-size: 15px; }
.dw-donut-row, .dw-tank-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}
.dw-donut-row { max-width: 100%; }
.dw-viz-side-reading {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.dw-viz-side-reading .dw-viz-reading { margin-top: 0; text-align: left; }
.dw-tank-row { flex: 1; min-height: 0; min-width: 0; align-items: stretch; }
.dw-tank-row .dw-tank-col { flex: 0 0 auto; align-self: stretch; display: flex; }
.dw-donut-svg { width: 100%; height: auto; display: block; overflow: visible; }
.dw-ring-track { fill: none; stroke: #1e293b; }
.dw-ring-grad-dim, .dw-ring-grad-lit { fill: none; }

.dw-viz-reading { margin-top: 4px; text-align: center; }
.dw-viz-gauge .dw-viz-reading { margin-top: 2px; }
.dw-viz-num { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.dw-viz-gauge .dw-viz-num { font-size: 36px; }
.dw-viz-bar .dw-viz-num, .dw-bar-viz .dw-viz-num { font-size: 40px; }
.dw-viz-unit { font-size: 14px; font-weight: 500; margin-left: 4px; }
.dw-viz-gauge .dw-viz-unit { font-size: 16px; }
.dw-bar-viz .dw-viz-unit { font-size: 17px; }

/* Единый крупный кегль значения у уровня / термометра / батарейки */
.dw-viz-side-reading .dw-viz-num,
.dw-thermo-reading .dw-viz-num,
.dw-batt-reading .dw-viz-num,
.dw-tank-reading .dw-viz-num {
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.dw-viz-side-reading .dw-viz-unit,
.dw-thermo-reading .dw-viz-unit,
.dw-batt-reading .dw-viz-unit {
  font-size: 18px;
  margin-left: 6px;
}

.dw-bar-viz {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dw-bar-viz .dw-scale-x-top {
  margin-bottom: 0;
  padding-bottom: 1px;
  line-height: 1;
}
.dw-bar-viz .dw-viz-reading {
  margin-top: 8px;
}
.dw-bar-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: visible;
}
.dw-bar-mask {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  border-radius: 0 999px 999px 0;
  pointer-events: none;
}
.dw-bar-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  z-index: 2;
  transition: left 0.35s ease;
}

.dw-scale-x {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.dw-scale-x-top {
  margin-top: 0;
  margin-bottom: 6px;
}
.dw-vscale { display: flex; align-items: stretch; justify-content: center; gap: 10px; }
.dw-scale-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 0;
  min-width: 2.8em;
  text-align: right;
}
.dw-tank-viz, .dw-thermo-viz, .dw-batt-viz { min-height: 180px; align-items: stretch; }
.dw-tank-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  min-height: 0;
  min-width: 56px;
  align-self: stretch;
}
.dw-tank {
  position: relative;
  width: 56px;
  flex: 1;
  min-height: 140px;
  border-radius: 10px 10px 14px 14px;
  background: #0f172a;
  border: 2px solid #334155;
  overflow: hidden;
}
.dw-tank-grad {
  position: absolute;
  inset: 0;
  opacity: 0.95;
}
.dw-tank-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: rgba(15, 23, 42, 0.78);
  z-index: 1;
  transition: height 0.35s ease;
}
.dw-tank-surface {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  border: 1px solid;
  z-index: 2;
  transition: bottom 0.35s ease;
}
.dw-tank-reading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  text-align: center;
  width: max-content;
  max-width: 140%;
}
.dw-tank-reading .dw-viz-reading { margin-top: 0; }
.dw-tank-reading .dw-viz-unit { display: block; margin: 2px 0 0; margin-left: 0; font-size: 15px; }

.dw-thermo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.dw-thermo { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; align-self: stretch; }
.dw-thermo-tube {
  position: relative;
  width: 26px;
  flex: 1;
  min-height: 130px;
  border-radius: 12px 12px 4px 4px;
  background: #0f172a;
  border: 2px solid #334155;
  overflow: hidden;
}
.dw-thermo-grad {
  position: absolute;
  inset: 0;
  opacity: 0.95;
}
.dw-thermo-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: rgba(15, 23, 42, 0.78);
  z-index: 1;
  transition: height 0.35s ease;
}
.dw-thermo-bulb {
  width: 38px;
  height: 38px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid #334155;
  flex-shrink: 0;
}
.dw-thermo-reading {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.dw-thermo-reading .dw-viz-reading { margin-top: 0; text-align: left; }

.dw-batt-vrow {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.dw-batt-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 68px;
}
.dw-batt-cap {
  width: 28px;
  height: 11px;
  border-radius: 4px 4px 2px 2px;
  border: 2px solid #334155;
  border-bottom: none;
  flex-shrink: 0;
  margin-bottom: 0;
  box-sizing: border-box;
}
.dw-batt-body {
  position: relative;
  width: 64px;
  flex: 1;
  min-height: 130px;
  border-radius: 12px;
  background: #0f172a;
  border: 2.5px solid #334155;
  overflow: hidden;
}
.dw-batt-grad {
  position: absolute;
  inset: 0;
  opacity: 0.95;
}
.dw-batt-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: rgba(15, 23, 42, 0.78);
  z-index: 1;
  transition: height 0.35s ease;
}
.dw-batt-surface {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  border: 1px solid;
  z-index: 2;
  transition: bottom 0.35s ease;
}
.dw-batt-reading {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.dw-batt-reading .dw-viz-reading { margin-top: 0; text-align: left; }

.dw-led { display: inline-flex; align-items: center; gap: 16px; font-weight: 700; }
.dw-led-pill {
  padding: 16px 28px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid var(--line);
}
.dw-led-text { font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
.dw-led-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.45);
  flex-shrink: 0;
}
.dw-led.on .dw-led-dot {
  background: var(--dw-led, #22c55e);
  box-shadow: 0 0 14px color-mix(in srgb, var(--dw-led, #22c55e) 70%, transparent);
}
.dw-led.off .dw-led-dot {
  background: var(--dw-led, #ef4444);
  box-shadow: 0 0 14px color-mix(in srgb, var(--dw-led, #ef4444) 60%, transparent);
}
.dw-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  max-width: 100%;
  padding: 18px 28px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--dw-badge, #38bdf8) 22%, #0f172a);
  border: 1px solid color-mix(in srgb, var(--dw-badge, #38bdf8) 52%, #334155);
  color: var(--dw-badge, #e2e8f0);
  font-weight: 800;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 4px 18px color-mix(in srgb, var(--dw-badge, #38bdf8) 18%, transparent);
}
.dw-row-badge {
  gap: 12px;
  padding: 8px 0 12px;
}
.dw-row-badge .dw-badge {
  width: 100%;
  max-width: 320px;
}
.dw-compact { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.dw-compact .dw-val { font-size: 16px; }

/* Тумблер on/off */
.dw-toggle { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 220px; margin: 0 auto; }
.dw-toggle-track {
  position: relative;
  width: 72px;
  height: 36px;
  border-radius: 999px;
  background: var(--dw-off, #334155);
  border: 2px solid #475569;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.dw-toggle.on .dw-toggle-track {
  background: color-mix(in srgb, var(--dw-on, #22c55e) 35%, #0f172a);
  border-color: var(--dw-on, #22c55e);
  box-shadow: 0 0 18px color-mix(in srgb, var(--dw-on, #22c55e) 45%, transparent);
}
.dw-toggle.off .dw-toggle-track { background: #1e293b; }
.dw-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, background 0.25s ease;
}
.dw-toggle.on .dw-toggle-thumb {
  transform: translateX(36px);
  background: var(--dw-on, #22c55e);
}
.dw-toggle.off .dw-toggle-thumb { background: #94a3b8; }
.dw-toggle-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  width: 100%;
  align-items: center;
  font-size: 12px;
}
.dw-toggle-off { text-align: left; color: var(--muted); opacity: 0.7; }
.dw-toggle-on { text-align: right; color: var(--muted); opacity: 0.7; }
.dw-toggle.on .dw-toggle-on { color: var(--dw-on, #22c55e); opacity: 1; font-weight: 600; }
.dw-toggle.off .dw-toggle-off { color: #94a3b8; opacity: 1; font-weight: 600; }
.dw-toggle-state { font-size: 15px; font-weight: 700; text-align: center; }

/* Счётчик — цифровой табло */
.dw-counter { text-align: center; padding: 6px 0; width: 100%; }
.dw-counter-face {
  display: inline-flex;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  border: 2px solid #334155;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.25);
}
.dw-counter-digits {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.dw-counter-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.62em;
  padding: 6px 5px;
  border-radius: 6px;
  background: #020617;
  border: 1px solid #1e293b;
  font-size: 44px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--dw-counter, #38bdf8);
  text-shadow: 0 0 18px color-mix(in srgb, var(--dw-counter, #38bdf8) 45%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.dw-counter-digit.dw-counter-sep {
  min-width: 0.35em;
  padding: 6px 2px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  font-size: 38px;
}
.dw-counter-unit { font-size: 15px; margin-top: 8px; }

/* Статус-чип */
.dw-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dw-chip, #64748b) 14%, #0f172a);
  border: 1px solid color-mix(in srgb, var(--dw-chip, #64748b) 40%, #334155);
  font-size: 17px;
  font-weight: 700;
}
.dw-chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dw-chip, #64748b);
  box-shadow: 0 0 10px color-mix(in srgb, var(--dw-chip, #64748b) 60%, transparent);
}
.dw-views {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
@media (max-width: 520px) {
  .dw-views { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dw-view {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.dw-view.on { border-color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.dw-spark {
  flex: 0 0 var(--dw-spark-h);
  height: var(--dw-spark-h);
  min-height: var(--dw-spark-h);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
  padding: 4px 8px 6px;
  box-sizing: border-box;
}
.dw-spark[hidden] { display: none !important; }
.dw-foot {
  flex-shrink: 0;
  padding-top: 2px;
  text-align: center;
}
.dw-updated {
  display: inline-block;
  font-size: 10px;
  line-height: 1.35;
  color: #64748b;
  letter-spacing: 0.01em;
  opacity: 0.88;
}
.dw-updated-fresh { color: #94a3b8; }
.dw-updated-old { color: #d97706; }
.dw-updated-stale { color: #f87171; }
.dw-spark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 16px;
  min-height: 16px;
}
.dw-spark-hint { font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-spark-reset {
  background: #1e293b;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.dw-spark-reset:hover { color: var(--text); border-color: var(--accent); }
.dw-spark-plot {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  cursor: crosshair;
}
.dw-spark-plot-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dw-spark-svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
}
.dw-spark-grid { stroke: #1e293b; stroke-width: 1; vector-effect: non-scaling-stroke; }
.dw-spark-plot.dragging { cursor: grabbing; }
.dw-spark-ylabel { fill: #64748b; font-size: 9px; }
.dw-spark-step.on { fill: #22c55e; }
.dw-spark-step.off { fill: #475569; }
.dw-spark-x {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  padding: 0 2px;
  pointer-events: none;
}
.dw-spark-empty { font-size: 12px; text-align: center; color: var(--muted); padding: 8px; }
.dw-spark-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: rgba(226, 232, 240, 0.75);
  pointer-events: none;
}
.dw-spark-tip {
  position: absolute;
  z-index: 3;
  max-width: calc(100% - 8px);
  padding: 6px 8px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.35;
}
.dw-spark-tip-t { color: var(--muted); margin-bottom: 2px; }
.dw-spark-tip-v { font-weight: 650; }
.dw-spark-tip-v--col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 600;
}
.dw-spark-tip-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.dw-compare-spark .dw-spark-tip,
.dw-compare-widget-spark .dw-spark-tip {
  max-width: min(280px, calc(100% - 8px));
}
.dw-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  z-index: 50;
  overflow: auto;
}
.dw-modal { max-width: 560px; width: 100%; }
.dw-modal-wide { max-width: 1080px; }
.dev-group-modal-bg {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.dev-group-modal {
  max-width: min(1180px, 96vw);
  width: 100%;
  max-height: min(92vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dev-group-modal > h2,
.dev-group-modal > .muted,
.dev-group-modal > label,
.dev-group-modal > .actions-bar {
  flex-shrink: 0;
}
.dev-group-modal .dev-group-editor {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 4px;
}
.dw-compare-modal { display: flex; flex-direction: column; gap: 12px; }
.dw-compare-head h2 { margin: 0 0 4px; }
.dw-compare-head .muted { margin: 0; }
.dw-compare-body {
  display: grid;
  grid-template-columns: minmax(340px, 1.35fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 280px;
}
.dw-compare-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: min(62vh, 560px);
  padding: 10px;
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg2, #0f172a) 80%, transparent);
}
.dw-compare-side-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.dw-compare-days {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin: 0;
}
.dw-compare-days select { width: auto; min-width: 88px; }
.dw-compare-search { max-width: none !important; min-width: 0 !important; flex: none !important; }
.dw-compare-search input { width: 100%; }
.dw-compare-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  max-height: 7.5em;
  overflow: auto;
  padding: 2px 0 4px;
}
.dw-compare-chips-lab { font-size: 12px; margin-right: 2px; }
.dw-compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 2px 4px 2px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip, #38bdf8) 45%, #334155);
  background: color-mix(in srgb, var(--chip, #38bdf8) 16%, #0f172a);
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}
.dw-compare-chip-lab {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-compare-chip-move,
.dw-compare-chip-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
}
.dw-compare-chip-move:hover,
.dw-compare-chip-x:hover { color: var(--text); background: rgba(148, 163, 184, 0.15); }
.dw-compare-chip-move:disabled { opacity: 0.35; cursor: default; }
.dw-compare-chip-x { font-weight: 700; }
.dw-compare-title-lab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 160px;
  min-width: 0;
}
.dw-compare-title-lab input { width: 100%; }
.dw-compare-preview-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.dw-compare-preview-tools .dw-compare-days {
  flex: 0 0 auto;
  margin: 0;
}
.dw-compare-pick.dw-pick,
.dw-compare-side .dw-pick {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  gap: 4px;
  padding-right: 2px;
}
.dw-compare-pick .dw-pick-item,
.dw-compare-side .dw-pick-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  margin: 0;
}
.dw-compare-pick .dw-pick-item:hover,
.dw-compare-side .dw-pick-item:hover {
  background: rgba(56, 189, 248, 0.08);
}
.dw-compare-pick .dw-pick-item.is-on,
.dw-compare-side .dw-pick-item.is-on {
  border-color: color-mix(in srgb, var(--pick-c, #38bdf8) 55%, #334155);
  background: color-mix(in srgb, var(--pick-c, #38bdf8) 12%, transparent);
}
.dw-pick-ord {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 1px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: var(--leg, #38bdf8);
}
.dw-pick-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dw-pick-name { font-weight: 600; }
.dw-pick-sub { font-size: 12px; }
.dw-pick-val {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dw-pick-empty { margin: 8px 4px; }
.dw-compare-preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dw-compare-spark {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
  margin-top: 0;
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg2, #0f172a) 65%, transparent);
}
/* Превью в модалке: не сжимать как виджетный .dw-spark (html.is-app → --dw-spark-h) */
html.is-app #dw-compare-plot.dw-spark,
html.is-mobile-chrome #dw-compare-plot.dw-spark,
#dw-compare-plot.dw-compare-spark {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
  max-height: none;
  overflow: hidden;
}
.dw-compare-spark--empty {
  min-height: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
html.is-app #dw-compare-plot.dw-compare-spark--empty,
html.is-mobile-chrome #dw-compare-plot.dw-compare-spark--empty {
  height: 200px;
  min-height: 200px;
}
.dw-compare-spark--ready {
  min-height: min(56vh, 420px);
  height: min(56vh, 420px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html.is-app #dw-compare-plot.dw-compare-spark--ready,
html.is-mobile-chrome #dw-compare-plot.dw-compare-spark--ready {
  height: min(56vh, 420px);
  min-height: min(56vh, 420px);
}
html.is-app #dw-compare-plot .dw-spark-head,
html.is-mobile-chrome #dw-compare-plot .dw-spark-head {
  display: flex;
}
.dw-compare-head kbd {
  font: inherit;
  font-size: 0.92em;
  padding: 0.05em 0.35em;
  border: 1px solid var(--line, #334155);
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg2, #1e293b) 80%, transparent);
}
.dw-compare-preview-legend {
  flex: 0 0 auto;
  margin-bottom: 6px;
  max-height: 4.5em;
  overflow: auto;
}
.dw-compare-spark--ready .dw-spark-head { flex: 0 0 auto; }
.dw-compare-spark--ready .dw-spark-plot {
  flex: 1 1 auto;
  min-height: 0;
}
.dw-spark-tip-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dw-spark-tip-line .dw-compare-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dw-compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 16px;
}
.dw-compare-empty strong { font-size: 14px; }
.dw-compare-empty .muted { font-size: 13px; max-width: 28ch; }
.dw-compare-spark .dw-spark-svg { min-height: 160px; }
.dw-compare-settings-pick .dw-pick { max-height: 32vh; margin: 8px 0 12px; }
@media (max-width: 760px) {
  .dw-compare-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .dw-compare-side { max-height: 42vh; }
  .dw-compare-spark--empty { height: 140px; min-height: 140px; }
  .dw-compare-spark--ready { height: 240px; min-height: 240px; }
}
.dw-compare-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.dw-compare-toolbar .dev-search-wrap { max-width: none; }
.dw-compare-toolbar .dw-pick { max-height: 28vh; }
.dw-compare-plot-wrap { margin-top: 4px; }
.dw-compare-widget-spark {
  flex: 0 0 200px;
  height: 200px;
  min-height: 200px;
}
html.is-app .dw-compare-widget-spark.dw-spark,
html.is-mobile-chrome .dw-compare-widget-spark.dw-spark {
  flex: 0 0 200px;
  height: 200px;
  min-height: 200px;
}
html.is-app .dw-compare-widget-spark .dw-spark-head,
html.is-mobile-chrome .dw-compare-widget-spark .dw-spark-head {
  display: flex;
}
.dw-compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
}
.dw-compare-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.3;
}
.dw-compare-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--leg, var(--chip, #38bdf8));
  flex-shrink: 0;
  box-shadow: 0 0 8px color-mix(in srgb, var(--leg, var(--chip, #38bdf8)) 45%, transparent);
}
.dw-compare-widget-spark .dw-spark-svg { min-height: 168px; }
.dw-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 36vh;
  overflow: auto;
  margin: 10px 0 14px;
}
.dw-pick-hint {
  margin: 4px 0 0;
  font-size: 12px;
}
.dw-pick-item {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.dev-group-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.dev-group-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line, #1e293b);
  border-radius: 10px;
  padding: 12px;
  background: color-mix(in srgb, var(--bg2, #0f172a) 75%, transparent);
}
.dev-group-col-head {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #94a3b8);
  margin-bottom: 6px;
  flex-shrink: 0;
}
.dev-group-col .dev-search-wrap {
  flex: 0 0 auto;
  max-width: none;
  min-width: 0;
  width: 100%;
  margin: 0;
}
.dev-group-col .dev-search-wrap input[type="search"] {
  margin: 0 0 6px;
  padding: 7px 10px;
}
.dev-group-moves {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.dev-group-moves .btn { white-space: nowrap; }
.dev-group-pick.dw-pick {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
  height: min(58vh, 560px);
  margin: 0;
  gap: 4px;
}
.dev-group-empty {
  margin: 6px 0;
  font-size: 12px;
}
@media (max-width: 860px) {
  .dev-group-editor { grid-template-columns: 1fr; }
  .dev-group-moves { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .dev-group-pick.dw-pick { height: min(36vh, 320px); min-height: 180px; }
}

html.is-app .dev-group-modal-bg,
html.is-mobile-chrome .dev-group-modal-bg,
html.is-narrow .dev-group-modal-bg {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  z-index: 80;
}
html.is-app .dev-group-modal-mobile,
html.is-mobile-chrome .dev-group-modal-mobile,
html.is-narrow .dev-group-modal-mobile {
  max-width: none;
  width: 100%;
  max-height: none;
  min-height: 100%;
  height: 100dvh;
  height: 100svh;
  border-radius: 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  overflow: hidden;
}
.dev-group-modal-mobile > h2 {
  font-size: 18px;
  margin: 0 0 8px;
}
.dev-group-modal-mobile > .actions-bar {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--panel, #111827);
  padding-top: 10px;
}
.dev-group-modal-mobile > .actions-bar .btn {
  min-height: 44px;
  font-size: 15px;
}
.grp-m-name {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  margin: 0 0 8px;
}
.grp-m-name input {
  min-height: 44px;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, #1e293b);
  background: #0b1220;
  color: var(--text);
}
.grp-m-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.grp-m-search {
  width: 100%;
  min-height: 42px;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, #1e293b);
  background: #0b1220;
  color: var(--text);
  box-sizing: border-box;
}
.grp-m-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.grp-m-filters .dash-group-chip {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 36px;
}
.grp-m-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.grp-m-meta .muted { flex: 1 1 auto; }
.grp-m-meta .btn {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}
.grp-m-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0 0;
  border: 1px solid var(--line, #1e293b);
  border-radius: 12px;
  background: #0b1220;
}
.grp-m-empty { padding: 16px 12px; }
.grp-m-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  margin: 0;
  border-bottom: 1px solid #1e293b;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.grp-m-row:last-child { border-bottom: 0; }
.grp-m-row.is-on { background: rgba(56, 189, 248, 0.1); }
.grp-m-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
}
.grp-m-row-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.grp-m-row-text strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.grp-m-row-text .muted {
  font-size: 12px;
  overflow-wrap: anywhere;
}
html.is-app .dash-groups-actions,
html.is-mobile-chrome .dash-groups-actions,
html.is-narrow .dash-groups-actions {
  width: 100%;
}
html.is-app .dash-groups-actions .btn,
html.is-mobile-chrome .dash-groups-actions .btn,
html.is-narrow .dash-groups-actions .btn {
  flex: 1 1 auto;
  min-height: 40px;
}

/* --- Reports constructor (Wialon-style) --- */
.rep-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.rep-sidebar { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 420px; }
.rep-sidebar-head { display: flex; justify-content: space-between; align-items: center; }
.rep-search { width: 100%; max-width: 360px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); }
.rep-tpl-list { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow: auto; }
.rep-tpl-item { padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.rep-tpl-item:hover { background: rgba(56, 189, 248, 0.08); border-color: var(--border); }
.rep-tpl-item.active { background: rgba(56, 189, 248, 0.14); border-color: #38bdf8; }
.rep-tpl-name { font-weight: 600; font-size: 14px; }
.rep-tpl-meta { font-size: 12px; margin-top: 2px; }
.rep-tpl-secs { font-size: 12px; margin-top: 4px; }
.rep-tpl-table { width: 100%; border-collapse: collapse; }
.rep-tpl-table th, .rep-tpl-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.rep-tpl-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.rep-list-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; white-space: nowrap; }
.rep-sidebar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rep-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rep-run-panel { padding: 12px; }
.rep-toolbar { flex-wrap: wrap; }
.rep-toolbar label { min-width: 140px; }
.rep-shift { margin-top: 8px; }
.rep-shift-body { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.rep-shift-days { display: flex; gap: 8px; flex-wrap: wrap; }
.rep-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 160px; overflow: auto; margin-top: 6px; }
.rep-result { padding: 12px; min-height: 280px; }
.rep-sec-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rep-sec-tab { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; }
.rep-sec-tab.active { background: #0ea5e9; color: #0f172a; border-color: #0ea5e9; font-weight: 600; }
.rep-chart-wrap { overflow: auto; }
.rep-chart-svg { width: 100%; max-width: 720px; height: auto; display: block; }
.rep-chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.rep-chart-interactive { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rep-chart-interactive .chart-stage { min-height: 380px; }
.rep-chart-interactive .chart-svg { height: min(42vh, 420px); min-height: 320px; }
.rep-result-body .chart-data-scroll { max-height: 280px; }
.rep-stats th { text-align: left; padding: 6px 12px 6px 0; color: var(--muted); font-weight: 500; }
.rep-stats td { padding: 6px 0; }
.rep-builder { display: flex; flex-direction: column; gap: 12px; }
.rep-builder h3 { margin: 0 0 8px; font-size: 16px; }
.rep-builder-tabs { display: flex; gap: 8px; }
.rep-builder-panes { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 14px; align-items: start; }
.rep-builder-list { display: flex; flex-direction: column; gap: 10px; }
.rep-builder-sections { display: flex; flex-direction: column; gap: 8px; }
.rep-builder-sec { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); }
.rep-builder-sec.active { border-color: #38bdf8; background: rgba(56, 189, 248, 0.1); }
.rep-sec-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: transparent; border: 0; color: inherit; cursor: pointer; text-align: left; padding: 0; min-width: 100px; }
.rep-builder-sec-type { font-size: 12px; color: var(--muted); }
.rep-sec-name { flex: 1; min-width: 120px; }
.rep-builder-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.rep-builder-detail { padding: 14px; min-height: 280px; }
.rep-builder-settings { padding: 14px; }
.rep-sec-editor { display: flex; flex-direction: column; gap: 12px; }
.rep-editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.rep-editor-block { padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(15, 23, 42, 0.25); }
.rep-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 6px; }
.rep-filter-item { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rep-settings-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.rep-btn-danger { color: #fecaca; border-color: #7f1d1d; }
.rep-group-cell { white-space: nowrap; }
.rep-group-toggle { width: 22px; height: 22px; margin-right: 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; line-height: 1; }
.rep-group-spacer { display: inline-block; width: 22px; margin-right: 6px; }
.rep-group-label { font-weight: 600; }
.rep-row-total { background: rgba(14, 165, 233, 0.12); font-weight: 600; }
.rep-row-group { background: rgba(148, 163, 184, 0.08); }
.rep-workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.rep-compact { padding: 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; max-height: calc(100vh - 88px); overflow: auto; }
.rep-compact-row { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.rep-search-full { max-width: none; width: 100%; font-size: 13px; padding: 7px 9px; }
/* Список отчётов — главный выбор в левой панели: не сжимать до «нескольких пикселей» на низких мониторах */
.rep-pick-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 200px;
  max-height: min(48vh, 420px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  background: rgba(15, 23, 42, 0.2);
}
.rep-pick-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; min-height: 44px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.rep-pick-row:hover { background: rgba(56, 189, 248, 0.08); }
.rep-pick-row.active { background: rgba(56, 189, 248, 0.16); border-color: #38bdf8; }
.rep-pick-main { flex: 1; min-width: 0; }
.rep-pick-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-pick-meta { font-size: 11px; margin-top: 1px; }
.rep-gear-btn { flex-shrink: 0; }
.rep-compact-block { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.rep-block-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rep-sel-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-sel-scope { font-size: 11px; margin-top: -4px; }
.rep-period { display: flex; flex-direction: column; gap: 6px; }
.rep-period-label { font-size: 11px; color: var(--muted); }
.rep-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.rep-chip { padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; font-size: 12px; }
.rep-chip.active { background: #0ea5e9; color: #0f172a; border-color: #0ea5e9; font-weight: 600; }
.rep-period-dates { display: flex; flex-direction: column; gap: 8px; }
.rep-dt-row { display: flex; flex-direction: column; gap: 4px; }
.rep-dt-label { font-size: 11px; color: var(--muted); cursor: pointer; }
.rep-dt-fields { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; position: relative; }
.rep-dt-pick { width: 28px; height: 28px; flex-shrink: 0; font-size: 14px; padding: 0; }
.rep-dt-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  margin: 0;
}
.rep-seg {
  width: 2.4em;
  min-width: 0;
  padding: 5px 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.rep-seg-year { width: 3.4em; }
.rep-seg::-webkit-outer-spin-button,
.rep-seg::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rep-seg:hover, .rep-seg:focus { border-color: #38bdf8; outline: none; }
.rep-seg-sep { color: var(--muted); font-size: 13px; padding: 0 1px; }
.rep-seg-gap { width: 6px; flex-shrink: 0; }
.rep-dt-row.is-empty .rep-seg { opacity: 0.85; }
.rep-objects { display: flex; flex-direction: column; gap: 6px; }
.rep-obj-list { display: flex; flex-direction: column; gap: 1px; max-height: min(28vh, 220px); overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.rep-obj-item { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 5px; cursor: pointer; }
.rep-obj-item .rep-obj-id { display: none; }
.rep-obj-item:hover { background: rgba(56, 189, 248, 0.08); }
.rep-obj-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-run-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.rep-run-actions .btn { min-width: 0; padding: 7px 10px; font-size: 13px; white-space: nowrap; }
.rep-run-actions #rep-run { grid-column: 1 / -1; }
.rep-empty-inline { padding: 10px; font-size: 12px; }
.rep-result { min-height: 320px; }
@media (max-height: 780px) {
  .rep-pick-list {
    min-height: 220px;
    max-height: min(58vh, 460px);
  }
  .rep-obj-list {
    max-height: min(18vh, 140px);
  }
  .rep-compact {
    max-height: calc(100vh - 64px);
  }
}
@media (max-height: 640px) {
  .rep-pick-list {
    min-height: 240px;
    max-height: min(62vh, 520px);
  }
  .rep-obj-list {
    max-height: 110px;
  }
}
@media (max-width: 960px) {
  .rep-layout, .rep-builder-panes, .rep-workspace { grid-template-columns: 1fr; }
  .rep-list-actions { justify-content: flex-start; }
  .rep-compact { position: static; max-height: none; }
  .rep-pick-list {
    min-height: 240px;
    max-height: min(50vh, 480px);
  }
}

/* CMS Manager */
.cms-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.cms-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  position: sticky;
  top: 12px;
}
.cms-nav-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.cms-nav-item:hover { background: rgba(56, 189, 248, 0.08); color: var(--text); }
.cms-nav-item.active {
  background: rgba(56, 189, 248, 0.14);
  color: var(--text);
  font-weight: 600;
}
.cms-main { padding: 16px 18px; min-height: 360px; }

/* CMS: кнопки «Сохранить» / «Создать» — акцент, не браузерный белый */
.cms-layout button.primary,
.cms-layout .btn.primary,
.cms-main button.primary,
.cms-main .btn.primary,
.cms-create-actions button.primary,
.cms-acl-preset-form button.primary,
.cms-inline-form button.primary,
.cms-form-actions button.primary,
#dev-settings[data-cms-dev] button.primary,
#dev-settings[data-cms-dev] .btn.primary {
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  border: 1px solid rgba(125, 211, 252, 0.55);
  border-radius: 8px;
  padding: 0 16px;
  height: 32px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 14px rgba(14, 165, 233, 0.28);
  transition: filter 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}
.cms-layout button.primary:hover,
.cms-layout .btn.primary:hover,
.cms-main button.primary:hover,
.cms-main .btn.primary:hover,
.cms-create-actions button.primary:hover,
.cms-acl-preset-form button.primary:hover,
.cms-inline-form button.primary:hover,
.cms-form-actions button.primary:hover,
#dev-settings[data-cms-dev] button.primary:hover,
#dev-settings[data-cms-dev] .btn.primary:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 18px rgba(14, 165, 233, 0.4);
}
.cms-layout button.primary:active,
.cms-main button.primary:active,
.cms-create-actions button.primary:active,
#dev-settings[data-cms-dev] button.primary:active {
  transform: translateY(1px);
  filter: brightness(0.96);
}
.cms-acc-add.primary {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #0f172a;
  border: 1px solid rgba(125, 211, 252, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.cms-acc-add.primary:hover { filter: brightness(1.08); }

.cms-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.cms-kpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cms-kpi strong { font-size: 22px; }
.cms-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
}
.cms-acl-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  min-height: 22px;
}
.cms-help {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.cms-help > summary {
  list-style: none;
}
.cms-help > summary::-webkit-details-marker { display: none; }
.cms-help-btn {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font: 700 13px/1 inherit;
  cursor: pointer;
  user-select: none;
}
.cms-help-btn:hover {
  background: rgba(251, 191, 36, 0.22);
}
.cms-help[open] > .cms-help-btn {
  background: rgba(251, 191, 36, 0.28);
  border-color: rgba(251, 191, 36, 0.8);
}
.cms-help-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  width: min(440px, 92vw);
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0f172a;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}
.cms-help-pop p { margin: 0 0 8px; }
.cms-help-pop p:last-child { margin: 0; }
.cms-acl-empty {
  margin: 16px 12px;
  font-size: 13px;
}
.cms-rights-toolbar .cms-help { margin-left: auto; }
.cms-acl-role-banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
  font-size: 13px;
  line-height: 1.45;
}
.cms-list { margin: 0 0 16px; padding-left: 18px; line-height: 1.5; }
.cms-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.cms-flags code {
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.4);
}
.cms-page .data { min-width: 0; width: 100%; }
.cms-page .mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.cms-accounts-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.cms-tree-pane, .cms-card-pane {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.25);
  min-height: 280px;
}
.cms-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cms-create-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.cms-form input, .cms-form select, .cms-form textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
}
.cms-inline-form input, .cms-inline-form select {
  box-sizing: border-box;
  font: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  min-width: 0;
  width: auto;
  max-width: 100%;
}
.cms-tree-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-left: calc(var(--d, 0) * 12px);
}
.cms-tree-item:hover { background: rgba(56, 189, 248, 0.08); }
.cms-tree-item.active { background: rgba(56, 189, 248, 0.16); }
.cms-tree-name { font-weight: 600; }
.cms-tree-meta { font-size: 11px; width: 100%; }
.cms-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.cms-type.root { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.4); }
.cms-type.dealer { color: #86efac; border-color: rgba(134, 239, 172, 0.4); }
.cms-type.client { color: #fcd34d; border-color: rgba(252, 211, 77, 0.35); }
.cms-type.danger { color: #fca5a5; border-color: rgba(252, 165, 165, 0.45); }
.cms-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.cms-badge.bad, .bad { color: #fca5a5; }
.cms-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
  padding: 6px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #0b1220;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.cms-tab {
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.01em;
  min-height: 38px;
}
.cms-tab:hover {
  color: #fff;
  background: #334155;
  border-color: #94a3b8;
}
.cms-tab.active {
  color: #0f172a;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border-color: rgba(125, 211, 252, 0.65);
  font-weight: 750;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 12px rgba(14, 165, 233, 0.28);
}
.cms-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.cms-form-grid label, .cms-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.cms-span2 { grid-column: 1 / -1; }
.cms-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.cms-acc-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
}
.cms-acc-edit .cms-acc-main-fields[hidden] {
  display: none !important;
}
.cms-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.cms-inline-form > * { flex: 1 1 140px; }
.cms-inline-form button { flex: 0 0 auto; }
.cms-rights-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 12px;
}
.cms-rights-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  align-items: center;
}
.cms-ui-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
}
.cms-ui-preset-custom {
  cursor: default;
  font-style: italic;
}
.cms-rights-sec {
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.cms-rights-sec-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.cms-rights-sec-head > span:first-child { flex: 1; font-weight: 600; }
.cms-rights-chevron { opacity: 0.7; font-size: 12px; }
.cms-rights-sec-body {
  padding: 4px 12px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  border-top: 1px solid var(--border, #334155);
}
.cms-rights-sec-body[hidden] { display: none !important; }
.cms-rights-hint {
  flex: 1 0 100%;
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.35;
}
.td-actions {
  width: 2.5rem;
  text-align: right;
  white-space: nowrap;
}
.cms-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.cms-acl-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 12px;
  align-items: stretch;
  min-height: min(62vh, 560px);
}
.cms-acl-left,
.cms-acl-right {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.cms-acl-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.cms-acl-filters input,
.cms-acl-filters select {
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: inherit;
  font: inherit;
  min-width: 0;
}
.cms-acl-left-meta {
  padding: 4px 10px;
  font-size: 12px;
}
.cms-rep-acl-wrap {
  max-height: min(56vh, 520px);
  overflow: auto;
}
.cms-rep-acl-table .cms-rep-flag-col {
  text-align: center;
  white-space: nowrap;
  width: 6.5rem;
}
.cms-rep-acl-table thead th.cms-rep-flag-col {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.cms-rep-editor h3 {
  margin: 16px 0 6px;
  font-size: 15px;
}
.cms-acl-dev-table-wrap {
  flex: 1 1 auto;
  overflow: auto;
  max-height: min(68vh, 640px);
  padding: 0 4px 4px;
}
.cms-acl-dev-table { margin: 0; }
.cms-acl-dev-table th:first-child,
.cms-acl-dev-table td.cms-acl-check-cell {
  width: 2rem;
  text-align: center;
}
.cms-acl-dev-row { cursor: pointer; }
.cms-acl-dev-row.is-selected td {
  background: rgba(56, 189, 248, 0.14);
}
.cms-acl-dev-row.has-acl td {
  box-shadow: inset 3px 0 0 var(--acl-c, #34d399);
}
.cms-acl-dev-row.has-acl:not(.is-selected) td {
  background: color-mix(in srgb, var(--acl-c, #34d399) 14%, transparent);
}
.cms-acl-dev-row.has-acl.is-selected td {
  background: color-mix(in srgb, var(--acl-c, #38bdf8) 22%, rgba(56, 189, 248, 0.12));
}
.cms-acl-badge {
  color: #34d399;
  font-size: 10px;
  vertical-align: middle;
}
.cms-acl-preset-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  max-width: 12rem;
}
.cms-acl-preset-dot {
  color: var(--acl-c, #34d399);
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}
.cms-acl-preset-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--acl-c, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9.5rem;
}
.cms-acl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--muted);
}
.cms-acl-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #cbd5e1;
}
.cms-acl-legend-item .cms-acl-preset-dot {
  font-size: 10px;
}
.cms-acl-preset-chip-btn {
  border-color: color-mix(in srgb, var(--acl-c, #38bdf8) 55%, #334155) !important;
  background: color-mix(in srgb, var(--acl-c, #38bdf8) 18%, rgba(15, 23, 42, 0.65)) !important;
  color: #e2e8f0 !important;
}
.cms-acl-preset-chip-btn .cms-acl-preset-dot {
  margin-right: 2px;
}
.cms-acl-preset-chip.is-active .cms-acl-preset-chip-btn,
.cms-acl-preset-chip-btn.active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--acl-c, #38bdf8) 70%, transparent);
}
.cms-acl-left-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.cms-acl-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.cms-acl-right-head .linkish {
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}
.cms-acl-presets {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.cms-acl-presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.cms-acl-presets-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #94a3b8);
}
.cms-acl-presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cms-acl-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
.cms-acl-preset-chip.is-active .rep-chip {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.55);
}
.cms-acl-preset-chip .linkish {
  font-size: 12px;
  padding: 0 4px;
  opacity: 0.75;
}
.cms-acl-preset-chip .linkish:hover { opacity: 1; }
.cms-acl-preset-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.cms-acl-preset-form input {
  flex: 1 1 140px;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: inherit;
  font: inherit;
}
.cms-acl-preset-form .primary,
.cms-acl-preset-form .linkish {
  height: 30px;
  padding: 0 10px;
}
.cms-acl-rights-panel {
  padding: 4px 2px 12px;
  overflow: auto;
  max-height: 520px;
}
.cms-acl-sec-hint {
  flex: 1 1 100%;
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.35;
}
.cms-acl-sec.is-parent-off .cms-rights-sec-head > span:first-child {
  opacity: 0.75;
}
.cms-acl-rights-toolbar {
  margin-bottom: 8px;
  padding: 0 4px;
}
.cms-acl-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.cms-acl-preset-chip.is-active .rep-chip {
  outline: 1px solid var(--accent, #38bdf8);
}
.cms-acl-group {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
}
.cms-acl-group:last-child { border-bottom: 0; margin-bottom: 0; }
.cms-acl-group-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted, #94a3b8);
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cms-acl-group-title .cms-acl-group-master {
  font-weight: 600;
  color: var(--muted, #94a3b8);
  font-size: 12px;
}
.cms-acl-hint {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--muted, #94a3b8);
  opacity: 0.85;
}
.cms-acl-flag-parent { font-weight: 600; }
.cms-acl-group-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.cms-acl-flag { font-size: 12px; }
@media (max-width: 900px) {
  .cms-acl-split { grid-template-columns: 1fr; }
  .cms-acl-filters { grid-template-columns: 1fr; }
}
.cms-acc-head h2 { margin: 0 0 4px; font-size: 18px; }
.cms-back-btn { display: inline-block; margin-bottom: 8px; font-size: 13px; }
.cms-acc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.cms-acc-toolbar .cms-help { margin-left: auto; }
.cms-acc-toolbar #cms-acc-search,
.cms-acc-toolbar #cms-user-search,
.cms-acc-toolbar #cms-acc-user-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 280px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-size: 13px;
}
.cms-acc-meta { font-size: 12px; white-space: nowrap; }
.cms-acc-add {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  margin-left: auto;
}
.cms-create-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 10px 12px;
  flex-direction: unset;
}
.cms-create-compact[hidden] { display: none !important; }
.cms-create-compact .cms-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cms-create-compact .cms-field > span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}
.cms-create-compact .cms-field-wide { grid-column: 1 / -1; }
.cms-create-compact input,
.cms-create-compact select,
.cms-create-compact textarea {
  width: 100%;
  height: 32px;
  min-width: 0;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
}
.cms-create-compact textarea {
  height: 52px;
  resize: vertical;
  min-height: 32px;
}
.cms-create-compact .cms-create-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.cms-create-compact button { height: 32px; padding: 0 14px; flex: 0 0 auto; white-space: nowrap; }
.cms-user-create {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}
@media (max-width: 1100px) {
  .cms-create-compact,
  .cms-user-create { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cms-acc-table .th-sort {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}
.cms-acc-table .th-sort:hover,
.cms-acc-table .th-sort.active { color: var(--accent); }
.cms-acc-table td.cms-row-actions { text-align: right; white-space: nowrap; width: 48px; }
.cms-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 16px;
}
.cms-preset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  cursor: pointer;
}
.cms-preset:hover { border-color: rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.08); }
.cms-preset.active {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
}
.cms-preset strong { font-size: 15px; }
.cms-hierarchy-pane { max-height: 520px; overflow: auto; padding: 4px; }
.linkish {
  background: none;
  border: 0;
  color: #7dd3fc;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
@media (max-width: 900px) {
  .cms-layout { grid-template-columns: 1fr; }
  .cms-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .cms-kpis { grid-template-columns: 1fr 1fr; }
  .cms-accounts-layout { grid-template-columns: 1fr; }
  .cms-form-grid { grid-template-columns: 1fr; }
  .cms-preset-grid { grid-template-columns: 1fr; }
}

/* ── CMS UI refresh (тёмные таблицы / без белых плашек) ───────── */
.cms-page,
.cms-layout,
.cms-main,
#dev-settings[data-cms-dev] {
  --border: var(--line);
  --bg2: #0b1220;
}
.cms-main.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  padding: 16px 18px 20px;
  min-height: 420px;
}
.cms-side {
  background: rgba(15, 23, 42, 0.55);
  border-color: var(--line);
  border-radius: 12px;
  padding: 10px;
  gap: 4px;
}
.cms-nav-item {
  border-radius: 8px;
  padding: 9px 12px;
}
.cms-nav-item.active {
  background: rgba(56, 189, 248, 0.16);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Таблицы: тёмная шапка, без «белых» th/кнопок сортировки */
.cms-main .table-wrap,
.cms-page .table-wrap,
.cms-main .cms-acl-dev-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #152033;
  overflow: auto;
}
.cms-main table.data,
.cms-page table.data,
#dev-settings[data-cms-dev] table.data {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}
.cms-main > table.data,
.cms-main .cms-tab-panel > table.data,
.cms-acc-edit > .cms-tab-panel > table.data,
.cms-main .cms-create-actions + table.data {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #152033;
}
.cms-main table.data thead th,
.cms-page table.data thead th,
#dev-settings[data-cms-dev] table.data thead th {
  background: #1a2740;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
  vertical-align: middle;
}
.cms-main table.data tbody td,
.cms-page table.data tbody td,
#dev-settings[data-cms-dev] table.data tbody td {
  background: transparent;
  border-bottom: 1px solid rgba(51, 65, 85, 0.65);
  padding: 9px 12px;
  font-size: 13px;
  vertical-align: middle;
  color: var(--text);
}
.cms-main table.data tbody tr:last-child td,
.cms-page table.data tbody tr:last-child td {
  border-bottom: 0;
}
.cms-main table.data tbody tr:hover td,
.cms-page table.data tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}
.cms-main table.data .th-sort,
.cms-page table.data .th-sort,
.cms-acc-table .th-sort,
.cms-obj-table .th-sort,
.dev-table .th-sort,
.al-table .th-sort {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  color: inherit !important;
  font: inherit;
  font-weight: 650;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  line-height: inherit;
}
.cms-main table.data .th-sort:hover,
.cms-main table.data .th-sort.active,
.cms-acc-table .th-sort:hover,
.cms-acc-table .th-sort.active,
.cms-obj-table .th-sort:hover,
.cms-obj-table .th-sort.active {
  color: var(--accent) !important;
}

/* Кнопки без primary — slate, не белый браузерный default */
.cms-layout button,
.cms-main button,
#dev-settings[data-cms-dev] button {
  -webkit-appearance: none;
  appearance: none;
}
.cms-create-compact button:not(.primary):not(.linkish):not(.icon-btn),
.cms-form-actions button:not(.primary):not(.linkish):not(.icon-btn),
.cms-create-actions button:not(.primary):not(.linkish):not(.icon-btn),
.cms-inline-form button:not(.primary):not(.linkish):not(.icon-btn),
.cms-block-btn {
  background: #334155;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 0 14px;
  height: 32px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.cms-create-compact button:not(.primary):not(.linkish):not(.icon-btn):hover,
.cms-form-actions button:not(.primary):not(.linkish):not(.icon-btn):hover,
.cms-create-actions button:not(.primary):not(.linkish):not(.icon-btn):hover,
.cms-inline-form button:not(.primary):not(.linkish):not(.icon-btn):hover,
.cms-block-btn:hover {
  background: #475569;
  border-color: rgba(148, 163, 184, 0.4);
}
.cms-block-btn {
  border-color: rgba(252, 165, 165, 0.35);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
}
.cms-block-btn:hover {
  background: rgba(153, 27, 27, 0.55);
  border-color: rgba(252, 165, 165, 0.55);
}

/* Бейджи / типы — тёмные чипы, не светлые плашки */
.cms-type,
.cms-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: var(--muted);
  box-shadow: none;
}
.cms-type.root {
  background: rgba(14, 165, 233, 0.12);
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.35);
}
.cms-type.dealer {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.35);
}
.cms-type.client {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.3);
}
.cms-type.danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.45);
}
.cms-badge.bad,
.bad {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(252, 165, 165, 0.35);
  color: #fca5a5;
}
.cms-user-lock-note {
  margin: 8px 0 0;
  color: #fbbf24;
}
.cms-primary-badge {
  margin-left: 8px;
  font-size: 11px;
  vertical-align: middle;
}
.cms-user-name-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.cms-user-name-cell strong { font-weight: 650; }
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cms-user-kind {
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.cms-user-kind-extra {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
  color: #94a3b8;
}
.cms-user-row-admin td:first-child {
  box-shadow: inset 3px 0 0 #38bdf8;
}
.cms-check.is-locked { opacity: 0.55; }
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cms-badge.ok {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.4);
  color: #86efac;
  font-weight: 600;
}
.cms-badge.cms-status-badge,
.cms-badge.cms-user-active {
  min-width: 6.2em;
  justify-content: center;
  font-weight: 600;
}
.cms-badge.cms-acc-status {
  min-width: 8.4em;
}
tr.cms-user-row-off td,
tr.cms-acc-row-off td {
  background: rgba(239, 68, 68, 0.07);
}
.cms-acc-head h2 .cms-acc-status {
  margin-left: 8px;
  vertical-align: middle;
  font-size: 12px;
}

/* Табы, тулбары, формы */
.cms-tabs.cms-tabs-sub {
  margin-top: 0;
  margin-bottom: 14px;
  padding: 5px;
}
.cms-tabs.cms-tabs-sub .cms-tab {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}
.cms-acc-toolbar {
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
}
.cms-acc-toolbar input[type="search"],
.cms-acc-toolbar #cms-acc-search,
.cms-acc-toolbar #cms-user-search,
.cms-acc-toolbar #cms-acc-user-search {
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
}
.cms-acc-toolbar input[type="search"]::placeholder {
  color: #64748b;
}
.cms-create-box,
.cms-create-compact {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(51, 65, 85, 0.75);
  border-radius: 10px;
  border-style: solid;
}
.cms-form-grid label,
.cms-form label,
.cms-field > span {
  color: var(--muted);
  font-size: 12px;
}
.cms-form input,
.cms-form select,
.cms-form textarea,
.cms-inline-form input,
.cms-inline-form select,
.cms-create-compact input,
.cms-create-compact select,
.cms-create-compact textarea,
.cms-field input,
.cms-field select,
.cms-field textarea {
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
}
.cms-form input:focus,
.cms-form select:focus,
.cms-form textarea:focus,
.cms-create-compact input:focus,
.cms-create-compact select:focus,
.cms-inline-form select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}
.cms-kpi {
  background: rgba(15, 23, 42, 0.45);
  border-color: var(--line);
}
.cms-acc-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cms-acc-actions {
  border-top-color: rgba(51, 65, 85, 0.75);
}
.cms-rights-sec {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(51, 65, 85, 0.8);
}
.cms-rights-sec-head:hover {
  background: rgba(56, 189, 248, 0.06);
}
.cms-acl-split {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.28);
}
.cms-acl-left,
.cms-acl-right {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(51, 65, 85, 0.65);
  border-radius: 10px;
  padding: 10px;
  min-height: 0;
}
.cms-acl-filters input,
.cms-acl-filters select {
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
}
.cms-acl-right-head {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cms-acl-dev-row.is-selected td {
  background: rgba(56, 189, 248, 0.1) !important;
}
.cms-note {
  color: #94a3b8;
}
.rep-chip {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text);
}
.rep-chip.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
}
.cms-main .icon-btn,
.cms-page .icon-btn {
  background: #334155;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.cms-main .icon-btn:hover {
  background: #475569;
}
.cms-main .icon-btn.danger {
  background: rgba(127, 29, 29, 0.45);
  border-color: rgba(252, 165, 165, 0.3);
  color: #fecaca;
}
.cms-tree-pane,
.cms-card-pane {
  background: rgba(15, 23, 42, 0.4);
  border-color: var(--line);
}
.cms-main h3 {
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0.01em;
}
.cms-flags code {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}

/* Mobile / Android app shell */
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header-brand .header-logo {
  height: 26px;
  width: auto;
  max-width: 128px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 0 10px rgba(237, 26, 59, 0.32));
}
.header-brand-rule {
  width: 1px;
  height: 28px;
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(237, 26, 59, 0.55), transparent);
}
.header-wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  line-height: 1.05;
}
.header-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #f1f5f9;
  white-space: nowrap;
}
.header-sub {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
  white-space: nowrap;
}
html.is-app .header-brand {
  gap: 9px;
}
html.is-app .header-brand .header-logo {
  height: 20px;
  width: auto;
  max-width: 96px;
  filter: drop-shadow(0 0 8px rgba(237, 26, 59, 0.28));
}
html.is-app .header-brand-rule {
  height: 22px;
}
html.is-app .header-title {
  font-size: 13px;
  font-weight: 650;
}
html.is-app .header-sub {
  font-size: 9px;
  letter-spacing: 0.18em;
}
a.header-apk {
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  background: rgba(14, 165, 233, 0.18);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
a.header-apk:hover { background: rgba(14, 165, 233, 0.32); color: #fff; }
html.is-app .header-apk,
html.is-app #apk-download-top,
html.is-app .login-apk,
html.is-app #apk-download-login { display: none !important; }

@media (max-width: 720px) {
  :root {
    --page-x: 12px;
    --page-y: 14px;
    --dw-spark-h: 112px;
  }
  header:not(.app-topbar) {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  header:not(.app-topbar) nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  header:not(.app-topbar) .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    padding: 7px 10px;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dw-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .dw {
    min-height: 0;
  }
  .dw-spark-hint { font-size: 9px; }
  .dw-edit .dw-grip { opacity: 1; }
  .page table { min-width: 0; }
  .page-head { gap: 8px; }
  .page-head-actions,
  .actions-bar,
  .sensors-toolbar {
    gap: 6px;
  }
  .btn,
  .subnav .tab {
    padding: 7px 10px;
    font-size: 13px;
  }
  .btn-sm {
    padding: 5px 9px;
    font-size: 12px;
  }
}

/* Android APK — compact modern phone UI */
html.is-app, html.is-mobile-chrome {
  --page-x: 12px;
  --page-y: 10px;
  --dw-spark-h: 156px;
  --app-nav-h: 58px;
  --app-top-h: 52px;
}
html.is-app,
html.is-mobile-chrome,
html.is-app body,
html.is-mobile-chrome body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}
html.is-app body, html.is-mobile-chrome body {
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}
html.is-app #app, html.is-mobile-chrome #app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100dvh;
}
html.is-app .app-topbar, html.is-mobile-chrome .app-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--app-top-h);
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
}
html.is-app .site-top,
html.is-mobile-chrome .site-top {
  flex: 0 0 auto;
  position: relative;
  top: auto;
  z-index: 30;
  box-shadow: 0 1px 0 var(--line);
}
html.is-app .app-main, html.is-mobile-chrome .app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  overscroll-behavior: contain;
  padding-bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
}
html.is-app .app-main .page, html.is-mobile-chrome .app-main .page {
  padding: 10px 12px 16px;
  overflow-x: hidden;
}
html.is-app .page h1, html.is-mobile-chrome .page h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}
html.is-app .page h2, html.is-mobile-chrome .page h2 {
  margin: 14px 0 6px;
  font-size: 14px;
}
html.is-app .page-head, html.is-mobile-chrome .page-head {
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
html.is-app .page-head h1, html.is-mobile-chrome .page-head h1 { margin: 0; }
html.is-app .muted, html.is-mobile-chrome .muted { font-size: 12px; line-height: 1.35; }
html.is-app .btn, html.is-mobile-chrome .btn,
html.is-app .subnav .tab, html.is-mobile-chrome .subnav .tab,
html.is-app nav .tab, html.is-mobile-chrome nav .tab {
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 9px;
  line-height: 1.2;
  min-height: 34px;
}
html.is-app .btn-sm, html.is-mobile-chrome .btn-sm {
  padding: 5px 8px;
  font-size: 12px;
  min-height: 30px;
}
html.is-app .actions-bar, html.is-mobile-chrome .actions-bar,
html.is-app .page-head-actions, html.is-mobile-chrome .page-head-actions,
html.is-app .sensors-toolbar, html.is-mobile-chrome .sensors-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  align-items: center;
}
html.is-app .actions-bar .btn, html.is-mobile-chrome .actions-bar .btn,
html.is-app .page-head-actions .btn, html.is-mobile-chrome .page-head-actions .btn,
html.is-app .sensors-toolbar .btn, html.is-mobile-chrome .sensors-toolbar .btn {
  flex: 0 1 auto;
  width: auto;
  white-space: nowrap;
}
html.is-app .login-actions .btn,
html.is-mobile-chrome .login-actions .btn {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}
html.is-app .login, html.is-mobile-chrome .login {
  max-width: 340px;
  margin: 10vh auto;
  padding: 18px 16px;
  border-radius: 14px;
}
html.is-app input, html.is-mobile-chrome input,
html.is-app select, html.is-mobile-chrome select {
  margin: 6px 0 10px;
  padding: 9px 10px;
  font-size: 15px;
  border-radius: 9px;
}
html.is-app .card, html.is-mobile-chrome .card,
html.is-app .tile, html.is-mobile-chrome .tile,
html.is-app .kpi, html.is-mobile-chrome .kpi {
  padding: 12px;
  border-radius: 12px;
}
html.is-app .kpi-value, html.is-mobile-chrome .kpi-value { font-size: 22px; margin: 4px 0; }
html.is-app .subnav, html.is-mobile-chrome .subnav {
  gap: 4px;
  margin: 8px 0 10px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}
html.is-app .subnav .tab, html.is-mobile-chrome .subnav .tab {
  flex: 0 0 auto;
}
html.is-app .import-bar, html.is-mobile-chrome .import-bar {
  padding: 5px 8px;
  gap: 4px 6px;
}
html.is-app .dw-grid, html.is-mobile-chrome .dw-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}
html.is-app .dw, html.is-mobile-chrome .dw {
  padding: 10px 10px 8px;
  border-radius: 12px;
}
html.is-app .dw-spark, html.is-mobile-chrome .dw-spark {
  overflow: hidden;
  flex: 0 0 var(--dw-spark-h);
  height: var(--dw-spark-h);
  min-height: var(--dw-spark-h);
}
html.is-app .dw-spark-head, html.is-mobile-chrome .dw-spark-head {
  display: none;
}
html.is-app .dw-spark-plot, html.is-mobile-chrome .dw-spark-plot {
  flex: 1 1 auto;
  min-height: 128px;
}
html.is-app .dw-spark-svg, html.is-mobile-chrome .dw-spark-svg {
  width: 100%;
  height: 100%;
  min-height: 128px;
}
html.is-app .dw-spark-x, html.is-mobile-chrome .dw-spark-x {
  font-size: 9px;
}
html.is-app .table-wrap, html.is-mobile-chrome .table-wrap { margin: 0 -4px; }
html.is-app td, html.is-mobile-chrome td,
html.is-app th, html.is-mobile-chrome th {
  padding: 8px 10px;
  font-size: 13px;
}
html.is-app .app-bottom-nav, html.is-mobile-chrome .app-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(var(--app-nav-cols, 6), minmax(0, 1fr));
  gap: 0;
  min-height: var(--app-nav-h);
  padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(51, 65, 85, 0.95);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28);
}
html.is-app .app-bottom-nav .app-tab, html.is-mobile-chrome .app-bottom-nav .app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 4px 2px;
  min-height: 50px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 560;
  line-height: 1.1;
  white-space: nowrap;
  position: relative;
}
html.is-app .app-bottom-nav .app-tab-icon, html.is-mobile-chrome .app-bottom-nav .app-tab-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.9;
}
html.is-app .app-bottom-nav .app-tab-label, html.is-mobile-chrome .app-bottom-nav .app-tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.is-app .app-bottom-nav .app-tab.active, html.is-mobile-chrome .app-bottom-nav .app-tab.active {
  background: rgba(14, 165, 233, 0.14);
  color: #e0f2fe;
  font-weight: 650;
}
html.is-app .app-bottom-nav .app-tab.active .app-tab-icon, html.is-mobile-chrome .app-bottom-nav .app-tab.active .app-tab-icon {
  color: #38bdf8;
  opacity: 1;
}
html.is-app .app-bottom-nav .tab-badge, html.is-mobile-chrome .app-bottom-nav .tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
html.is-app .create-drop, html.is-mobile-chrome .create-drop {
  min-width: min(300px, 92vw);
  max-width: 94vw;
}
html.is-app .rep-run-actions .btn, html.is-mobile-chrome .rep-run-actions .btn {
  padding: 6px 8px;
  font-size: 12px;
}

/* Mobile card lists (devices / gateways) */
.m-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.m-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
/* Длинные списки на телефоне: карточки вне экрана не раскладываются, пока к ним не прокрутят */
.m-list > .m-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 200px;
}
.dw-grid > .dw:not(.dw-edit) {
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
}
.m-card.dev-open {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.12);
}
.m-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.m-card-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: 0;
  color: var(--text);
  padding: 0;
  cursor: pointer;
}
.m-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.m-card-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.m-card-line {
  margin-top: 4px;
  font-size: 12px;
  word-break: break-all;
}
.m-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
}
.m-card-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.m-card-grid .muted { font-size: 11px; }
.m-card-grid strong {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}
.m-card-grid .m-card-span2 { grid-column: 1 / -1; }
.m-card-foot {
  margin-top: 8px;
  font-size: 11px;
}
.m-card-sensors {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.m-card-sensors .sensor-compact-list {
  grid-template-columns: 1fr;
}
.gw-table-wrap.gw-mobile {
  overflow: visible;
  max-height: none;
  border: 0;
  background: transparent;
  border-radius: 0;
  flex: none;
}
.gw-table-wrap.gw-mobile .gw-uptime-wrap {
  width: 100%;
}
html.is-app .page.gw-page,
html.is-mobile-chrome .page.gw-page {
  height: auto;
  max-height: none;
  overflow: visible;
  padding-bottom: 24px;
}
html.is-app .gw-head,
html.is-mobile-chrome .gw-head {
  flex-direction: column;
  align-items: stretch;
}
html.is-app .gw-head-tools,
html.is-mobile-chrome .gw-head-tools {
  width: 100%;
}
html.is-app .dev-search-bar, html.is-mobile-chrome .dev-search-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
html.is-app .dev-search-wrap, html.is-mobile-chrome .dev-search-wrap {
  max-width: none;
  min-width: 0;
  flex: 1 1 auto;
}
html.is-app .gw-toolbar, html.is-mobile-chrome .gw-toolbar {
  flex-direction: column;
  align-items: stretch;
}
html.is-app .gw-detail-head, html.is-mobile-chrome .gw-detail-head {
  align-items: stretch;
  padding: 12px;
}
html.is-app .gw-detail-actions, html.is-mobile-chrome .gw-detail-actions {
  width: 100%;
}
html.is-app .gw-detail-actions .btn, html.is-mobile-chrome .gw-detail-actions .btn {
  flex: 1 1 auto;
}

html.is-app #dev-settings .form-card, html.is-mobile-chrome #dev-settings .form-card,
html.is-app #dev-settings .form-card.wide, html.is-mobile-chrome #dev-settings .form-card.wide {
  max-width: none;
  padding: 12px;
}
html.is-app #dev-settings fieldset.sec, html.is-mobile-chrome #dev-settings fieldset.sec {
  padding: 10px 0 0;
  margin: 0;
  border: 0;
}
html.is-app #dev-settings fieldset.sec legend, html.is-mobile-chrome #dev-settings fieldset.sec legend {
  font-size: 13px;
  font-weight: 650;
  padding: 0;
}
html.is-app #dev-settings .form-grid, html.is-mobile-chrome #dev-settings .form-grid {
  grid-template-columns: 1fr;
  gap: 0 0;
}
html.is-app #dev-settings label, html.is-mobile-chrome #dev-settings label {
  display: block;
}
html.is-app #dev-settings .dev-pane-footer .btn, html.is-mobile-chrome #dev-settings .dev-pane-footer .btn {
  width: 100%;
}
html.is-app #dev-settings .remote-layout, html.is-mobile-chrome #dev-settings .remote-layout {
  grid-template-columns: 1fr;
  gap: 12px;
}
html.is-app #dev-settings .remote-row, html.is-mobile-chrome #dev-settings .remote-row {
  grid-template-columns: 1fr;
  gap: 4px;
}
html.is-app #dev-settings .remote-row span, html.is-mobile-chrome #dev-settings .remote-row span { font-size: 12px; }
html.is-app #dev-settings .reported, html.is-mobile-chrome #dev-settings .reported { padding-left: 0; }
html.is-app #dev-settings .remote-form .actions-bar .btn, html.is-mobile-chrome #dev-settings .remote-form .actions-bar .btn {
  flex: 1 1 auto;
}
html.is-app #dev-settings .sensors-toolbar, html.is-mobile-chrome #dev-settings .sensors-toolbar {
  flex-direction: column;
  align-items: stretch;
}
html.is-app #dev-settings .import-bar, html.is-mobile-chrome #dev-settings .import-bar {
  width: 100%;
}
html.is-app #dev-settings .sensor-edit .hint, html.is-mobile-chrome #dev-settings .sensor-edit .hint { font-size: 11px; }
html.is-app #dev-settings .chain-head, html.is-mobile-chrome #dev-settings .chain-head { display: none; }
html.is-app #dev-settings .sensor-edit, html.is-mobile-chrome #dev-settings .sensor-edit {
  padding: 12px;
  max-width: none;
}
html.is-app #dev-settings .sensor-edit h3, html.is-mobile-chrome #dev-settings .sensor-edit h3 {
  margin: 12px 0 6px;
  font-size: 14px;
}
html.is-app #dev-settings .sensor-edit textarea, html.is-mobile-chrome #dev-settings .sensor-edit textarea {
  min-height: 72px;
}
html.is-app #dev-settings .sensor-edit .actions-bar, html.is-mobile-chrome #dev-settings .sensor-edit .actions-bar {
  gap: 6px;
}
html.is-app #dev-settings .sensor-edit .actions-bar .btn, html.is-mobile-chrome #dev-settings .sensor-edit .actions-bar .btn {
  flex: 1 1 auto;
}
html.is-app #dev-settings .chain-row, html.is-mobile-chrome #dev-settings .chain-row {
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f172a;
  align-items: stretch;
}
html.is-app #dev-settings .chain-fld, html.is-mobile-chrome #dev-settings .chain-fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
html.is-app #dev-settings .chain-fld-name, html.is-mobile-chrome #dev-settings .chain-fld-name { display: block; }
html.is-app #dev-settings .chain-row .icon-btn, html.is-mobile-chrome #dev-settings .chain-row .icon-btn {
  justify-self: end;
  margin-top: 2px;
}
html.is-app #dev-settings .calib-layout, html.is-mobile-chrome #dev-settings .calib-layout {
  grid-template-columns: 1fr;
  gap: 10px;
}
html.is-app #dev-settings .cal-table, html.is-mobile-chrome #dev-settings .cal-table {
  min-width: 0;
  width: 100%;
}
html.is-app #dev-settings .cal-table th, html.is-mobile-chrome #dev-settings .cal-table th,
html.is-app #dev-settings .cal-table td, html.is-mobile-chrome #dev-settings .cal-table td {
  padding: 6px 4px;
}
html.is-app #dev-settings .cal-table input, html.is-mobile-chrome #dev-settings .cal-table input {
  margin: 0;
  padding: 8px;
  font-size: 16px;
}
html.is-app #dev-settings .label-row, html.is-mobile-chrome #dev-settings .label-row,
html.is-app #dev-settings .alarm-rule, html.is-mobile-chrome #dev-settings .alarm-rule {
  padding: 10px;
}
html.is-app #dev-settings .color-pick, html.is-mobile-chrome #dev-settings .color-pick {
  grid-template-columns: 1fr;
  gap: 8px;
}
html.is-app #dev-settings .color-swatch-wrap, html.is-mobile-chrome #dev-settings .color-swatch-wrap,
html.is-app #dev-settings .color-swatch-lg, html.is-mobile-chrome #dev-settings .color-swatch-lg {
  width: 48px;
  height: 48px;
}
html.is-app #dev-settings .color-pick-meta, html.is-mobile-chrome #dev-settings .color-pick-meta {
  gap: 6px;
}
html.is-app #dev-settings .hex-code, html.is-mobile-chrome #dev-settings .hex-code { width: 96px; }
html.is-app #dev-settings .day-row, html.is-mobile-chrome #dev-settings .day-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
html.is-app #dev-settings .day-chk, html.is-mobile-chrome #dev-settings .day-chk { margin: 0; }
html.is-app #dev-settings .rule-head, html.is-mobile-chrome #dev-settings .rule-head {
  flex-wrap: wrap;
}
html.is-app .sensor-set-card, html.is-mobile-chrome .sensor-set-card { cursor: default; }
.m-card.m-card-static { cursor: default; }
.m-card-nested {
  padding: 10px;
  background: #0b1220;
}
html.is-app .chart-toolbar, html.is-mobile-chrome .chart-toolbar {
  gap: 8px;
}
html.is-app .chart-toolbar label, html.is-mobile-chrome .chart-toolbar label {
  flex: 1 1 100%;
}
html.is-app .chart-toolbar input[type="datetime-local"], html.is-mobile-chrome .chart-toolbar input[type="datetime-local"] {
  min-width: 0;
  width: 100%;
}
html.is-app .chart-toolbar .btn, html.is-mobile-chrome .chart-toolbar .btn {
  padding: 6px 8px;
  font-size: 12px;
}
html.is-app .chart-svg, html.is-mobile-chrome .chart-svg {
  height: 280px;
  min-height: 280px;
  touch-action: none;
  display: block;
  width: 100%;
}
html.is-app .chart-stage, html.is-mobile-chrome .chart-stage {
  touch-action: pan-y;
  contain: layout paint;
  min-height: 280px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
html.is-app .chart-stage.is-panning, html.is-mobile-chrome .chart-stage.is-panning,
html.is-app .chart-stage.is-selecting, html.is-mobile-chrome .chart-stage.is-selecting,
html.is-app .chart-stage.is-pinching, html.is-mobile-chrome .chart-stage.is-pinching,
html.is-app .chart-stage.is-gesturing, html.is-mobile-chrome .chart-stage.is-gesturing {
  touch-action: none;
}
html.is-app .rep-chart-interactive .chart-stage, html.is-mobile-chrome .rep-chart-interactive .chart-stage {
  touch-action: none;
  min-height: 340px;
  margin-left: -10px;
  margin-right: -10px;
  width: calc(100% + 20px);
  border-radius: 8px;
}
html.is-app .rep-chart-interactive .chart-svg, html.is-mobile-chrome .rep-chart-interactive .chart-svg {
  height: 340px;
  min-height: 340px;
  width: 100%;
}
html.is-app .chart-zoom-bar, html.is-mobile-chrome .chart-zoom-bar {
  margin: 6px 0 10px;
  gap: 6px;
  align-items: center;
}
html.is-app .chart-zoom-bar .btn, html.is-mobile-chrome .chart-zoom-bar .btn {
  min-width: 44px;
  padding: 7px 10px;
  font-size: 13px;
}
html.is-app .chart-tip, html.is-mobile-chrome .chart-tip {
  max-width: min(360px, 88vw);
  font-size: 12px;
}
html.is-app .chart-legend label, html.is-mobile-chrome .chart-legend label,
html.is-app .chart-legend-item, html.is-mobile-chrome .chart-legend-item {
  padding: 10px 12px;
  font-size: 13px;
  min-height: 44px;
}
html.is-app .chart-active-bar, html.is-mobile-chrome .chart-active-bar {
  gap: 6px;
}
html.is-app .chart-chip, html.is-mobile-chrome .chart-chip {
  padding: 8px 10px 8px 12px;
  font-size: 13px;
  max-width: 100%;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
html.is-app .chart-chip-x, html.is-mobile-chrome .chart-chip-x {
  font-size: 20px;
  padding: 4px 8px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
}
.chart-pick-details {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1220;
}
.chart-pick-details > summary {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.chart-pick-details > summary::-webkit-details-marker { display: none; }
.chart-pick-details[open] > summary {
  border-bottom: 1px solid var(--line);
}
.chart-pick-details .chart-legend-group {
  margin: 8px 10px 10px;
}
.chart-pick-hint {
  margin: 8px 12px 0;
  font-size: 12px;
}

/* Reports — compact params on phone */
.rep-page--mobile .rep-compact {
  padding: 0;
  gap: 0;
  overflow: visible;
  max-height: none;
  position: static;
}
.rep-page--mobile,
.rep-page--mobile .rep-workspace,
.rep-page--mobile .rep-compact,
.rep-page--mobile .rep-params-fold,
.rep-page--mobile .rep-params-body {
  min-width: 0;
  max-width: 100%;
}
.rep-page--mobile .rep-params-fold {
  border: 0;
}
.rep-page--mobile .rep-params-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}
.rep-page--mobile .rep-params-sum::-webkit-details-marker { display: none; }
.rep-page--mobile .rep-params-title {
  font-size: 14px;
  font-weight: 650;
}
.rep-page--mobile .rep-params-meta {
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rep-page--mobile .rep-params-fold[open] .rep-params-sum {
  border-bottom: 1px solid var(--line);
}
.rep-page--mobile .rep-params-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow: visible;
}
html.is-app .rep-page--mobile .rep-params-body,
html.is-mobile-chrome .rep-page--mobile .rep-params-body {
  max-height: none;
}
.rep-page--mobile .rep-pick-list {
  max-height: min(42vh, 320px);
}
.rep-page--mobile .rep-obj-list {
  max-height: min(36vh, 260px);
}
.rep-page--mobile .rep-m-tpl {
  cursor: pointer;
}
.rep-page--mobile .rep-m-tpl .m-card-head {
  align-items: center;
  gap: 8px;
}
.rep-page--mobile .rep-m-tpl-name {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.rep-page--mobile .rep-run-head {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.rep-page--mobile .rep-run-head .btn {
  flex-shrink: 0;
}
.rep-page--mobile .rep-run-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.rep-page--mobile .rep-chips {
  gap: 4px;
}
.rep-page--mobile .rep-chip {
  padding: 5px 8px;
  font-size: 12px;
}
.rep-page--mobile .rep-compact-block {
  gap: 8px;
  padding-top: 6px;
}
.rep-page--mobile .rep-period-dates {
  gap: 6px;
}
.rep-page--mobile .rep-dt-phone {
  min-width: 0;
}
.rep-page--mobile .rep-dt-phone-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.rep-page--mobile .rep-dt-phone .rep-dt-date,
.rep-page--mobile .rep-dt-phone .rep-dt-time,
.rep-page--mobile .rep-dt-phone .rep-dt-full {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 8px;
  font-size: 13px;
  line-height: 1.2;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
}
.rep-page--mobile .rep-run-actions {
  gap: 6px;
  margin-top: 4px;
}
.rep-page--mobile.rep-page--run {
  padding-bottom: 88px;
}
.rep-page--mobile .rep-result {
  min-height: 0;
}
.rep-page--mobile .rep-run-actions--dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--app-nav-h, 58px) + env(safe-area-inset-bottom, 0px));
  z-index: 36;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid var(--line, #1e293b);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.28);
}
.rep-page--mobile .rep-run-actions--dock #rep-run {
  grid-column: 1 / -1;
  min-height: 48px;
  font-size: 16px;
  font-weight: 650;
}
.rep-page--mobile .rep-run-actions--dock .btn,
html.is-app .rep-page--mobile .rep-run-actions--dock .btn,
html.is-mobile-chrome .rep-page--mobile .rep-run-actions--dock .btn {
  min-height: 42px;
  padding: 10px 12px;
  font-size: 14px;
}
.rep-page--mobile .rep-search-full {
  font-size: 13px;
  padding: 8px 9px;
}
.rep-page--mobile .rep-m-list {
  gap: 8px;
}
.rep-page--mobile .rep-m-row .m-card-head,
.rep-page--mobile .rep-m-group .rep-group-label {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.rep-page--mobile .rep-m-row .m-card-grid {
  margin-top: 8px;
}
.rep-page--mobile .rep-m-row .m-card-grid strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.rep-page--mobile .rep-m-more {
  width: 100%;
  margin-top: 4px;
}
.rep-page--mobile .rep-m-group {
  background: #0b1220;
  padding: 10px 12px;
}
.rep-page--mobile .rep-m-group .m-card-head {
  align-items: center;
  gap: 8px;
}
.rep-page--mobile .rep-m-group .rep-group-toggle {
  flex-shrink: 0;
}
.rep-page--mobile .rep-result-body {
  overflow-x: hidden;
  min-width: 0;
}
.rep-page--mobile .rep-result .table-wrap {
  display: none;
}
html.is-app .rep-chart-interactive .chart-data-scroll, html.is-mobile-chrome .rep-chart-interactive .chart-data-scroll,
html.is-app .rep-chart-interactive .chart-m-list, html.is-mobile-chrome .rep-chart-interactive .chart-m-list {
  max-height: 240px;
  overflow: auto;
}
html.is-app .rep-sec-tabs, html.is-mobile-chrome .rep-sec-tabs {
  gap: 4px;
  margin-bottom: 8px;
}
html.is-app .rep-sec-tab, html.is-mobile-chrome .rep-sec-tab {
  padding: 8px 10px;
  font-size: 12px;
}
#dev-chart-stage:fullscreen {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 6px;
}
#dev-chart-stage:fullscreen #dev-chart-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
#dev-chart-stage:fullscreen .chart-svg {
  height: 100%;
  min-height: 0;
}
html.is-app .pkt-hex, html.is-mobile-chrome .pkt-hex {
  margin-top: 8px;
  font-size: 11px;
  word-break: break-all;
}
html.is-app .pkt-detail, html.is-mobile-chrome .pkt-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
html.is-app .pkt-detail pre, html.is-mobile-chrome .pkt-detail pre,
html.is-app .gw-rx-detail pre, html.is-mobile-chrome .gw-rx-detail pre {
  max-width: 100%;
  overflow-x: auto;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}
html.is-app .toolbar, html.is-mobile-chrome .toolbar {
  flex-wrap: wrap;
  gap: 8px;
}
html.is-app .toolbar label, html.is-mobile-chrome .toolbar label {
  flex: 1 1 100%;
  min-width: 0;
}
html.is-app .page, html.is-mobile-chrome .page {
  overflow-x: hidden;
}
html.is-app .air-device-cell, html.is-mobile-chrome .air-device-cell,
html.is-app .air-in-card, html.is-mobile-chrome .air-in-card {
  min-width: 0;
}
html.is-app .air-device-title, html.is-mobile-chrome .air-device-title {
  flex-wrap: wrap;
}
html.is-app .gw-rx-detail, html.is-mobile-chrome .gw-rx-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
html.is-app .gw-pending-head, html.is-mobile-chrome .gw-pending-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
html.is-app .chart-m-list, html.is-mobile-chrome .chart-m-list {
  max-height: none;
}
html.is-app .sensor-set-card .m-card-title, html.is-mobile-chrome .sensor-set-card .m-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.app-back-hint {
  position: fixed;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 6px;
  border-radius: 0 8px 8px 0;
  background: #38bdf8;
  opacity: 0;
  transform: scaleX(0.2);
  transform-origin: left center;
  pointer-events: none;
  z-index: 80;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
  transition: opacity 0.12s ease;
}
.app-back-hint.on {
  opacity: 0.85;
  transform: scaleX(calc(0.4 + var(--p, 0) * 2.2));
}

.dw-spark-plot { touch-action: pan-y; }
html.is-app .dw-spark-plot, html.is-mobile-chrome .dw-spark-plot,
html.is-narrow .dw-spark-plot {
  touch-action: pan-y;
}

.impersonate-banner {
  position: relative;
  top: auto;
  z-index: 1;
  background: #fef3c7;
  color: #92400e;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  border-bottom: 1px solid #f59e0b;
  box-shadow: none;
}
.impersonate-banner-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}
.impersonate-banner-meta {
  opacity: 0.9;
}
.impersonate-banner .btn {
  flex: 0 0 auto;
}
.impersonate-user-card {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  margin-bottom: 12px;
}
.impersonate-user-card p {
  margin: 0 0 10px;
}
.cms-res-table .cms-res-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.cms-res-flag {
  white-space: nowrap;
  font-size: 13px;
}
.cms-res-panel-flags {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cms-res-sum {
  font-size: 12px;
  margin-top: 2px;
}
.cms-res-focus {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #1e293b);
}
.cms-res-src {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: middle;
  background: #334155;
  color: #e2e8f0;
}
.cms-res-src-gateway { background: color-mix(in srgb, #38bdf8 35%, #0f172a); color: #e0f2fe; }
.cms-res-src-device { background: color-mix(in srgb, #a78bfa 35%, #0f172a); color: #ede9fe; }
.cms-res-src-sensor { background: color-mix(in srgb, #34d399 35%, #0f172a); color: #d1fae5; }
.cms-res-split .cms-acl-dev-table-wrap {
  max-height: min(52vh, 480px);
}
.user-page {
  max-width: 920px;
}
.user-page .user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.user-page .user-head h1 {
  margin: 0;
}
.user-page .user-logout-btn {
  flex-shrink: 0;
}
.user-page .user-imp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
}
.user-page .user-shell {
  padding: 16px 18px 18px;
}
.user-page .user-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line, #1e293b);
}
.user-page .user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #e0f2fe;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent, #38bdf8) 45%, #0f172a), #1e293b);
  border: 1px solid color-mix(in srgb, var(--accent, #38bdf8) 35%, #334155);
  flex-shrink: 0;
}
.user-page .user-identity-name {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}
.user-page .user-identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.user-page .user-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid var(--line, #334155);
  color: var(--muted, #94a3b8);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-page .user-pill-role {
  color: #e0f2fe;
  border-color: color-mix(in srgb, var(--accent, #38bdf8) 40%, #334155);
  background: color-mix(in srgb, var(--accent, #38bdf8) 14%, #0b1220);
}
.user-page .user-chip-btn {
  padding: 2px 10px;
  font-size: 12px;
  min-height: 0;
  height: auto;
  line-height: 1.4;
}
.user-page .user-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  align-items: start;
}
.user-page .user-panel-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  margin: 0 0 10px;
}
.user-page .user-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: none;
}
.user-page .user-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.user-page .user-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.user-page .user-field > span {
  color: var(--muted);
  font-size: 11px;
}
.user-page .user-field input {
  width: 100%;
  box-sizing: border-box;
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.user-page .user-field input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}
.user-page .user-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.user-page .user-pass-wrap input {
  padding-right: 52px;
}
.user-page .user-pass-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted, #94a3b8);
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.user-page .user-pass-toggle:hover,
.user-page .user-pass-toggle.is-on {
  color: var(--accent, #38bdf8);
  background: color-mix(in srgb, var(--accent, #38bdf8) 12%, transparent);
}
.user-page .user-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.user-page .user-status {
  font-size: 12px;
}
.user-page .user-status.ok {
  color: #34d399;
}
.user-page .user-status.err {
  color: #f87171;
}
.user-page .user-pwd-lock {
  margin: 0;
  font-size: 13px;
}
@media (max-width: 820px) {
  .user-page .user-panels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .user-page .user-grid-2 {
    grid-template-columns: 1fr;
  }
  .user-page .user-identity {
    align-items: flex-start;
  }
  .user-page .user-imp-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
.cms-subhead {
  font-size: 15px;
  margin: 8px 0;
}
.cms-custom-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.cms-custom-row input {
  flex: 1;
  min-width: 0;
}


/* Mobile browser polish */
html.is-mobile-chrome .impersonate-banner,
html.is-app .impersonate-banner {
  padding: 8px 12px;
  font-size: 12.5px;
  gap: 8px;
}
html.is-mobile-chrome .impersonate-banner .btn,
html.is-app .impersonate-banner .btn {
  width: 100%;
  justify-content: center;
}
html.is-mobile-chrome .app-topbar,
html.is-app .app-topbar {
  min-height: 48px;
  padding: 6px 12px;
}
html.is-mobile-chrome .header-brand .header-logo,
html.is-app .header-brand .header-logo {
  width: auto !important;
  height: 20px !important;
  max-width: 96px;
}
html.is-mobile-chrome .header-brand-rule,
html.is-app .header-brand-rule {
  height: 22px;
}
html.is-mobile-chrome .header-title,
html.is-app .header-title {
  font-size: 13px;
}
html.is-mobile-chrome .header-sub,
html.is-app .header-sub {
  font-size: 9px;
}
html.is-mobile-chrome .app-bottom-nav .app-tab,
html.is-app .app-bottom-nav .app-tab {
  min-height: 46px;
  padding: 3px 1px;
  font-size: 9.5px;
  gap: 1px;
}
html.is-mobile-chrome .app-bottom-nav .app-tab-icon,
html.is-app .app-bottom-nav .app-tab-icon {
  font-size: 14px;
}
html.is-mobile-chrome .login,
html.is-narrow .login {
  max-width: 100%;
  margin: 24px 16px;
  padding: 20px 16px;
}
html.is-mobile-chrome .login-logo,
html.is-narrow .login-logo {
  height: 32px;
}
html.is-mobile-chrome .login h2,
html.is-narrow .login h2 {
  font-size: 20px;
  margin: 0 0 14px;
  text-align: center;
}
html.is-mobile-chrome .login input,
html.is-narrow .login input {
  font-size: 16px; /* iOS zoom prevent */
  min-height: 44px;
}
html.is-mobile-chrome .login-actions .btn,
html.is-narrow .login-actions .btn {
  min-height: 48px;
  font-size: 16px;
}
html.is-mobile-chrome .login-apk,
html.is-narrow .login-apk,
html.is-mobile-chrome .login-ios-hint,
html.is-narrow .login-ios-hint {
  font-size: 13px;
}

/* Свойства БС */
.gw-props { max-width: 980px; }
.gw-props-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.gw-props-title { flex: 1; min-width: 0; }
.gw-props-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.gw-props-title h1 { margin: 0; font-size: 20px; }
.gw-props-save { flex-shrink: 0; }
.gw-props-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}
.gw-props-nav-btn {
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 650;
}
.gw-props-nav-btn:not(.primary) {
  background: #1e293b;
  border: 1px solid var(--line, #334155);
  color: var(--text);
}
.gw-props-nav-btn:not(.primary):hover {
  background: #334155;
  border-color: color-mix(in srgb, var(--accent, #38bdf8) 45%, #334155);
}
.gw-props-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.gw-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0b1220;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
}
.gw-pill b {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-pill-st { font-weight: 700; color: var(--text); }
.gw-pill-st.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, #334155);
  background: color-mix(in srgb, var(--ok) 12%, #0b1220);
}
.gw-pill-st.bad {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, #334155);
  background: color-mix(in srgb, var(--bad) 12%, #0b1220);
}
.gw-pill-st.warn {
  color: #fbbf24;
  border-color: color-mix(in srgb, #fbbf24 40%, #334155);
  background: color-mix(in srgb, #fbbf24 12%, #0b1220);
}
.gw-props-card {
  padding: 14px 16px 12px;
  margin-bottom: 12px;
}
.gw-props-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  align-items: start;
}
.gw-props-col h2,
.gw-props-col h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.gw-props-col h3 { margin-top: 12px; color: var(--muted); }
.gw-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.gw-field input,
.gw-field select,
.gw-field textarea {
  width: 100%;
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.gw-field textarea { min-height: 56px; resize: vertical; }
.gw-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gw-model-row select { flex: 1; }
.gw-props-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.gw-alarm-check { margin: 0 0 10px; font-size: 13px; color: var(--text); }
.gw-props-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gw-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 72px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
  font-size: 12px;
  color: var(--text);
}
.gw-chip b {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.gw-props-empty { margin: 0; font-size: 12px; }
.gw-props-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 10px 0 0;
  background: #0b1220;
}
.gw-props-box summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}
.gw-props-box summary::-webkit-details-marker { display: none; }
.gw-props-box summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}
.gw-props-box[open] summary { margin-bottom: 8px; }
.gw-props-box .muted { font-size: 12px; margin: 0 0 8px; }
.gw-props-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.gw-props-foot #gw-err { margin: 0; }
@media (min-width: 721px) {
  .gw-props-foot .btn { display: none; }
}
.gw-props-log { margin-top: 12px; }
.page.gw-props table.gw-props-table { min-width: 0; width: 100%; }
.gw-props-table th,
.gw-props-table td { font-size: 12px; padding: 5px 8px; }
@media (max-width: 720px) {
  .gw-props-head { flex-wrap: wrap; }
  .gw-props-save { order: 3; width: 100%; }
  .gw-props-grid,
  .gw-props-nums { grid-template-columns: 1fr; }
}

/* ── CMS: сеансы и активность пользователя ───────── */
.cms-sess-client {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  white-space: nowrap;
  vertical-align: middle;
}
.cms-sess-client.cms-sess-app {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(192, 132, 252, 0.4);
  color: #d8b4fe;
}
.cms-sess-client.cms-sess-web {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(125, 211, 252, 0.35);
  color: #7dd3fc;
}
.cms-online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  vertical-align: middle;
}
.cms-user-activity,
.cms-user-lastlogin { white-space: nowrap; }
.cms-user-activity { color: #86efac; }
.cms-user-activity.muted { color: var(--muted); }

.cms-sess {
  min-width: 0;
  width: 100%;
  contain: inline-size;
}
.cms-sess .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.cms-sess-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.cms-sess-toolbar .cms-tabs { margin: 0; }
.cms-sess-since { margin: 4px 0 12px; font-size: 12px; }
.cms-sess-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.cms-sess-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.cms-sess-card-app { box-shadow: inset 3px 0 0 #c084fc; }
.cms-sess-card-web { box-shadow: inset 3px 0 0 #38bdf8; }
.cms-sess-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cms-sess-card-title { font-weight: 700; }
.cms-sess-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cms-sess-status.on { color: #86efac; }
.cms-sess-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.14);
  font-size: 13px;
}
.cms-sess-kv:last-child { border-bottom: 0; }
.cms-sess-kv span { color: var(--muted); }
.cms-sess-kv strong { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.cms-sess-charts {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.cms-sess-chart {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.cms-sess-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.cms-sess-legend { font-size: 12px; color: var(--muted); }
.cms-sess-sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin: 0 3px 0 8px;
  vertical-align: -1px;
}
.cms-sess-sw.app,
.cms-sess-seg.app { background: #a855f7; }
.cms-sess-sw.web,
.cms-sess-seg.web { background: #38bdf8; }
.cms-sess-bars {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 130px;
}
.cms-sess-bar {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cms-sess-bar-stack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(148, 163, 184, 0.06);
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}
.cms-sess-seg { display: block; width: 100%; }
.cms-sess-bar:hover .cms-sess-bar-stack { background: rgba(148, 163, 184, 0.16); }
.cms-sess-bar-lbl {
  height: 16px;
  font-size: 10px;
  line-height: 16px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.cms-sess-bars.compact { gap: 1px; }

.cms-sess-pages-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}
.cms-sess-pages-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cms-sess-pages-lbl { min-width: 90px; }
.cms-sess-page {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.22);
  white-space: nowrap;
}

.cms-sess-table td { vertical-align: top; }
.cms-sess-row { cursor: pointer; }
.cms-sess-row:hover td { background: rgba(56, 189, 248, 0.06); }
.cms-sess-row.online td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.cms-sess-caret { width: 18px; color: var(--muted); }
.cms-sess-caret span { display: inline-block; transition: transform 0.15s; }
.cms-sess-row.open .cms-sess-caret span { transform: rotate(90deg); }
.cms-sess-why { font-size: 11px; }
.cms-sess-visits > td { background: rgba(2, 6, 23, 0.35); }
.cms-sess-visits-table { margin: 4px 0 8px; }
.cms-sess-visits-table th,
.cms-sess-visits-table td { font-size: 12px; padding: 4px 8px; }

@media (max-width: 900px) {
  .cms-sess-cards,
  .cms-sess-charts { grid-template-columns: minmax(0, 1fr); }
}

/* Нет связи: экран повтора, кнопка обновления в шапке APK, полоса «нет сети» */
.app-reload {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  font-size: 20px;
  background: transparent;
  color: var(--muted);
}
.app-reload:active { background: #334155; color: var(--text); }
.app-reload.is-busy { animation: app-reload-spin 0.9s linear infinite; pointer-events: none; }
@keyframes app-reload-spin { to { transform: rotate(360deg); } }
.net-err-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.net-err-card {
  max-width: 360px;
  text-align: center;
  padding: 28px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.net-err-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--warn);
  background: rgba(245, 158, 11, 0.14);
}
.net-err-card h2 { margin: 0 0 8px; font-size: 18px; }
.net-err-card p { margin: 0; line-height: 1.45; }
.net-err-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
.net-err-actions .btn { min-width: 130px; justify-content: center; }
.net-err-detail { margin-top: 14px !important; font-size: 12px; word-break: break-word; }
html.is-offline body::after {
  content: "Нет сети — данные не обновляются";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding: 4px 12px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
html.is-app.is-offline body::after,
html.is-mobile-chrome.is-offline body::after {
  bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
}
/* Переход ждёт сервер дольше 0,12 с — полоса загрузки сверху, чтобы нажатие сразу давало отклик */
html.is-loading body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1001;
  width: 40%;
  height: 3px;
  background: var(--accent, #38bdf8);
  pointer-events: none;
  animation: cw-loading-bar 0.9s ease-in-out infinite;
}
@keyframes cw-loading-bar {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}
