
/* /vendor/leaflet/1.9.4/leaflet.css */
/* required styles */

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
	position: absolute;
	left: 0;
	top: 0;
	}
.leaflet-container {
	overflow: hidden;
	}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
	-webkit-user-select: none;
	   -moz-user-select: none;
	        user-select: none;
	  -webkit-user-drag: none;
	}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
	background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
	image-rendering: -webkit-optimize-contrast;
	}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
	width: 1600px;
	height: 1600px;
	-webkit-transform-origin: 0 0;
	}
.leaflet-marker-icon,
.leaflet-marker-shadow {
	display: block;
	}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg {
	max-width: none !important;
	max-height: none !important;
	}
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
	max-width: none !important;
	max-height: none !important;
	width: auto;
	padding: 0;
	}

.leaflet-container img.leaflet-tile {
	/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
	mix-blend-mode: plus-lighter;
}

.leaflet-container.leaflet-touch-zoom {
	-ms-touch-action: pan-x pan-y;
	touch-action: pan-x pan-y;
	}
.leaflet-container.leaflet-touch-drag {
	-ms-touch-action: pinch-zoom;
	/* Fallback for FF which doesn't support pinch-zoom */
	touch-action: none;
	touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
	-ms-touch-action: none;
	touch-action: none;
}
.leaflet-container {
	-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
	-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
	filter: inherit;
	visibility: hidden;
	}
.leaflet-tile-loaded {
	visibility: inherit;
	}
.leaflet-zoom-box {
	width: 0;
	height: 0;
	-moz-box-sizing: border-box;
	     box-sizing: border-box;
	z-index: 800;
	}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
	-moz-user-select: none;
	}

.leaflet-pane         { z-index: 400; }

.leaflet-tile-pane    { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane  { z-index: 500; }
.leaflet-marker-pane  { z-index: 600; }
.leaflet-tooltip-pane   { z-index: 650; }
.leaflet-popup-pane   { z-index: 700; }

.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg    { z-index: 200; }

.leaflet-vml-shape {
	width: 1px;
	height: 1px;
	}
.lvml {
	behavior: url(#default#VML);
	display: inline-block;
	position: absolute;
	}


/* control positioning */

.leaflet-control {
	position: relative;
	z-index: 800;
	pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
	pointer-events: auto;
	}
.leaflet-top,
.leaflet-bottom {
	position: absolute;
	z-index: 1000;
	pointer-events: none;
	}
.leaflet-top {
	top: 0;
	}
.leaflet-right {
	right: 0;
	}
.leaflet-bottom {
	bottom: 0;
	}
.leaflet-left {
	left: 0;
	}
.leaflet-control {
	float: left;
	clear: both;
	}
.leaflet-right .leaflet-control {
	float: right;
	}
.leaflet-top .leaflet-control {
	margin-top: 10px;
	}
.leaflet-bottom .leaflet-control {
	margin-bottom: 10px;
	}
.leaflet-left .leaflet-control {
	margin-left: 10px;
	}
.leaflet-right .leaflet-control {
	margin-right: 10px;
	}


/* zoom and fade animations */

.leaflet-fade-anim .leaflet-popup {
	opacity: 0;
	-webkit-transition: opacity 0.2s linear;
	   -moz-transition: opacity 0.2s linear;
	        transition: opacity 0.2s linear;
	}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
	opacity: 1;
	}
.leaflet-zoom-animated {
	-webkit-transform-origin: 0 0;
	    -ms-transform-origin: 0 0;
	        transform-origin: 0 0;
	}
svg.leaflet-zoom-animated {
	will-change: transform;
}

.leaflet-zoom-anim .leaflet-zoom-animated {
	-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
	   -moz-transition:    -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
	        transition:         transform 0.25s cubic-bezier(0,0,0.25,1);
	}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
	-webkit-transition: none;
	   -moz-transition: none;
	        transition: none;
	}

.leaflet-zoom-anim .leaflet-zoom-hide {
	visibility: hidden;
	}


/* cursors */

.leaflet-interactive {
	cursor: pointer;
	}
.leaflet-grab {
	cursor: -webkit-grab;
	cursor:    -moz-grab;
	cursor:         grab;
	}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
	cursor: crosshair;
	}
.leaflet-popup-pane,
.leaflet-control {
	cursor: auto;
	}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
	cursor: move;
	cursor: -webkit-grabbing;
	cursor:    -moz-grabbing;
	cursor:         grabbing;
	}

/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
	pointer-events: none;
	}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
	pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
	pointer-events: auto;
	}

/* visual tweaks */

.leaflet-container {
	background: #ddd;
	outline-offset: 1px;
	}
.leaflet-container a {
	color: #0078A8;
	}
.leaflet-zoom-box {
	border: 2px dotted #38f;
	background: rgba(255,255,255,0.5);
	}


/* general typography */
.leaflet-container {
	font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-size: 0.75rem;
	line-height: 1.5;
	}


/* general toolbar styles */

.leaflet-bar {
	box-shadow: 0 1px 5px rgba(0,0,0,0.65);
	border-radius: 4px;
	}
.leaflet-bar a {
	background-color: #fff;
	border-bottom: 1px solid #ccc;
	width: 26px;
	height: 26px;
	line-height: 26px;
	display: block;
	text-align: center;
	text-decoration: none;
	color: black;
	}
.leaflet-bar a,
.leaflet-control-layers-toggle {
	background-position: 50% 50%;
	background-repeat: no-repeat;
	display: block;
	}
.leaflet-bar a:hover,
.leaflet-bar a:focus {
	background-color: #f4f4f4;
	}
.leaflet-bar a:first-child {
	border-top-left-radius: 4px;
	border-top-right-radius: 4px;
	}
.leaflet-bar a:last-child {
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
	border-bottom: none;
	}
.leaflet-bar a.leaflet-disabled {
	cursor: default;
	background-color: #f4f4f4;
	color: #bbb;
	}

.leaflet-touch .leaflet-bar a {
	width: 30px;
	height: 30px;
	line-height: 30px;
	}
.leaflet-touch .leaflet-bar a:first-child {
	border-top-left-radius: 2px;
	border-top-right-radius: 2px;
	}
.leaflet-touch .leaflet-bar a:last-child {
	border-bottom-left-radius: 2px;
	border-bottom-right-radius: 2px;
	}

/* zoom control */

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
	font: bold 18px 'Lucida Console', Monaco, monospace;
	text-indent: 1px;
	}

.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out  {
	font-size: 22px;
	}


/* layers control */

.leaflet-control-layers {
	box-shadow: 0 1px 5px rgba(0,0,0,0.4);
	background: #fff;
	border-radius: 5px;
	}
.leaflet-control-layers-toggle {
	background-image: url("/vendor/leaflet/1.9.4/images/layers.png");
	width: 36px;
	height: 36px;
	}
.leaflet-retina .leaflet-control-layers-toggle {
	background-image: url("/vendor/leaflet/1.9.4/images/layers-2x.png");
	background-size: 26px 26px;
	}
.leaflet-touch .leaflet-control-layers-toggle {
	width: 44px;
	height: 44px;
	}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
	display: none;
	}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
	display: block;
	position: relative;
	}
.leaflet-control-layers-expanded {
	padding: 6px 10px 6px 6px;
	color: #333;
	background: #fff;
	}
.leaflet-control-layers-scrollbar {
	overflow-y: scroll;
	overflow-x: hidden;
	padding-right: 5px;
	}
.leaflet-control-layers-selector {
	margin-top: 2px;
	position: relative;
	top: 1px;
	}
.leaflet-control-layers label {
	display: block;
	font-size: 13px;
	font-size: 1.08333em;
	}
.leaflet-control-layers-separator {
	height: 0;
	border-top: 1px solid #ddd;
	margin: 5px -10px 5px -6px;
	}

/* Default icon URLs */
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
	background-image: url("/vendor/leaflet/1.9.4/images/marker-icon.png");
	}


/* attribution and scale controls */

.leaflet-container .leaflet-control-attribution {
	background: #fff;
	background: rgba(255, 255, 255, 0.8);
	margin: 0;
	}
.leaflet-control-attribution,
.leaflet-control-scale-line {
	padding: 0 5px;
	color: #333;
	line-height: 1.4;
	}
.leaflet-control-attribution a {
	text-decoration: none;
	}
.leaflet-control-attribution a:hover,
.leaflet-control-attribution a:focus {
	text-decoration: underline;
	}
.leaflet-attribution-flag {
	display: inline !important;
	vertical-align: baseline !important;
	width: 1em;
	height: 0.6669em;
	}
.leaflet-left .leaflet-control-scale {
	margin-left: 5px;
	}
.leaflet-bottom .leaflet-control-scale {
	margin-bottom: 5px;
	}
.leaflet-control-scale-line {
	border: 2px solid #777;
	border-top: none;
	line-height: 1.1;
	padding: 2px 5px 1px;
	white-space: nowrap;
	-moz-box-sizing: border-box;
	     box-sizing: border-box;
	background: rgba(255, 255, 255, 0.8);
	text-shadow: 1px 1px #fff;
	}
.leaflet-control-scale-line:not(:first-child) {
	border-top: 2px solid #777;
	border-bottom: none;
	margin-top: -2px;
	}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
	border-bottom: 2px solid #777;
	}

.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
	box-shadow: none;
	}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
	border: 2px solid rgba(0,0,0,0.2);
	background-clip: padding-box;
	}


/* popup */

.leaflet-popup {
	position: absolute;
	text-align: center;
	margin-bottom: 20px;
	}
.leaflet-popup-content-wrapper {
	padding: 1px;
	text-align: left;
	border-radius: 12px;
	}
.leaflet-popup-content {
	margin: 13px 24px 13px 20px;
	line-height: 1.3;
	font-size: 13px;
	font-size: 1.08333em;
	min-height: 1px;
	}
.leaflet-popup-content p {
	margin: 17px 0;
	margin: 1.3em 0;
	}
.leaflet-popup-tip-container {
	width: 40px;
	height: 20px;
	position: absolute;
	left: 50%;
	margin-top: -1px;
	margin-left: -20px;
	overflow: hidden;
	pointer-events: none;
	}
.leaflet-popup-tip {
	width: 17px;
	height: 17px;
	padding: 1px;

	margin: -10px auto 0;
	pointer-events: auto;

	-webkit-transform: rotate(45deg);
	   -moz-transform: rotate(45deg);
	    -ms-transform: rotate(45deg);
	        transform: rotate(45deg);
	}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
	background: white;
	color: #333;
	box-shadow: 0 3px 14px rgba(0,0,0,0.4);
	}
.leaflet-container a.leaflet-popup-close-button {
	position: absolute;
	top: 0;
	right: 0;
	border: none;
	text-align: center;
	width: 24px;
	height: 24px;
	font: 16px/24px Tahoma, Verdana, sans-serif;
	color: #757575;
	text-decoration: none;
	background: transparent;
	}
.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus {
	color: #585858;
	}
.leaflet-popup-scrolled {
	overflow: auto;
	}

.leaflet-oldie .leaflet-popup-content-wrapper {
	-ms-zoom: 1;
	}
.leaflet-oldie .leaflet-popup-tip {
	width: 24px;
	margin: 0 auto;

	-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
	filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
	}

.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
	border: 1px solid #999;
	}


/* div icon */

.leaflet-div-icon {
	background: #fff;
	border: 1px solid #666;
	}


/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
	position: absolute;
	padding: 6px;
	background-color: #fff;
	border: 1px solid #fff;
	border-radius: 3px;
	color: #222;
	white-space: nowrap;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	pointer-events: none;
	box-shadow: 0 1px 3px rgba(0,0,0,0.4);
	}
.leaflet-tooltip.leaflet-interactive {
	cursor: pointer;
	pointer-events: auto;
	}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
	position: absolute;
	pointer-events: none;
	border: 6px solid transparent;
	background: transparent;
	content: "";
	}

/* Directions */

.leaflet-tooltip-bottom {
	margin-top: 6px;
}
.leaflet-tooltip-top {
	margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
	left: 50%;
	margin-left: -6px;
	}
.leaflet-tooltip-top:before {
	bottom: 0;
	margin-bottom: -12px;
	border-top-color: #fff;
	}
.leaflet-tooltip-bottom:before {
	top: 0;
	margin-top: -12px;
	margin-left: -6px;
	border-bottom-color: #fff;
	}
.leaflet-tooltip-left {
	margin-left: -6px;
}
.leaflet-tooltip-right {
	margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
	top: 50%;
	margin-top: -6px;
	}
.leaflet-tooltip-left:before {
	right: 0;
	margin-right: -12px;
	border-left-color: #fff;
	}
.leaflet-tooltip-right:before {
	left: 0;
	margin-left: -12px;
	border-right-color: #fff;
	}

/* Printing */

@media print {
	/* Prevent printers from removing background-images of controls. */
	.leaflet-control {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		}
	}


/* /css/style.css?v=20261020-login-local */
/* ═══════════════════════════════════════════════════════════════
   Шериф-Балки Monitor — stylesheet
   InTek-style: light theme, red accents, rounded cards
   ═══════════════════════════════════════════════════════════════ */

/* cyrillic-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-0.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-1.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-2.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-3.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-4.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-5.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-0.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-1.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-2.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-3.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-4.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-5.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-0.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-1.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-2.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-3.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-4.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-5.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/vendor/fonts/font-6.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/vendor/fonts/font-7.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/vendor/fonts/font-8.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/vendor/fonts/font-9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/vendor/fonts/font-10.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════════════════════════════
   Тема «Ночная диспетчерская» — тёмный пульт по умолчанию.
   Токены сохраняют прежние имена, поэтому все компоненты
   перекрашиваются разом. Светлый режим — :root[data-theme="light"].
   Сигнатура интерфейса — янтарный маяк (--beacon).
   ═══════════════════════════════════════════════════════════════ */
:root {
  --sidebar-bg:     #0E1116;
  --sidebar-hover:  rgba(255,255,255,.06);
  --sidebar-active: #E30613;
  --sidebar-text:   #8B98A6;
  --sidebar-title:  #E6EDF3;

  --bg:             #0E1116;
  --bg-secondary:   #12161C;
  --card:           #161B22;
  --card-2:         #1B222C;
  --border:         #232B36;
  --border-light:   #1B222C;
  /* Алиасы — их использует легаси-код (ai.js/heatmap/perm), иначе светлые фоллбэки */
  --bg-card:        #161B22;
  --text-primary:   #E6EDF3;
  --surface:        #161B22;
  --hover:          #1B222C;
  --bg-hover:       #1B222C;
  --bg-active:      rgba(227,6,19,.16);

  --primary:        #FF4757;   /* INTEK-красный, осветлён для читаемости на тёмном */
  --primary-dark:   #E30613;   /* фирменный красный для заливок/бренда */
  --primary-light:  rgba(227,6,19,.16);
  --success:        #37D399;
  --success-bg:     rgba(55,211,153,.10);
  --warning:        #FFB020;   /* = янтарь маяка */
  --warning-bg:     rgba(255,176,32,.12);
  --danger:         #FF6470;
  --danger-bg:      rgba(227,6,19,.15);
  --info:           #3D82F6;
  --info-bg:        rgba(61,130,246,.12);
  --gray:           #6B7683;

  --overview-online:  #45a873;
  --overview-beacon:  #5d86bd;
  --overview-offline: #c85b64;
  --overview-warning: #bd8439;

  --text:           #E6EDF3;
  --text-secondary: #C3CCD6;
  --text-muted:     #8B98A6;
  --text-light:     #6B7683;

  /* Сигнатура — янтарный проблесковый маяк */
  --beacon:         #FFB020;
  --beacon-soft:    rgba(255,176,32,.14);
  --beacon-glow:    rgba(255,176,32,.50);

  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --shadow:         0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-card:    0 1px 2px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.02);
  --shadow-hover:   0 14px 44px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --font:           'Nunito', 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display:   'Bahnschrift', 'DIN Condensed', 'Oswald', 'Nunito', var(--font);
  --font-mono:      'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;

  --transition:     all 0.2s cubic-bezier(.4,0,.2,1);
  --spring:         all 0.35s cubic-bezier(.34,1.56,.64,1);
}

/* Helpdesk integration */
.helpdesk-card {
  overflow: hidden;
}

.helpdesk-card-header,
.helpdesk-picker-row,
.helpdesk-ticket-main,
.helpdesk-ticket-meta,
.helpdesk-pagination {
  display: flex;
  align-items: center;
}

.helpdesk-card-header {
  justify-content: space-between;
  gap: 12px;
}

.helpdesk-summary {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.helpdesk-body {
  min-height: 76px;
}

.helpdesk-state {
  padding: 22px 18px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.helpdesk-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.helpdesk-ticket:first-child {
  border-top: 0;
}

.helpdesk-ticket-main {
  min-width: 0;
  gap: 8px;
}

.helpdesk-ticket-id {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 12px;
}

.helpdesk-ticket-subject {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.helpdesk-ticket-meta {
  grid-column: 1;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--text-muted);
  font-size: 11px;
}

.helpdesk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  font-size: 11px;
}

.helpdesk-ticket-link {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  white-space: nowrap;
}

.helpdesk-pagination {
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.helpdesk-page-label {
  color: var(--text-muted);
  font-size: 12px;
}

.helpdesk-picker-row {
  gap: 8px;
}

.helpdesk-picker-row .input-field {
  min-width: 0;
}

.helpdesk-picker-selection {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.helpdesk-picker-selection.is-linked {
  color: #159447;
  font-weight: 600;
}

.helpdesk-picker-results {
  max-height: 210px;
  margin-top: 6px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}

.helpdesk-picker-option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.helpdesk-picker-option:last-child {
  border-bottom: 0;
}

.helpdesk-picker-option:hover {
  background: var(--bg-secondary);
}

.helpdesk-picker-option small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

.map-helpdesk {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.map-helpdesk-title {
  margin-bottom: 5px;
  font-weight: 700;
}

.map-helpdesk-ticket {
  display: flex;
  width: 100%;
  gap: 6px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.map-helpdesk-ticket:hover { color: var(--primary); }

.map-helpdesk-ticket span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-helpdesk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.map-helpdesk-row .map-helpdesk-title {
  flex: 0 0 auto;
  margin: 0;
}

.map-helpdesk-row .map-helpdesk-ticket {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  margin: 0;
}

.map-helpdesk-row .map-helpdesk-ticket span:first-child { flex: 0 0 auto; }
.map-helpdesk-empty { color: var(--text-muted); }

@media (max-width: 720px) {
  .helpdesk-ticket {
    grid-template-columns: minmax(0, 1fr);
  }

  .helpdesk-ticket-link {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .helpdesk-picker-row {
    flex-wrap: wrap;
  }
}

/* ── Светлый режим (дневная работа) ── */
:root[data-theme="light"] {
  --sidebar-bg:     #1D1D1B;
  --sidebar-text:   #8a8a94;
  --sidebar-title:  #f0f0f2;

  --bg:             #f2f3f5;
  --bg-secondary:   #e9ebee;
  --card:           #ffffff;
  --card-2:         #f7f8fa;
  --border:         #e2e4e8;
  --border-light:   #eef0f2;
  --bg-card:        #ffffff;
  --text-primary:   #0f1114;
  --surface:        #ffffff;
  --hover:          #f1f5f9;
  --bg-hover:       #eef2f7;
  --bg-active:      #fef2f2;

  --primary:        #E30613;
  --primary-dark:   #C50511;
  --primary-light:  #fef2f2;
  --success:        #1a9f4a;
  --success-bg:     #ecfdf5;
  --warning:        #d97706;
  --warning-bg:     #fffbeb;
  --danger:         #dc2626;
  --danger-bg:      #fef2f2;
  --info:           #2563eb;
  --info-bg:        #eff6ff;
  --gray:           #868c98;

  --overview-online:  #2f9e62;
  --overview-beacon:  #4f7fbd;
  --overview-offline: #c64f58;
  --overview-warning: #be7d2d;

  --text:           #0f1114;
  --text-secondary: #2b2f36;
  --text-muted:     #5f6672;
  --text-light:     #8a8f9a;

  --beacon:         #d97706;
  --beacon-soft:    rgba(217,119,6,.12);
  --beacon-glow:    rgba(217,119,6,.35);

  --shadow:         0 1px 3px rgba(17,17,20,.06), 0 1px 2px rgba(17,17,20,.04);
  --shadow-card:    0 1px 3px rgba(17,17,20,.05), 0 0 0 1px rgba(17,17,20,.03);
  --shadow-hover:   0 12px 40px rgba(17,17,20,.1), 0 2px 6px rgba(17,17,20,.06);
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  scroll-behavior: smooth;
}

.hidden { display: none !important; }
.mb-16 { margin-bottom: 16px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.2); }

/* ════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════ */
.login-screen {
  position: relative;
  min-height: 100dvh;
  padding: 28px;
  overflow-y: auto;
  color-scheme: light;
  background: #0e1116;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-screen::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  background: #e30613;
}

.login-card {
  width: min(100%, 430px);
  padding: 36px 38px 32px;
  border: 1px solid #dfe3e8;
  border-radius: 12px;
  color: #15181d;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0,0,0,.34);
}

.login-brand {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-icon {
  display: block;
  flex: 0 0 52px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(227,6,19,.20);
}

.login-brand-kicker {
  margin-bottom: 2px;
  color: #7a828e;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-brand h1 {
  color: #111318;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-brand > p {
  margin-top: 14px;
  color: #5f6672;
  font-size: 13px;
}

.login-form-heading {
  margin-bottom: 20px;
}

.login-form-heading h2 {
  color: #15181d;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.login-form-heading p {
  margin-top: 3px;
  color: #69717d;
  font-size: 12.5px;
}

.login-form .form-group {
  gap: 7px;
  margin-bottom: 16px;
}

.login-form .form-group label {
  color: #343a44;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #cbd1d9;
  border-radius: 7px;
  outline: none;
  color: #15181d;
  background: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  -webkit-text-fill-color: #15181d;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.login-form input:hover {
  border-color: #9fa7b3;
}

.login-form input:focus {
  border-color: #e30613;
  box-shadow: 0 0 0 3px rgba(227,6,19,.12);
}

.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #15181d;
  box-shadow: 0 0 0 1000px #ffffff inset;
}

.login-password-field {
  position: relative;
}

.login-password-field input {
  padding-right: 46px;
}

#password-input::-ms-reveal,
#password-input::-ms-clear { display: none; }

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: #69717d;
  background: transparent;
  cursor: pointer;
}

.login-password-toggle:hover {
  color: #15181d;
  background: #f0f2f5;
  transform: translateY(-50%);
}

.login-password-toggle:focus-visible {
  outline: 2px solid #e30613;
  outline-offset: 1px;
}

.login-password-toggle .ui-icon {
  width: 18px;
  height: 18px;
}

.login-form .btn-primary {
  min-height: 44px;
  margin-top: 4px;
  border-radius: 7px;
  color: #ffffff;
  background: #e30613;
  box-shadow: 0 5px 14px rgba(227,6,19,.20);
  font-size: 14px;
}

.login-form .btn-primary:hover {
  background: #c90511;
}

.login-form .btn-primary:disabled {
  cursor: wait;
  opacity: .7;
  transform: none;
}

.login-error {
  padding: 10px 12px;
  margin: 0 0 14px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #b4232c;
  background: #fff1f2;
  font-size: 13px;
}

/* ════════════════════════════════════════════
   APP LAYOUT
   ════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.beacon-icon-sm { font-size: 24px; flex-shrink: 0; }
.sidebar-title   { font-size: 15px; font-weight: 700; color: var(--sidebar-title); line-height: 1.2; letter-spacing: -0.4px; }
.sidebar-subtitle { font-size: 10.5px; color: var(--sidebar-text); font-weight: 400; letter-spacing: 0.02em; }

.sidebar-nav { flex: 1; padding: 12px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  border-radius: 8px;
  margin-bottom: 1px;
}

.nav-item svg { width: 18px; height: 18px; fill: none; flex-shrink: 0; opacity: .9; }

.nav-item:hover  { background: var(--sidebar-hover); color: #d0d0d6; }
.nav-item:active { transform: scale(.98); }
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 2px 12px rgba(200,25,31,.35), 0 0 0 1px rgba(200,25,31,.1);
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poller-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sidebar-text);
  padding: 4px 6px;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-width: 0;
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.page-title    { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.15; letter-spacing: -0.6px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 400; letter-spacing: 0.01em; }
.page-actions  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.last-update { font-size: 12px; color: var(--text-light); font-weight: 400; }

/* ════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-family: var(--font);
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: var(--primary-contrast, #fff); box-shadow: 0 1px 3px rgba(200,25,31,.25), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(200,25,31,.3); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: var(--danger-contrast, #fff); }
.btn-danger:hover { background: var(--danger-hover, #dc2626); }

.btn-danger-outline { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger-outline:hover { background: var(--danger-bg); }

.btn-outline { border-color: var(--border); color: var(--text-secondary); background: var(--card); }
.btn-outline:hover { border-color: var(--text-light); background: var(--bg); }

.btn-outline-light { border-color: rgba(255,255,255,.15); color: #a0a0a8; background: transparent; padding: 6px 10px; }
.btn-outline-light:hover { background: rgba(255,255,255,.08); color: #e0e0e0; }

.btn-ghost { background: transparent; border: none; color: var(--text-secondary); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); border-radius: var(--radius-sm); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

.btn-full { width: 100%; justify-content: center; }

.btn-beacon-on  { background: var(--success); color: var(--success-contrast, #fff); box-shadow: 0 2px 4px rgba(34,197,94,.2); }
.btn-beacon-on:hover { background: var(--success-hover, #16a34a); }
.btn-beacon-off { background: var(--danger); color: var(--danger-contrast, #fff); }
.btn-beacon-off:hover { background: var(--danger-hover, #dc2626); }

/* ════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input-field {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  transition: var(--transition);
  width: 100%;
  font-family: var(--font);
}
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200,25,31,.07); }

.input-sm {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  font-family: var(--font);
}
.input-sm:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(227,30,37,.08); }

.select-sm {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
  font-family: var(--font);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

/* ════════════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--card);
  border: none;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  border-left: 3px solid var(--gray);
  transition: var(--spring);
}
.kpi-btn { cursor: pointer; user-select: none; position: relative; }
.kpi-btn:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.kpi-btn:active { transform: translateY(0) scale(.98); }
.kpi-btn.active { outline: 2px solid var(--primary); outline-offset: -2px; }
.kpi-btn.active::after {
  content: '✕'; position: absolute; top: 6px; right: 8px;
  font-size: 10px; color: var(--text-muted); opacity: .6;
}
.kpi-card:hover { box-shadow: var(--shadow-hover); }
.kpi-success { border-left-color: var(--success); }
.kpi-danger  { border-left-color: var(--danger); }
.kpi-primary { border-left-color: var(--primary); }
.kpi-warning { border-left-color: var(--warning); }
.kpi-gray    { border-left-color: var(--gray); }

/* Показания пульта — цифра окрашена по смыслу */
.kpi-success .kpi-value { color: var(--success); }
.kpi-danger  .kpi-value { color: var(--danger); }
.kpi-warning .kpi-value { color: var(--warning); }

.kpi-value { font-family: var(--font-display); font-size: 36px; font-weight: 600; color: var(--text); line-height: 1; margin-bottom: 6px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }

/* ════════════════════════════════════════════
   SECTION HEADER
   ════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-header h3 { font-size: 16px; font-weight: 600; }
.section-header.collapsible:hover { opacity: 0.8; }
.collapse-arrow { display: inline-block; width: 16px; font-size: 12px; transition: transform 0.15s; }

/* ════════════════════════════════════════════
   DEVICE CARDS (DASHBOARD GRID)
   ════════════════════════════════════════════ */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
/* Dashboard edit mode */
.device-grid.dash-edit-mode .device-card {
  cursor: move;
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}
.device-grid.dash-edit-mode .device-card:hover {
  outline-color: var(--primary-dark, #c4181e);
}
.device-grid:not(.dash-edit-mode) .device-card .resize-handle,
.device-grid:not(.dash-edit-mode) .device-card .resize-handle-v,
.device-grid:not(.dash-edit-mode) .device-card .resize-reset {
  display: none;
}

.device-card {
  background: var(--card);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  cursor: pointer;
  transition: var(--spring);
  position: relative;
  display: flex;
  flex-direction: column;
}
.device-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.device-card:active {
  transform: translateY(0) scale(.99);
}
.device-card.stolen { opacity: .55; }

/* Цветная полоска-статус сверху карточки (читается с одного взгляда) */
.device-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--gray);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.device-card.s-on::before     { background: var(--success); }
.device-card.s-off::before    { background: var(--danger); }
.device-card.s-stolen::before { background: var(--gray); }

/* Сигнатура — карточка с включённым маяком светится янтарём */
.device-card.beacon-live::before { background: var(--beacon); }
.device-card.beacon-live {
  background:
    radial-gradient(150px 110px at 92% -10%, var(--beacon-soft), transparent 70%),
    var(--card);
  box-shadow: var(--shadow-card), inset 0 0 0 1px color-mix(in srgb, var(--beacon) 28%, transparent);
}

.device-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.device-card-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.3;
}
.device-card-road {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.device-card-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0;
}
.badge-success { background: var(--success-bg); color: var(--success); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 30%, transparent); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-primary { background: var(--primary-light); color: var(--primary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent); }
.badge-warning { background: var(--warning-bg); color: var(--warning); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent); }
.badge-gray    { background: var(--card-2); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }

.device-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 12px;
  flex: 1;
}
.metric { display: flex; flex-direction: column; }
.metric-label { font-size: 10.5px; color: var(--text-light); text-transform: uppercase; letter-spacing: .3px; }
.metric-value { font-size: 13.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.device-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 4px;
}

.card-actions { display: flex; gap: 6px; }

.beacon-mini {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.beacon-mini.on  { background: var(--beacon); animation: beacon-flash 1.4s ease-in-out infinite; box-shadow: 0 0 10px 2px var(--beacon-glow); }
.beacon-mini.off { background: var(--gray); opacity: .5; }
@keyframes beacon-flash { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .beacon-mini.on { animation: none; } }

/* ════════════════════════════════════════════
   BATTERY BAR
   ════════════════════════════════════════════ */
.battery-bar {
  height: 5px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.battery-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s, background .3s;
}

/* ════════════════════════════════════════════
   DOTS / STATUS INDICATORS
   ════════════════════════════════════════════ */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green  { background: var(--success); box-shadow: 0 0 4px var(--success); }
.dot-red    { background: var(--danger); }
.dot-gray   { background: var(--gray); }
.dot-pulse  { animation: pulse-dot 2s infinite; }

/* ════════════════════════════════════════════
   TABLE
   ════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--card);
  box-shadow: var(--shadow-card);
}

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

.data-table thead th {
  background: var(--card-2);
  color: var(--text-light);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
}

.table-sort-button::after {
  content: '↕';
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  opacity: .55;
}

th[aria-sort='ascending'] .table-sort-button,
th[aria-sort='descending'] .table-sort-button {
  color: var(--text);
}

th[aria-sort='ascending'] .table-sort-button::after {
  content: '↑';
  color: var(--primary);
  opacity: 1;
}

th[aria-sort='descending'] .table-sort-button::after {
  content: '↓';
  color: var(--primary);
  opacity: 1;
}

.table-sort-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--card-2); }
.data-table tbody tr.stolen { opacity: .55; }

.data-table td {
  padding: 11px 16px;
  color: var(--text);
  vertical-align: middle;
}

.tbl-device-name { font-weight: 600; cursor: pointer; color: var(--primary); }
.tbl-device-name:hover { text-decoration: underline; }

/* ════════════════════════════════════════════
   MAP
   ════════════════════════════════════════════ */
.map-container {
  height: calc(100vh - 160px);
  min-height: 400px;
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--card);
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Leaflet popup custom */
.leaflet-popup-content-wrapper { border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); }
.leaflet-popup-content-wrapper { background: var(--card); }
.leaflet-popup-content a.btn { color: #fff !important; text-decoration: none !important; }
.leaflet-popup-content a.btn-outline { color: var(--text) !important; }
.map-popup-title { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.map-popup-row   { font-size: 12px; color: var(--text-secondary); margin: 2px 0; }
.map-popup-buttons { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.map-popup-buttons .btn { font-size: 12px; padding: 5px 12px; font-weight: 600; }
.map-popup-buttons .btn-primary { background: var(--primary); color: var(--primary-contrast, #fff) !important; }
.map-popup-buttons .btn-success { background: var(--success); color: var(--success-contrast, #fff) !important; }
.map-popup-buttons .btn-danger  { background: var(--danger); color: var(--danger-contrast, #fff) !important; }
.btn-success { background: var(--success); color: var(--success-contrast, #fff); border: none; border-radius: 6px; cursor: pointer; }
.btn-success:hover { background: var(--success-hover, #15803d); }
.btn-danger  { background: var(--danger); color: var(--danger-contrast, #fff); border: none; border-radius: 6px; cursor: pointer; }
.btn-danger:hover  { background: var(--danger-hover, #dc2626); }

/* Custom marker */
.map-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: background .3s;
}
.map-marker-flash {
  animation: police-flash-marker 1s infinite !important;
}
@keyframes police-flash-marker {
  0%, 10%   { background: #2563eb !important; box-shadow: 0 0 8px rgba(37,99,235,.7), 0 1px 4px rgba(0,0,0,.3); }
  50%, 60%  { background: #ef4444 !important; box-shadow: 0 0 8px rgba(239,68,68,.7), 0 1px 4px rgba(0,0,0,.3); }
  100%      { background: #2563eb !important; box-shadow: 0 0 8px rgba(37,99,235,.7), 0 1px 4px rgba(0,0,0,.3); }
}
.map-marker-vehicle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid white;
  box-shadow: 0 1px 5px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-marker-camera {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid white;
  background: #f59e0b;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  line-height: 1;
}

.map-layer-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-right: 12px;
}
.map-toggle-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--card);
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  transition: all 0.15s;
  user-select: none;
}
.map-toggle-btn:last-child { border-right: none; }
.map-toggle-btn input { display: none; }
.map-toggle-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(227,30,37,.2);
}

/* Cameras: snapshots and AI telemetry share one operational surface. */
.cameras-page-header { margin-bottom: 12px; }
.cameras-page-header .btn { display: inline-flex; align-items: center; gap: 7px; }
.cameras-header-actions { display: flex; align-items: center; gap: 7px; }

.camera-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.camera-kpi {
  position: relative;
  display: grid;
  min-height: 92px;
  align-content: center;
  gap: 2px;
  padding: 13px 16px 12px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
}
.camera-kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.camera-kpi > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.camera-kpi > strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.05;
}
.camera-kpi > small { color: var(--text-muted); font-size: 10.5px; }
.camera-kpi-online::before { background: var(--success); }
.camera-kpi-online > strong { color: var(--success); }
.camera-kpi-info::before { background: var(--info); }
.camera-kpi-warning::before { background: var(--warning); }

.cameras-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
}
.cameras-filter-group,
.cameras-toolbar-right { display: flex; align-items: center; gap: 8px; }
.cameras-filter-group { flex: 1; min-width: 0; }
.cameras-toolbar .form-control {
  width: 210px;
  min-width: 0;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
.cameras-toolbar .cameras-search { width: min(320px, 32vw); }
.cameras-toolbar .map-layer-toggle { flex-shrink: 0; margin-right: 0; }
.cameras-results-count { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.cameras-filter-group #cam-filter-reset { width: 36px; height: 36px; flex: 0 0 36px; }
.active-filter-summary { padding: 8px 12px; margin: -4px 0 12px; border-left: 2px solid var(--info); color: var(--text-secondary); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.active-filter-summary[hidden] { display: none; }
.cameras-toolbar .form-control:focus-visible,
.helpdesk-native-filters :is(input, select):focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.cam-object {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cam-object:hover {
  border-color: color-mix(in srgb, var(--info) 34%, var(--border));
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.cam-object[hidden] { display: none; }
.cam-object-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 36px 22px;
  height: 82px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.cam-object-heading { display: contents; }
.cam-object-name {
  grid-column: 1 / -1;
  align-self: start;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}
.cam-object-district {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  display: block;
  margin-top: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cam-ai-state {
  grid-column: 2;
  grid-row: 2;
  flex-shrink: 0;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--card-2);
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}
.cam-ai-state.is-online { border-color: color-mix(in srgb, var(--success) 42%, var(--border)); color: var(--success); background: var(--success-bg); }
.cam-ai-state.is-offline { border-color: color-mix(in srgb, var(--danger) 38%, var(--border)); color: var(--danger); background: var(--danger-bg); }
.cam-ai-state.is-none { color: var(--text-muted); }
.cam-ai-state.is-loading { opacity: .75; }

.cam-object-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}
.cam-object-images { flex: 0 0 auto; }
.cam-cell-unavailable { cursor: default; }
.cam-cell {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: var(--bg);
  cursor: pointer;
}
.cam-cell:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
.cam-cell-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter .15s ease, transform .2s ease;
}
.cam-cell:hover .cam-cell-img { filter: brightness(.94); }
.cam-cell-noimg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-secondary);
  font-size: 11px;
}
.cam-cell-noimg[hidden] { display: none; }
.cam-cell-label,
.cam-cell-open {
  position: absolute;
  z-index: 1;
  padding: 3px 6px;
  border-radius: 3px;
  color: #fff;
  background: rgba(8,12,17,.68);
  font-size: 9.5px;
  font-weight: 700;
  pointer-events: none;
}
.cam-cell-label { top: 7px; left: 7px; }
.cam-cell-open { right: 10px; bottom: 10px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 50%; opacity: .85; transition: opacity .15s ease; }
.cam-cell:hover .cam-cell-open,
.cam-cell:focus-visible .cam-cell-open { opacity: 1; }

.cam-object-body { padding: 12px 14px; }
.cam-daily-analytics {
  min-width: 0;
}
.cam-daily-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 10px;
}
.cam-daily-heading span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.cam-daily-heading strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cam-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
}
.cam-category-grid > div {
  min-width: 0;
  padding: 0;
}
.cam-category-grid > div:last-child { border-right: 0; }
.cam-category-grid span { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: 11px; overflow-wrap: anywhere; }
.cam-category-grid span .ui-icon { width: 14px; height: 14px; }
.cam-category-grid strong { display: block; margin-top: 3px; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cam-weather-bar {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 10px;
}
.cam-weather-bar[hidden] { display: none; }
.cam-weather-bar time,
.cam-weather-meta { margin-left: auto; white-space: nowrap; }
.cam-weather-condition { color: var(--text-secondary); font-weight: 700; }
.cam-weather-surface { color: var(--text-muted); }
.cam-weather-stale { color: var(--warning); font-weight: 700; }
.cam-weather-empty { color: var(--text-muted); }

.cam-object-actions {
  display: flex;
  margin-top: auto;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.cam-object-actions .btn { min-height: 36px; font-size: 12px; }
.cam-object-actions .cam-refresh-btn { width: 36px; flex-shrink: 0; margin-left: auto; padding: 5px; }
.cam-object-actions .cam-refresh-btn .ui-icon { width: 14px; height: 14px; }
.cam-object-actions .btn:disabled { opacity: .42; cursor: default; }
.cameras-empty {
  grid-column: 1 / -1;
  padding: 46px 20px;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  text-align: center;
}
.cameras-empty[hidden] { display: none; }

.cameras-grid-compact { grid-template-columns: repeat(auto-fill, minmax(315px, 1fr)); gap: 8px; }
.cameras-grid-compact .cam-object-header { height: 78px; padding: 8px 10px; }
.cameras-grid-compact .cam-object-body { display: none; }
.cameras-grid-compact .cam-object-actions { padding: 7px 10px; }

@media (max-width: 1050px) {
  .camera-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cameras-toolbar { align-items: stretch; flex-direction: column; }
  .cameras-toolbar-right { justify-content: space-between; }
  .cameras-filter-group > * { flex: 1; }
  .cameras-toolbar .cameras-search { width: auto; }
}

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

@container (max-width: 440px) {
  .cam-object-images { grid-template-columns: 1fr; }
  .cam-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .camera-kpis { gap: 7px; }
  .camera-kpi { min-height: 78px; padding: 10px 10px 9px 13px; }
  .camera-kpi > strong { font-size: 22px; }
  .cameras-filter-group { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .cameras-filter-group .cameras-search { grid-column: 1 / -1; width: 100%; }
  .cameras-toolbar .form-control { width: 100%; }
  .cameras-results-count { display: none; }
  .cameras-toolbar-right .map-layer-toggle { width: 100%; }
  .cameras-toolbar-right .map-toggle-btn { flex: 1; text-align: center; }
  .cam-object-header { align-items: flex-start; }
  .cam-object-name { white-space: normal; }
  .cam-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cam-weather-bar { align-items: flex-start; flex-wrap: wrap; gap: 4px 10px; }
  .cam-weather-meta { width: 100%; margin-left: 0; }
  .cam-object-actions .btn:not(.cam-refresh-btn) { flex: 1; }
}

.camera-slideshow-settings-overlay { z-index: 10020; }
.camera-slideshow-settings-card { width: min(430px, calc(100vw - 24px)); }
.camera-slideshow-settings-fields {
  display: grid;
  gap: 14px;
  padding: 18px 20px 4px;
}
.camera-slideshow-settings-fields .form-group { margin: 0; }
.camera-slideshow-settings-fields .form-group > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.camera-slideshow-settings-card .modal-actions { padding: 16px 20px 20px; }

.camera-slideshow-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 3px;
  color: var(--text);
  background: var(--bg);
}
.camera-slideshow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.camera-slideshow-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.camera-slideshow-title strong { font-family: var(--font-display); font-size: 19px; }
.camera-slideshow-title span { color: var(--text-muted); font-size: 11px; }
.camera-slideshow-controls { display: flex; align-items: center; gap: 6px; }
.camera-slideshow-controls > span {
  min-width: 44px;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}
.camera-slideshow-controls button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  background: var(--card-2);
  cursor: pointer;
}
.camera-slideshow-controls button:hover { border-color: var(--info); color: var(--text); }
.camera-slideshow-controls .ui-icon { width: 16px; height: 16px; }
.camera-slideshow-grid {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}
.camera-slideshow-grid[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.camera-slideshow-grid[data-columns="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.camera-slideshow-grid[data-columns="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.camera-slide-item {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}
.camera-slide-item > header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
}
.camera-slide-item > header > div { min-width: 0; }
.camera-slide-item > header strong,
.camera-slide-item > header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-slide-item > header strong { font-size: 11px; }
.camera-slide-item > header small { margin-top: 2px; color: var(--text-muted); font-size: 8.5px; }
.camera-slide-item > header > span {
  flex-shrink: 0;
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--text-muted);
  background: var(--card-2);
  font-size: 8.5px;
}
.camera-slide-item > header > span.is-online { color: var(--success); background: var(--success-bg); }
.camera-slide-item > header > span.is-offline { color: var(--danger); background: var(--danger-bg); }
.camera-slide-images {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}
.camera-slide-images-1 { grid-template-columns: 1fr; }
.camera-slide-images > div { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-secondary); }
.camera-slide-images img { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-slide-images span {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
  background: rgba(8,12,17,.68);
  font-size: 8.5px;
  font-weight: 700;
}
.camera-slide-item > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 8.5px;
}
.camera-slide-item > footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-slide-item > footer strong { flex-shrink: 0; color: var(--text-secondary); font-size: 9px; }
.camera-slideshow-progress { overflow: hidden; background: var(--border); }
.camera-slideshow-progress span { display: block; width: 0; height: 100%; background: var(--primary); }

@media (max-width: 900px) {
  .camera-slideshow-grid[data-columns] { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; }
  .camera-slideshow-grid { grid-auto-rows: minmax(230px, 1fr); }
}

@media (max-width: 560px) {
  .cameras-page-header { align-items: flex-start; }
  .cameras-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .camera-slideshow-overlay { grid-template-rows: auto minmax(0, 1fr) 3px; }
  .camera-slideshow-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  .camera-slideshow-controls { width: 100%; justify-content: flex-end; }
  .camera-slideshow-grid[data-columns] { grid-template-columns: 1fr; }
  .camera-slideshow-grid { overflow-y: auto; }
}

.camera-player-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(5, 8, 12, .94);
}
.camera-player {
  width: min(1800px, 100%);
  height: calc(100vh - 24px);
  min-height: 520px;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto;
  overflow: hidden;
  background: #111820;
  border: 1px solid #283441;
  border-radius: 6px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .55);
}
.camera-player-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid #26313d;
  color: #eef3f8;
}
.camera-player-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.camera-player-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-player-title span {
  flex: 0 0 auto;
  font-size: 11px;
  color: #8998a8;
}
.camera-player-modes {
  display: flex;
  height: 32px;
  overflow: hidden;
  border: 1px solid #344250;
  border-radius: 5px;
}
.camera-player-mode {
  min-width: 84px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid #344250;
  background: #17202a;
  color: #aab7c5;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.camera-player-mode:last-child { border-right: 0; }
.camera-player-mode.active {
  background: #e31e25;
  color: #fff;
}
.camera-player-close {
  display: inline-grid;
  justify-self: end;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aab7c5;
  place-items: center;
  border-radius: 6px;
  cursor: pointer;
}
.camera-player-close:hover { color: #fff; background: rgba(255,255,255,.08); }
.camera-player-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #070b10;
}
.camera-player-video,
.camera-player-mjpeg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #070b10;
}
.camera-player-mjpeg[hidden] { display: none; }
.camera-player-video[hidden] { display: none; }
.camera-player-loading {
  position: absolute;
  left: 50%;
  bottom: 18px;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(13, 19, 26, .88);
  color: #d6dee7;
  font-size: 12px;
  pointer-events: none;
}
.camera-player-loading.is-error { color: #ff8d92; }
.camera-archive-panel {
  padding: 10px 14px 12px;
  border-top: 1px solid #26313d;
  background: #141c25;
  color: #d8e0e8;
}
.camera-archive-panel[hidden] { display: none; }
.camera-archive-toolbar {
  min-height: 48px;
  display: flex;
  align-items: end;
  gap: 10px;
}
.camera-archive-field,
.camera-archive-speed {
  display: grid;
  gap: 3px;
}
.camera-archive-field > span,
.camera-archive-speed > span {
  color: #8291a0;
  font-size: 10px;
}
.camera-archive-day-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 1px solid #344250;
  border-radius: 5px;
  background: #101821;
  color: #dbe4ed;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.camera-archive-day-button:hover:not(:disabled) {
  border-color: #607286;
  background: #1d2935;
}
.camera-archive-day-button:disabled {
  opacity: .35;
  cursor: default;
}
.camera-archive-field .form-control {
  width: 148px;
  height: 32px;
  border-color: #344250;
  background: #0f161e;
  color: #edf2f7;
  font-size: 12px;
}
.camera-archive-time-field .form-control { width: 116px; }
.camera-archive-open {
  height: 32px;
  padding: 0 16px;
  border-radius: 5px;
}
.camera-archive-days,
.camera-archive-current {
  align-self: center;
  color: #8291a0;
  font-size: 11px;
  white-space: nowrap;
}
.camera-archive-current {
  margin-left: auto;
  color: #e4eaf0;
  font-variant-numeric: tabular-nums;
}
.camera-archive-controls {
  display: flex;
  align-items: end;
  gap: 6px;
  margin-top: 8px;
}
.camera-player-icon {
  width: 38px;
  height: 34px;
  padding: 0;
  border: 1px solid #344250;
  border-radius: 5px;
  background: #101821;
  color: #dbe4ed;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.camera-player-icon:hover {
  border-color: #607286;
  background: #1d2935;
}
.camera-player-jump {
  width: 46px;
  font-size: 11px;
}
.camera-player-play {
  border-color: #e31e25;
  background: #e31e25;
  color: #fff;
}
.camera-player-play:hover {
  border-color: #f0444a;
  background: #f0444a;
}
.camera-archive-speed {
  width: 88px;
  margin-left: 8px;
}
.camera-archive-speed .form-control {
  height: 34px;
  border-color: #344250;
  background: #0f161e;
  color: #edf2f7;
  font-size: 12px;
}
.camera-archive-timeline-wrap {
  position: relative;
  margin-top: 8px;
}
.camera-archive-timeline {
  width: 100%;
  height: 36px;
  display: block;
  cursor: zoom-in;
  touch-action: none;
}
.camera-archive-timeline.is-panning { cursor: grabbing; }
.camera-archive-tooltip {
  position: absolute;
  z-index: 2;
  top: -25px;
  transform: translateX(-50%);
  padding: 3px 6px;
  border: 1px solid #455465;
  border-radius: 4px;
  background: #0a1017;
  color: #f2f5f8;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.camera-archive-hours {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
  color: #718091;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.camera-archive-legend {
  display: flex;
  gap: 14px;
  margin-top: 3px;
  color: #8291a0;
  font-size: 10px;
}
.camera-archive-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.camera-archive-legend i {
  width: 12px;
  height: 4px;
  display: inline-block;
}
.camera-archive-record-mark { background: #3b82f6; }
.camera-archive-motion-mark { background: #f59e0b; }

@media (max-width: 760px) {
  .camera-player-overlay { padding: 0; }
  .camera-player {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  .camera-player-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 0 8px;
  }
  .camera-player-title span { display: none; }
  .camera-player-mode {
    min-width: 62px;
    padding: 0 8px;
  }
  .camera-player-modes { height: 40px; }
  .camera-player-close { width: 40px; height: 40px; }
  .camera-archive-panel {
    max-height: 230px;
    overflow-y: auto;
    padding: 8px;
  }
  .camera-archive-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
  }
  .camera-archive-field { flex: 1 1 120px; }
  .camera-archive-field .form-control,
  .camera-archive-time-field .form-control {
    width: 100%;
    height: 40px;
  }
  .camera-archive-day-button,
  .camera-archive-open,
  .camera-player-icon,
  .camera-archive-speed .form-control { height: 40px; }
  .camera-archive-day-button { width: 40px; flex-basis: 40px; }
  .camera-player-icon { width: 40px; }
  .camera-archive-days { display: none; }
  .camera-archive-current {
    width: 100%;
    margin-left: 0;
  }
}

.ai-weather-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 176px;
  padding: 14px 16px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ai-weather-card.is-stale { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.ai-weather-card-name {
  min-height: 30px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ai-weather-card-condition {
  overflow: hidden;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ai-weather-card-details {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}
.ai-weather-card-evidence {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ai-weather-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 10px;
}
.ai-weather-confidence { font-size: 11px; }
.ai-weather-confidence.is-high { color: var(--success); }
.ai-weather-confidence.is-medium { color: var(--warning); }
.ai-weather-confidence.is-low { color: var(--danger); }

.ai-weather-history {
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ai-weather-history-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.ai-weather-history-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}
.ai-weather-history-header p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}
.ai-weather-history-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}
.ai-weather-history-filter {
  display: grid;
  gap: 4px;
  min-width: min(300px, 32vw);
}
.ai-weather-history-filter > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.ai-weather-history-filter select {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-weather-history-filter select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.ai-weather-periods {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-weather-periods button {
  min-width: 68px;
  padding: 0 10px;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  background: var(--card-2);
  border: 0;
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.ai-weather-periods button:last-child { border-right: 0; }
.ai-weather-periods button:hover { color: var(--text); background: var(--hover); }
.ai-weather-periods button.active {
  color: #fff;
  background: var(--primary-dark);
}
.ai-weather-history-refresh {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-secondary);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.ai-weather-history-refresh:hover {
  color: var(--text);
  background: var(--hover);
  border-color: var(--text-muted);
}
.ai-weather-history-refresh:focus-visible,
.ai-weather-periods button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.ai-weather-history[aria-busy="true"] .ai-weather-history-refresh {
  color: var(--text-muted);
  cursor: wait;
}
.ai-weather-history-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.ai-weather-history-state.is-error { color: var(--danger); }
.ai-weather-history-state[hidden],
.ai-weather-history-content[hidden],
.ai-weather-object-summary[hidden] { display: none; }
.ai-weather-history-content { min-width: 0; }
.ai-weather-object-summary {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--border);
}
.ai-weather-summary-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ai-weather-summary-heading h5,
.ai-weather-chart-heading h5 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.ai-weather-summary-heading span,
.ai-weather-chart-heading span {
  color: var(--text-muted);
  font-size: 10px;
}
.ai-weather-summary-table-wrap {
  width: 100%;
  max-height: 320px;
  overflow-x: auto;
  overflow-y: auto;
}
.ai-weather-summary-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 11px;
}
.ai-weather-summary-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 7px 10px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.ai-weather-summary-table td {
  padding: 9px 10px;
  color: var(--text-secondary);
  vertical-align: top;
  border-bottom: 1px solid var(--border-light);
}
.ai-weather-summary-table tbody tr:last-child td { border-bottom: 0; }
.ai-weather-summary-table td:first-child {
  max-width: 280px;
  color: var(--text);
  font-weight: 700;
}
.ai-lane-empty {
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.ai-lane-table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
}
.ai-lane-table-meta span:first-child {
  color: var(--text);
  font-weight: 700;
}
.ai-lane-table-wrap {
  width: 100%;
  max-height: min(68vh, 760px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-lane-table {
  width: 100%;
  min-width: 1120px;
  border-spacing: 0;
  border-collapse: separate;
  color: var(--text);
  font-size: 12px;
}
.ai-lane-table th,
.ai-lane-table td {
  height: 42px;
  padding: 8px 12px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.ai-lane-table th:last-child,
.ai-lane-table td:last-child {
  border-right: 0;
}
.ai-lane-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  background: var(--card-2);
}
.ai-lane-table thead th:first-child {
  z-index: 5;
  left: 0;
  min-width: 260px;
}
.ai-lane-table tbody + tbody tr:first-child > * {
  border-top: 1px solid var(--border);
}
.ai-lane-table tbody tr:hover td,
.ai-lane-table tbody tr:hover .ai-lane-zone {
  background: var(--card-2);
}
.ai-lane-object {
  position: sticky;
  z-index: 2;
  left: 0;
  width: 260px;
  min-width: 260px;
  max-width: 320px;
  color: var(--text);
  text-align: left;
  vertical-align: top !important;
  background: var(--card);
  box-shadow: 1px 0 0 var(--border);
}
.ai-lane-object-name,
.ai-lane-object-total {
  display: block;
}
.ai-lane-object-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ai-lane-object-total {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.ai-lane-zone {
  min-width: 170px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  background: var(--card);
}
.ai-lane-zone-marker {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  background: var(--lane-color);
  border-radius: 2px;
}
.ai-lane-number {
  min-width: 88px;
  font-variant-numeric: tabular-nums;
  text-align: right !important;
  white-space: nowrap;
}
.ai-lane-total {
  color: var(--lane-color, var(--text));
  font-size: 13px;
  font-weight: 800;
}
.ai-lane-share-cell {
  min-width: 112px;
  white-space: nowrap;
}
.ai-lane-share-value {
  display: inline-block;
  width: 34px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ai-lane-share-track {
  display: inline-block;
  width: 54px;
  height: 5px;
  margin-left: 7px;
  overflow: hidden;
  vertical-align: middle;
  background: var(--card-2);
  border-radius: 2px;
}
.ai-lane-share-track > span {
  display: block;
  height: 100%;
  background: var(--lane-color);
}
.ai-lane-table tfoot th,
.ai-lane-table tfoot td {
  position: sticky;
  z-index: 3;
  bottom: 0;
  font-weight: 800;
  background: var(--card-2);
  border-bottom: 0;
}
.ai-lane-table tfoot th {
  z-index: 4;
  left: 0;
  text-align: left;
}
.ai-lane-share-total {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.ai-gost-table {
  min-width: 860px;
}
.ai-gost-table tbody tr:hover td,
.ai-gost-table tbody tr:hover .ai-gost-object {
  background: var(--card-2);
}
.ai-gost-object {
  vertical-align: middle !important;
}
.ai-gost-total {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}
.ai-gost-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.ai-gost-heading > span {
  width: 8px;
  min-width: 8px;
  height: 8px;
  background: var(--gost-color);
  border-radius: 2px;
}
.ai-gost-category-cell {
  min-width: 126px;
  padding: 0 !important;
}
.ai-gost-filter-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  min-height: 41px;
  padding: 8px 12px;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.ai-gost-filter-cell:hover {
  background: var(--card-2);
}
.ai-gost-filter-cell:focus-visible {
  outline: 2px solid var(--gost-color);
  outline-offset: -2px;
}
.ai-gost-filter-cell.is-active {
  background: var(--card-2);
  box-shadow: inset 3px 0 0 var(--gost-color);
}
.ai-gost-filter-cell:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.55;
}
.ai-gost-cell-count {
  min-width: 42px;
  color: var(--gost-color);
  font-size: 13px;
  font-weight: 800;
}
.ai-gost-filter-cell:disabled .ai-gost-cell-count {
  color: var(--text-muted);
}
.ai-gost-cell-share {
  min-width: 34px;
  color: var(--text-muted);
  font-size: 10px;
}
.ai-gost-footer-cell {
  color: var(--gost-color);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.ai-gost-footer-cell strong {
  margin-right: 8px;
  font-size: 13px;
}
.ai-gost-footer-cell span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}
.ai-gost-standard-header,
.ai-gost-hourly-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.ai-gost-standard-header > div,
.ai-gost-hourly-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ai-gost-standard-header strong,
.ai-gost-hourly-header strong {
  color: var(--text);
  font-size: 13px;
}
.ai-gost-standard-header span,
.ai-gost-hourly-header span {
  color: var(--text-muted);
  font-size: 11px;
}
.ai-gost-standard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-gost-standard-metric {
  display: flex;
  min-width: 0;
  min-height: 86px;
  padding: 11px 12px;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ai-gost-standard-metric > span,
.ai-gost-standard-metric > small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
}
.ai-gost-standard-metric > strong {
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ai-gost-verification {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 8px 10px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  background: color-mix(in srgb, #f59e0b 8%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 36%, var(--border));
  border-radius: 5px;
}
.ai-gost-verification-mark {
  display: inline-grid;
  width: 20px;
  min-width: 20px;
  height: 20px;
  place-items: center;
  color: #f59e0b;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #f59e0b;
  border-radius: 50%;
}
.ai-gost-hourly-header {
  align-items: center;
  padding-top: 2px;
}
.ai-gost-hourly-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-gost-hourly-controls label {
  display: flex;
  color: var(--text-muted);
  font-size: 10px;
  flex-direction: column;
  gap: 3px;
}
.ai-gost-hourly-controls select {
  width: min(290px, 42vw);
  height: 32px;
  padding: 0 28px 0 9px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.ai-gost-hourly-controls label:last-child select {
  width: 132px;
}
.ai-gost-hourly-wrap {
  max-height: 420px;
  margin-bottom: 18px;
}
.ai-gost-hourly-table {
  min-width: 900px;
}
.ai-gost-hourly-table td:first-child {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .ai-lane-table-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .ai-lane-table-wrap {
    max-height: 62vh;
  }
  .ai-lane-table {
    min-width: 980px;
    font-size: 11px;
  }
  .ai-lane-table thead th:first-child,
  .ai-lane-object {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
  }
  .ai-lane-table th,
  .ai-lane-table td {
    padding: 7px 9px;
  }
  .ai-lane-number {
    min-width: 76px;
  }
  .ai-gost-table {
    min-width: 760px;
  }
  .ai-gost-category-cell {
    min-width: 112px;
  }
  .ai-gost-standard-header,
  .ai-gost-hourly-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .ai-gost-hourly-controls {
    width: 100%;
  }
  .ai-gost-hourly-controls label:first-child {
    min-width: 0;
    flex: 1;
  }
  .ai-gost-hourly-controls select {
    width: 100%;
  }
}
.ai-weather-state-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 118px;
  line-height: 1.55;
  white-space: nowrap;
}
.ai-weather-state-label > span {
  width: 7px;
  min-width: 7px;
  height: 7px;
  background: var(--weather-state-color);
  border-radius: 50%;
}
.ai-weather-history-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ai-weather-chart-panel {
  min-width: 0;
  padding: 16px 18px 18px;
}
.ai-weather-chart-panel + .ai-weather-chart-panel {
  border-left: 1px solid var(--border);
}
.ai-weather-chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  margin-bottom: 10px;
}
.ai-weather-chart-heading span { text-align: right; }
.ai-weather-chart-canvas {
  position: relative;
  width: 100%;
  height: 300px;
}
.ai-weather-chart-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1100px) {
  .ai-weather-history-header { align-items: stretch; flex-direction: column; }
  .ai-weather-history-controls { justify-content: flex-start; }
  .ai-weather-history-filter { flex: 1; min-width: 220px; }
  .ai-weather-history-charts { grid-template-columns: 1fr; }
  .ai-weather-chart-panel + .ai-weather-chart-panel {
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .ai-weather-history-header,
  .ai-weather-object-summary,
  .ai-weather-chart-panel { padding-right: 12px; padding-left: 12px; }
  .ai-weather-history-controls {
    display: grid;
    grid-template-columns: 1fr 34px;
    align-items: end;
  }
  .ai-weather-history-filter { grid-column: 1 / -1; min-width: 0; }
  .ai-weather-periods { grid-template-columns: repeat(3, 1fr); }
  .ai-weather-periods button { min-width: 0; padding: 0 7px; }
  .ai-weather-summary-heading,
  .ai-weather-chart-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .ai-weather-chart-heading span { text-align: left; }
  .ai-weather-chart-canvas { height: 260px; }
}

/* Device detail admin settings */
.detail-settings-panel {
  margin-bottom: 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
}
.detail-settings-body { padding: 16px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.settings-grid .form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: block;
}
.settings-grid .form-group input,
.settings-grid .form-group select {
  width: 100%;
}

/* ════════════════════════════════════════════
   DEVICE DETAIL — NEW LAYOUT (sidebar + hero + unified period)
   ════════════════════════════════════════════ */
.view-dd { padding: 0 !important; }

.dd-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--topbar-h, 56px));
  align-items: stretch;
}
.dd-layout.dd-sidebar-collapsed { grid-template-columns: 44px 1fr; }

/* ── Sidebar ── */
.dd-sidebar {
  background: var(--bg-secondary, #f8fafc);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - var(--topbar-h, 56px));
}
.dd-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.dd-sidebar-title { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.dd-layout.dd-sidebar-collapsed .dd-sidebar-title,
.dd-layout.dd-sidebar-collapsed .dd-sidebar-filters,
.dd-layout.dd-sidebar-collapsed .dd-sidebar-list,
.dd-layout.dd-sidebar-collapsed .dd-sidebar-footer { display: none; }
.dd-layout.dd-sidebar-collapsed #dd-sidebar-toggle { transform: rotate(180deg); margin: 0 auto; }

.dd-sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.dd-sidebar-filters input,
.dd-sidebar-filters select { width: 100%; font-size: 12px; }

.dd-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.dd-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13px;
  color: var(--text, #111827);
  transition: background 120ms;
}
.dd-sidebar-item:hover { background: var(--card-2); }
.dd-sidebar-item.active {
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 600;
}
.dd-sidebar-item .dd-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray);
}
.dd-sidebar-item .dd-dot.online  { background: #16a34a; box-shadow: 0 0 0 2px #16a34a22; }
.dd-sidebar-item .dd-dot.offline { background: #dc2626; }
.dd-sidebar-item .dd-dot.beacon  { background: #2563eb; box-shadow: 0 0 0 2px #2563eb33; }
.dd-sidebar-item .dd-dot.stolen  { background: #6b7280; }
.dd-sidebar-item .dd-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-sidebar-item .dd-sub { font-size: 10px; color: var(--text-muted); }

.dd-sidebar-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Main column ── */
.dd-main {
  padding: 16px 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dd-main .page-header { margin-bottom: 0; }

/* ── Compact title strip ── */
.dd-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 4px;
}
.dd-titlebar-text { flex: 1; min-width: 0; }
.dd-titlebar-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.dd-titlebar-sub {
  font-size: 11px;
  margin: 0;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-titlebar-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Hero bar (sticky status) ── */
.dd-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dd-hero-beacon {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border);
  min-width: 0;
}
.dd-hero-beacon.beacon-on {
  background: var(--success-bg);
  border-color: var(--success);
}
.dd-hero-beacon.beacon-off {
  background: var(--warning-bg);
  border-color: var(--warning);
}
.dd-hero-beacon .beacon-light {
  width: 28px; height: 28px; flex-shrink: 0;
  /* Tame the police-flash-large animation inside the compact chip:
     shrink the spread and clip any overflow. */
  animation-name: police-flash-hero !important;
}
.dd-hero-beacon { overflow: hidden; }
@keyframes police-flash-hero {
  0%, 10%   { background: #2563eb; box-shadow: 0 0 6px rgba(37,99,235,.5); }
  25%       { background: #1e40af; box-shadow: 0 0 3px rgba(37,99,235,.2); }
  50%, 60%  { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.5); }
  75%       { background: #dc2626; box-shadow: 0 0 3px rgba(239,68,68,.2); }
  100%      { background: #2563eb; box-shadow: 0 0 6px rgba(37,99,235,.5); }
}
.dd-hero-beacon-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  white-space: nowrap;
}

.dd-hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 4px 14px;
  min-width: 0;
}
.dd-metric { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dd-metric-key {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.dd-metric-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-metric-bar {
  height: 3px;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.dd-metric-bar .battery-bar-fill { height: 100%; transition: width .4s; }

/* ── Toolbar: controls + period ── */
.dd-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
}
.dd-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.dd-toolbar-controls .input-sm { width: 44px; padding: 3px 6px; }
.dd-toolbar-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.dd-toolbar-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.dd-toolbar-period {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.dd-toolbar-period .input-sm { padding: 3px 6px; font-size: 11px; }
.dd-cmd-status { padding: 4px 10px; border-radius: 6px; font-size: 11px; width: 100%; }
.dd-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  background: color-mix(in srgb, var(--card) 60%, transparent);
  pointer-events: none;
}
.dd-period-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.dd-period-btns { display: flex; gap: 4px; }
.dd-period-btn.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.dd-period-custom { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 11px; color: var(--text-muted); }
.dd-period-custom input { font-size: 12px; }
.dd-zoom-label { font-size: 11px; color: var(--text-muted); }

/* ── Chart card + timeline ── */
.dd-card-chart .dd-chart-wrap {
  position: relative;
  height: 300px;
  padding: 8px 12px 0;
}
.dd-card-timeline .timeline-container { padding: 0 0 6px; }

/* ── Logs row (events + commands side by side) ── */
.dd-logs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dd-card-log .dd-log-body {
  max-height: 420px;
  min-height: 260px;
  overflow-y: auto;
}
.dd-card-log .data-table th {
  position: sticky; top: 0; background: var(--card); z-index: 1;
}

/* ── Collapsible info accordion ── */
.dd-info-accordion { padding: 0; }
.dd-info-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dd-info-accordion > summary::-webkit-details-marker { display: none; }
.dd-info-accordion > summary::before {
  content: '▸';
  color: var(--text-muted);
  transition: transform .2s;
}
.dd-info-accordion[open] > summary::before { transform: rotate(90deg); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .dd-hero { grid-template-columns: 1fr; }
  .dd-toolbar { flex-direction: column; align-items: stretch; }
  .dd-toolbar-period { margin-left: 0; }
  .dd-logs-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dd-layout { grid-template-columns: 1fr; }
  .dd-sidebar { position: static; height: auto; max-height: 240px; }
}

/* ════════════════════════════════════════════
   DEVICE DETAIL — LEGACY (kept for back-compat)
   ════════════════════════════════════════════ */
.detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  align-content: flex-start;
}

.detail-grid > .card {
  flex: 1 1 280px;
  min-width: 200px;
  max-width: 100%;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Cards with manual width from resize or span buttons */
.detail-grid > .card[style*="width"] {
  flex: 0 0 auto;
}

/* Stacked column for events + commands */
.detail-stack {
  flex: 1 1 280px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-stack > .card {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.card-compact .card-header { padding: 8px 12px; font-size: 13px; }
.card-compact .table-wrapper { font-size: 12px; }
.card-compact .data-table th,
.card-compact .data-table td { padding: 4px 8px; }

/* Chart cards default to full width */
.detail-chart-card {
  flex: 1 1 100% !important;
  min-width: 100%;
}
/* But allow chart cards to be resized narrower */
.detail-chart-card[style*="width"] {
  flex: 0 0 auto !important;
  min-width: 200px;
}

/* Width presets via data attribute */
.detail-grid > .card[data-col-span="1"] { flex: 0 0 calc(33.333% - 11px); }
.detail-grid > .card[data-col-span="2"] { flex: 0 0 calc(50% - 8px); }
.detail-grid > .card[data-col-span="3"] { flex: 0 0 calc(100%); }
.detail-grid > .card[data-col-span][style*="width"] { flex: 0 0 auto; }

@media (max-width: 768px) {
  .detail-grid > .card,
  .detail-grid > .card[data-col-span],
  .detail-stack,
  .detail-chart-card {
    flex: 1 1 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }
}

/* Detail edit mode (drag & drop / resize) */
.detail-edit-mode .card {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  cursor: move;
  transition: box-shadow .15s, transform .1s;
}
.detail-edit-mode .card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}
.detail-edit-mode .card:hover {
  box-shadow: 0 4px 16px rgba(227, 30, 37, 0.2);
}
.drag-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  color: var(--primary);
  cursor: grab;
  z-index: 10;
  user-select: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.8);
}
.drag-handle:active { cursor: grabbing; }

/* Column span controls in edit mode */
.span-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  z-index: 10;
}
.span-controls button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255,255,255,0.9);
  font-size: 10px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  padding: 0;
}
.span-controls button:hover { background: var(--primary); color: #fff; }
.span-controls button.active { background: var(--primary); color: #fff; }

/* (responsive detail-grid breakpoints are defined above) */

.detail-status-body { padding: 16px; }

.beacon-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin-bottom: 16px;
}

.beacon-light {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background .3s, box-shadow .3s;
  margin-bottom: 10px;
}
.beacon-light.active {
  animation: police-flash-large 1s infinite;
}

.beacon-label { font-weight: 700; font-size: 15px; color: var(--text); }

/* Widget management */
.btn-widget-close {
  display: none;                  /* hidden by default, shown in edit mode */
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 8px;
  line-height: 1;
  border-radius: 4px;
  transition: color .2s, background .2s, border-color .2s;
  flex-shrink: 0;
}
.btn-widget-close:hover { color: var(--danger); background: var(--danger-bg); border-color: var(--danger); }

/* Show close buttons only in edit mode */
.detail-edit-mode .btn-widget-close { display: inline-flex; }

.widget-add-bar {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.widget-picker {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: var(--shadow-card);
  gap: 6px;
  flex-wrap: wrap;
}
.widget-picker.show { display: flex; }

.widget-pick-btn { font-size: 12px !important; white-space: nowrap; }
.widget-pick-btn.disabled { opacity: .4; pointer-events: none; }

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-key { color: var(--text-muted); }
.status-val { font-weight: 500; }

.detail-battery-bar {
  height: 6px;
  background: var(--card-2);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.control-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.divider { border: none; border-top: 1px solid var(--border-light); margin: 4px 0; }

.info-body { padding: 16px; }
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--text-muted); flex-shrink: 0; }
.info-val { font-weight: 500; text-align: right; }

/* ════════════════════════════════════════════
   EVENTS
   ════════════════════════════════════════════ */
.event-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.evt-offline       { background: var(--danger-bg); color: var(--danger); }
.evt-online        { background: var(--success-bg); color: var(--success); }
.evt-battery_low   { background: var(--warning-bg); color: var(--warning); }
.evt-command       { background: var(--primary-light); color: var(--primary); }
.evt-ccu           { background: var(--card-2); color: var(--text-muted); }
.evt-default       { background: var(--card-2); color: var(--text-muted); }

.cmd-success { color: var(--success); font-weight: 600; }
.cmd-fail    { color: var(--danger);  font-weight: 600; }

/* ════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,14,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: modal-bg-in .2s ease;
}
@keyframes modal-bg-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.04);
  animation: modal-card-in .3s cubic-bezier(.34,1.56,.64,1);
}

.ui-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  vertical-align: -.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

:root { --icon-violet: #b39aca; --icon-cyan: #74bac5; }
:root[data-theme="light"] { --icon-violet: #786097; --icon-cyan: #257480; }
.ui-icon[data-tone="info"] { color: var(--info); }
.ui-icon[data-tone="success"] { color: var(--success); }
.ui-icon[data-tone="warning"] { color: var(--warning); }
.ui-icon[data-tone="danger"] { color: var(--danger); }
.ui-icon[data-tone="beacon"] { color: var(--beacon); }
.ui-icon[data-tone="muted"] { color: var(--text-muted); }
.ui-icon[data-tone="violet"] { color: var(--icon-violet); }
.ui-icon[data-tone="cyan"] { color: var(--icon-cyan); }
.nav-item.active .ui-icon, .btn-primary .ui-icon, .btn-success .ui-icon,
.btn-danger .ui-icon, .btn-warning .ui-icon { color: inherit; }
.card-header > .ui-icon, .section-header h3 > .ui-icon,
.modal-header h3 > .ui-icon { margin-right: 5px; }
.nav-item .ui-icon, .btn .ui-icon, .modal-close .ui-icon,
.login-password-toggle .ui-icon { vertical-align: middle; }
.map-pin .ui-icon, .map-badge .ui-icon, .map-sq .ui-icon,
.map-ring .ui-icon, .map-diamond .ui-icon, .map-star .ui-icon {
  fill: none;
  stroke: currentColor;
}
.map-emoji { display: grid; place-items: center; }
.map-emoji .ui-icon { width: 24px; height: 24px; }
.collapse-arrow .ui-icon { width: 14px; height: 14px; vertical-align: middle; }

.modal-close {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.modal-close:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg);
}

.modal-close:active { transform: scale(.96); }
.modal-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}
@keyframes modal-card-in {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-body   { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  animation: toast-in .3s cubic-bezier(.34,1.56,.64,1);
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.toast-success { background: rgba(26,159,74,.92); }
.toast-error   { background: rgba(220,38,38,.92); }
.toast-info    { background: rgba(200,25,31,.92); }
.toast-warning { background: rgba(217,119,6,.92); }

/* ════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════ */
@keyframes pulse-beacon {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

@keyframes police-flash {
  0%, 10%   { background: #2563eb; box-shadow: 0 0 8px rgba(37,99,235,.6); }
  25%       { background: #1e40af; box-shadow: 0 0 4px rgba(37,99,235,.3); }
  50%, 60%  { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.6); }
  75%       { background: #dc2626; box-shadow: 0 0 4px rgba(239,68,68,.3); }
  100%      { background: #2563eb; box-shadow: 0 0 8px rgba(37,99,235,.6); }
}

@keyframes police-flash-large {
  0%, 10%   { background: #2563eb; box-shadow: 0 0 0 12px rgba(37,99,235,.15), 0 0 30px rgba(37,99,235,.4); }
  25%       { background: #1e40af; box-shadow: 0 0 0 8px rgba(37,99,235,.1), 0 0 15px rgba(37,99,235,.2); }
  50%, 60%  { background: #ef4444; box-shadow: 0 0 0 12px rgba(239,68,68,.15), 0 0 30px rgba(239,68,68,.4); }
  75%       { background: #dc2626; box-shadow: 0 0 0 8px rgba(239,68,68,.1), 0 0 15px rgba(239,68,68,.2); }
  100%      { background: #2563eb; box-shadow: 0 0 0 12px rgba(37,99,235,.15), 0 0 30px rgba(37,99,235,.4); }
}

@keyframes pulse-beacon-large {
  0%, 100% { box-shadow: 0 0 0 12px rgba(227,30,37,.15), 0 0 30px rgba(227,30,37,.35); }
  50%       { box-shadow: 0 0 0 20px rgba(227,30,37,.08), 0 0 50px rgba(227,30,37,.5); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ════════════════════════════════════════════
   LOADING STATE
   ════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--card-2) 25%, var(--border) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.8s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ════════════════════════════════════════════
   USER BADGE (sidebar)
   ════════════════════════════════════════════ */
.user-badge {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  font-weight: 500;
}
.user-badge:empty {
  display: none;
}

/* ════════════════════════════════════════════
   SECTION HEADERS (settings page)
   ════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.ui-palette-card {
  margin-bottom: 18px;
  padding: 18px 20px;
}
.ui-palette-header,
.ui-palette-actions,
.ui-palette-item,
.ui-palette-preview {
  display: flex;
  align-items: center;
}
.ui-palette-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.ui-palette-scope {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}
.ui-palette-actions { gap: 8px; }
.ui-palette-actions .ui-icon { margin-right: 5px; }
.ui-palette-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 0 18px;
  border-top: 1px solid var(--border);
}
.ui-palette-item {
  min-width: 0;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ui-palette-item > input[type="color"] {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  cursor: pointer;
}
.ui-palette-item > input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ui-palette-item > input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 3px;
}
.ui-palette-label {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text);
  line-height: 1.25;
}
.ui-palette-label b,
.ui-palette-label small { display: block; }
.ui-palette-label b { font-size: 12.5px; }
.ui-palette-label small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
}
.ui-palette-hex {
  flex: 0 0 84px;
  width: 84px;
  min-width: 0;
  padding-right: 7px;
  padding-left: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
}
.ui-palette-hex.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-bg);
}
.ui-palette-preview {
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 14px;
}
.ui-palette-preview span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1080px) {
  .ui-palette-grid { grid-template-columns: repeat(2, minmax(230px, 1fr)); }
}

@media (max-width: 640px) {
  .ui-palette-card { padding: 14px; }
  .ui-palette-header { align-items: flex-start; flex-direction: column; }
  .ui-palette-actions { width: 100%; }
  .ui-palette-actions .btn { flex: 1 1 0; justify-content: center; }
  .ui-palette-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ════════════════════════════════════════════
   USERS TABLE BADGES
   ════════════════════════════════════════════ */
.btn-danger-outline {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: #fff;
}

/* Command result badges */
.cmd-success { color: var(--success); font-weight: 600; }
.cmd-fail    { color: var(--danger);  font-weight: 600; }

/* Event type badges */
.event-type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.evt-offline    { background: var(--danger-bg); color: var(--danger); }
.evt-online     { background: var(--success-bg); color: var(--success); }
.evt-battery_low { background: var(--warning-bg); color: var(--warning); }
.evt-command    { background: var(--primary-light); color: var(--primary); }
.evt-ccu        { background: var(--card-2); color: #7c3aed; }
.evt-default    { background: var(--card-2); color: var(--text-muted); }

/* ════════════════════════════════════════════
   BULK SCHEDULE DEVICE LIST
   ════════════════════════════════════════════ */
.bulk-schedule-device-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--card-2);
}
.bulk-schedule-device-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .1s;
}
.bulk-schedule-device-item:hover { background: var(--bg); }
.bulk-schedule-device-item input[type="checkbox"] { flex-shrink: 0; }
.bulk-schedule-device-item.stolen { opacity: .45; text-decoration: line-through; }

/* ════════════════════════════════════════════
   TIMELINE CHART
   ════════════════════════════════════════════ */
.timeline-period-btns { display: flex; gap: 4px; }
.timeline-period-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.timeline-container {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 200px;
  cursor: grab;
}
.timeline-container:active { cursor: grabbing; }
#timeline-canvas { min-width: 100%; }
.timeline-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}
.timeline-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}
.timeline-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(17,24,39,.9);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  display: none;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

/* ════════════════════════════════════════════
   REPORTS
   ════════════════════════════════════════════ */
.report-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
}
.report-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.report-tab:hover { color: var(--text); }
.report-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

.report-period-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.report-preset.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.report-filters { background: var(--card); }

/* Multi-select dropdown */
.multi-select { position: relative; display: inline-block; min-width: 160px; }
.multi-select-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--card); cursor: pointer; user-select: none;
  white-space: nowrap; max-width: 220px;
}
.multi-select-toggle:hover { border-color: var(--primary); }
.multi-select-arrow { font-size: 10px; color: var(--text-muted); transition: transform .15s; }
.multi-select.open .multi-select-arrow { transform: rotate(180deg); }
.multi-select-label { overflow: hidden; text-overflow: ellipsis; color: var(--text); }

.multi-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  min-width: 240px; max-height: 320px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.multi-select-dropdown.hidden { display: none; }

.multi-select-actions {
  display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border-light);
}
.multi-select-actions .btn { flex: 1; font-size: 11px; padding: 4px 8px; }

.multi-select-search { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }
.multi-select-search .input-sm { width: 100%; font-size: 12px; }

.multi-select-list {
  overflow-y: auto; max-height: 220px; padding: 4px 0;
}
.multi-select-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 12.5px; cursor: pointer;
  transition: background .1s;
}
.multi-select-item:hover { background: var(--bg); }
.multi-select-item input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.multi-select-item label { cursor: pointer; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-item.ms-hidden { display: none; }

/* Uptime bar */
.uptime-bar { width: 80px; height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.uptime-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.uptime-bar-fill.good { background: var(--success); }
.uptime-bar-fill.warn { background: var(--warning); }
.uptime-bar-fill.bad  { background: var(--danger); }

/* Problem row highlights */
.report-row-warning { background: var(--warning-bg) !important; }
.report-row-danger  { background: var(--danger-bg) !important; }

/* Traffic light badges */
.traffic-light { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.traffic-green  { background: var(--success-bg); color: var(--success); }
.traffic-yellow { background: var(--warning-bg); color: var(--warning); }
.traffic-red    { background: var(--danger-bg); color: var(--danger); }

/* Report chart container */
.report-chart-wrap { position: relative; height: 260px; margin: 16px; }

/* Report section header */
.report-section-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 20px 0 10px; padding-left: 4px; }

/* Needs maintenance badge */
.badge-maintenance { background: var(--warning-bg); color: var(--warning); font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 500; }

@media (max-width: 900px) {
  .report-tabs { gap: 0; }
  .report-tab { padding: 8px 12px; font-size: 12px; }
  .report-period-presets { width: 100%; }
  .uptime-bar { width: 60px; }
}

/* ════════════════════════════════════════════
   CAMERA SNAPSHOTS
   ════════════════════════════════════════════ */
.cam-snaps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cam-snap-wrap {
  flex: 1;
  min-width: 140px;
  max-width: 320px;
}
.cam-snap-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cam-snap-img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .2s;
  display: block;
}
.cam-snap-img:hover { opacity: .85; }
.cam-snap-noimg {
  width: 100%;
  height: 80px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* Camera card expand (legacy — popups) */
.cam-expand { padding-top: 8px; border-top: 1px solid var(--border-light); margin-top: 8px; }

/* Lightbox slider overlay */
.cam-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: camLbFadeIn .2s;
}
@keyframes camLbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cam-lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  z-index: 10;
  opacity: .7;
  transition: opacity .2s, background-color .2s;
}
.cam-lb-close:hover { opacity: 1; background: rgba(0,0,0,.55); }
.cam-lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  font-size: 48px;
  width: 56px;
  height: 80px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background .2s;
  user-select: none;
}
.cam-lb-arrow:hover { background: rgba(255,255,255,.25); }
.cam-lb-prev { left: 16px; }
.cam-lb-next { right: 16px; }
.cam-lb-content {
  position: relative;
  max-width: 85vw;
  max-height: 85vh;
}
.cam-lb-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.cam-lb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 30px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  border-radius: 0 0 4px 4px;
  pointer-events: none;
}
.cam-lb-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.cam-lb-label {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  margin-top: 2px;
}
.cam-lb-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 500;
}


/* Leaflet popup snapshots */
.leaflet-popup-content .cam-snaps { max-width: 460px; }
.leaflet-popup-content .cam-snap-wrap { max-width: 220px; }
.leaflet-popup-content .cam-snap-img { max-height: 160px; object-fit: cover; }
.leaflet-popup-content .map-live-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.leaflet-popup-content .map-live-link {
  min-width: 104px;
}
.leaflet-popup-content .map-camera-previews {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(720px, calc(100vw - 64px));
  max-width: 100%;
  margin-top: 8px;
}
.leaflet-popup-content .map-camera-count-1 {
  grid-template-columns: minmax(0, 460px);
  width: min(460px, calc(100vw - 64px));
}
.leaflet-popup-content .map-camera-preview { min-width: 0; }
.leaflet-popup-content .map-preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #090d12;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.leaflet-popup-content .map-preview-image-button {
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}
.leaflet-popup-content .map-preview-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090d12;
  transition: opacity .15s ease;
}
.leaflet-popup-content .map-preview-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding-left: 3px;
  border-radius: 50%;
  color: #fff;
  background: rgba(9, 13, 18, .72);
  font-size: 16px;
  opacity: .85;
  transform: translate(-50%, -50%);
  transition: opacity .15s ease;
}
.leaflet-popup-content .map-preview-image-button:hover .map-preview-image { opacity: .82; }
.leaflet-popup-content .map-preview-image-button:hover .map-preview-play,
.leaflet-popup-content .map-preview-image-button:focus-visible .map-preview-play { opacity: 1; }
.leaflet-popup-content .map-preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 32px;
  padding: 6px 0;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}
.leaflet-popup-content .map-preview-caption:hover,
.leaflet-popup-content .map-preview-caption:focus-visible {
  color: var(--text);
  background: var(--hover);
}
.leaflet-popup-content .map-preview-caption-action { color: var(--text-secondary); }
.map-camera-popup .leaflet-popup-content,
.map-device-popup .leaflet-popup-content { max-height: min(680px, calc(100dvh - 120px)); overflow-y: auto; overflow-x: hidden; }
.map-camera-popup .map-popup-title,
.map-device-popup .map-popup-title { display: flex; align-items: flex-start; gap: 8px; padding-right: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.map-camera-popup .map-popup-title .ui-icon,
.map-device-popup .map-popup-title .ui-icon { margin-top: 2px; }
.leaflet-popup-content .map-ai-stats { margin-top: 8px; }
.leaflet-popup-content .map-analytics-panel {
  border-top: 1px solid var(--border);
}
.leaflet-popup-content .map-analytics-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.leaflet-popup-content .map-analytics-camera {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaflet-popup-content .map-analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.leaflet-popup-content .map-analytics-metric {
  min-width: 0;
  padding: 8px 0;
  text-align: left;
}
.leaflet-popup-content .map-analytics-metric:last-child { border-right: 0; }
.leaflet-popup-content .map-analytics-metric span,
.leaflet-popup-content .map-analytics-metric small {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.leaflet-popup-content .map-analytics-metric strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.map-traffic-categories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border-light); }
.map-traffic-category { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; font-size: 11px; }
.map-traffic-category span { color: var(--text-secondary); display: flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }
.map-traffic-category .ui-icon { width: 14px; height: 14px; }
.map-traffic-category strong { color: var(--text); font-variant-numeric: tabular-nums; }
.map-weather-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0 0; border-top: 1px solid var(--border-light); color: var(--text-secondary); font-size: 11px; }
.map-weather-summary small { margin-left: auto; color: var(--text-muted); }
.leaflet-popup-content .map-analytics-weather strong { font-size: 12px; }
.leaflet-popup-content .map-analytics-loading,
.leaflet-popup-content .map-analytics-empty {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 480px) {
  .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 24px);
  }
  .leaflet-popup-content {
    width: auto !important;
    max-width: calc(100vw - 52px);
  }
  .leaflet-popup-content .map-camera-previews {
    grid-template-columns: 1fr;
  }
  .leaflet-popup-content .map-player-open {
    width: 100%;
  }
  .leaflet-popup-content .map-analytics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .leaflet-popup-content .map-analytics-metric {
    border: 0;
  }
  .leaflet-popup-content .map-analytics-metric strong { font-size: 16px; }
  .map-traffic-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaflet-popup-content .map-analytics-metric:nth-child(2) { border-right: 0; }
  .leaflet-popup-content .map-analytics-metric:nth-child(even) { border-right: 0; }
  .leaflet-popup-content .map-analytics-metric:last-child { border-bottom: 0; }
}

@media (max-width: 768px) {
  .cameras-grid { grid-template-columns: 1fr; }
  .cam-snap-wrap { min-width: 100%; max-width: 100%; }
  .leaflet-popup-content .cam-snap-wrap { max-width: 100%; }
  .cam-lb-arrow { width: 40px; height: 60px; font-size: 32px; }
  .cam-lb-prev { left: 4px; }
  .cam-lb-next { right: 4px; }
  .cam-lb-content { max-width: 95vw; max-height: 80vh; }
  .cam-lb-img { max-width: 95vw; max-height: 80vh; }
}

/* ════════════════════════════════════════════
   PERMISSIONS TABLE (user modal)
   ════════════════════════════════════════════ */
.perm-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.perm-table { font-size: 12px; }
.perm-table thead th { position: sticky; top: 0; z-index: 2; }
.perm-th { text-align: center !important; width: 44px; font-size: 14px !important; padding: 4px 2px !important; }
.perm-table td { padding: 4px 8px !important; }
.perm-table td:not(:first-child) { text-align: center; }
.perm-table input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }
.perm-device-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; display: block; }
.perm-device-type { font-size: 10px; color: var(--text-muted); }
.perm-row-header {
  background: var(--card-2);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.perm-row-header td { padding: 6px 8px !important; }
.perm-row-district {
  background: var(--bg-secondary);
  font-size: 12px;
  font-weight: 500;
}
.perm-row-district td { padding: 4px 8px !important; }
.district-arrow { font-size: 10px; transition: transform .2s; }
.perm-global-label {
  display: flex; align-items: center; gap: 4px; font-size: 13px;
  cursor: pointer; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
}
.perm-global-label:hover { background: var(--hover); }
.perm-global-label input { accent-color: var(--primary); }

.perm-col-toggle { cursor: pointer; user-select: none; }
.perm-col-toggle:hover { background: var(--hover); }

.perm-tpl-btn { font-size: 12px !important; }
.perm-tpl-btn:hover { background: var(--primary) !important; color: #fff !important; }

.impersonation-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: linear-gradient(90deg, #e65100, #ff6d00);
  color: #fff; text-align: center; padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.impersonation-banner.hidden { display: none; }
body.impersonating { padding-top: 40px; }

@media (max-width: 768px) {
  .perm-th { width: 36px; font-size: 9.5px !important; }
  .perm-device-name { max-width: 100px; }
}

/* ════════════════════════════════════════════
   OVERVIEW (24h all devices)
   ════════════════════════════════════════════ */
.overview-timelines {
  min-width: 760px;
  max-height: calc(100vh - 370px);
  overflow-y: auto;
}

.overview-kpi {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.overview-kpi .kpi-card {
  min-height: 112px;
  padding: 15px 17px;
}

.overview-kpi .kpi-label { order: 0; }
.overview-kpi .kpi-value {
  order: 1;
  margin-top: 9px;
  margin-bottom: 5px;
  font-size: 32px;
}
.overview-kpi-meta {
  order: 2;
  color: var(--text-muted);
  font-size: 11px;
}
.overview-kpi .kpi-success { border-left-color: var(--overview-online); }
.overview-kpi .kpi-warning { border-left-color: var(--overview-warning); }
.overview-kpi .kpi-danger { border-left-color: var(--overview-offline); }
.overview-kpi .overview-kpi-uptime { border-left-color: var(--overview-beacon); }
.overview-kpi .kpi-success .kpi-value { color: var(--overview-online); }
.overview-kpi .kpi-warning .kpi-value { color: var(--overview-warning); }
.overview-kpi .kpi-danger .kpi-value { color: var(--overview-offline); }

.overview-panel { padding: 0; overflow: hidden; }
.overview-panel-header {
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 12px;
  margin: 0;
  border-bottom: 1px solid var(--border-light);
}
.overview-panel-title { font-size: 13px; font-weight: 700; color: var(--text); }
.overview-range {
  padding-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.overview-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 10.5px;
}
.overview-legend-online { background: var(--overview-online); }
.overview-legend-beacon { background: var(--overview-beacon); }
.overview-legend-offline { background: var(--overview-offline); }
.overview-timeline-scroll { overflow-x: auto; }

.overview-row {
  display: grid;
  grid-template-columns: 230px minmax(420px, 1fr) 54px;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding: 9px 16px;
  transition: background .1s;
  cursor: pointer;
}
.overview-row:last-child { border-bottom: none; }
.overview-row:hover { background: var(--card-2); }

.overview-row-label {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.overview-row-label .ov-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.overview-row-label .ov-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-row-label .ov-district { font-size: 10.5px; color: var(--text-muted); font-weight: 400; }
.overview-row-track {
  position: relative;
  min-width: 0;
  height: 20px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.overview-row-canvas {
  display: block;
  width: 100%;
  height: 20px;
}
.overview-no-data {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-light);
  font-size: 10px;
}
.overview-row-uptime {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.overview-period-btns { display: flex; gap: 4px; }
.overview-period-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

@media (max-width: 768px) {
  #view-overview .page-actions { width: 100%; }
  #view-overview .overview-period-btns { flex: 1 1 auto; }
  #view-overview .overview-period-btn { flex: 1; }
  .overview-row { grid-template-columns: 170px minmax(420px, 1fr) 46px; padding: 8px 12px; gap: 10px; }
  .overview-row-label { font-size: 11px; }
  .overview-kpi { grid-template-columns: repeat(2, 1fr) !important; }
  .overview-kpi .kpi-card { min-height: 96px; }
  .overview-timelines { min-width: 680px; max-height: none; }
  .overview-panel-header { align-items: flex-start; }
  .overview-range { white-space: normal; text-align: right; }
}

/* ── Освещение на карте (glowing polyline) ── */
.lighting-line {
  transition: stroke .3s, stroke-width .3s, stroke-opacity .3s;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lighting-halo {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(3, 7, 18, .65));
}
.lighting-visibility-proxy {
  vector-effect: non-scaling-stroke;
}
.lighting-on {
  filter: drop-shadow(0 0 4px #ffca28) drop-shadow(0 0 8px rgba(255,179,0,.75));
  animation: lightingPulse 2.4s ease-in-out infinite;
}
@keyframes lightingPulse {
  0%, 100% { stroke-opacity: 0.95; filter: drop-shadow(0 0 4px #ffca28) drop-shadow(0 0 8px rgba(255,179,0,.6)); }
  50%      { stroke-opacity: 1;    filter: drop-shadow(0 0 7px #ffde59) drop-shadow(0 0 14px rgba(255,193,7,.9)); }
}

/* Более широкая модалка устройства (для карты освещения) */
#edit-modal .modal-card { max-width: 860px; }

/* Мини-редактор ломаной освещения */
#edit-light-map { width: 100%; height: 380px; border-radius: 8px; border: 1px solid var(--border); }

/* Карта положения устройства */
#edit-pos-map { width: 100%; height: 320px; border-radius: 8px; border: 1px solid var(--border); }

/* Рабочее пространство AI-видеоаналитики */
.ai-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.ai-page-header .page-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}
.ai-page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.ai-toolbar-field {
  display: grid;
  gap: 3px;
  min-width: 150px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
#ai-camera-filter-wrap { width: min(360px, 30vw); }
.ai-toolbar-field select {
  width: 100%;
  height: 32px;
  padding: 0 28px 0 9px;
  overflow: hidden;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  text-transform: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.ai-runtime-status {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
}
#ai-status-badge,
#ai-detect-badge {
  padding: 3px 7px;
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
  background: var(--bg-secondary);
  border-radius: 9px;
}
#ai-hailo-badge {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}
.ai-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.ai-tab {
  min-width: 84px;
  padding: 9px 14px;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ai-tab:hover { color: var(--text); background: var(--bg-secondary); }
.ai-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ai-workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.ai-panel {
  min-width: 0;
  margin-bottom: 12px;
  padding: 13px 14px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 10px;
}
.ai-panel-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0;
}
.ai-panel-actions,
.ai-event-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.ai-period-toggle { margin: 0; }
.ai-gost-toolbar .ai-panel-actions { flex-wrap: wrap; }
.ai-gost-custom-range {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.ai-gost-custom-range[hidden] { display: none; }
.ai-gost-custom-range label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-muted);
  font-size: 9px;
}
.ai-gost-custom-range input {
  width: 176px;
  min-height: 30px;
  padding: 4px 7px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.ai-inline-state {
  padding: 18px 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.ai-traffic-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
  gap: 12px;
  min-width: 0;
}
.ai-chart-panel { min-height: 338px; }
.ai-compact-table-wrap {
  min-width: 0;
  overflow: auto;
}
.ai-compact-table {
  width: 100%;
  font-size: 11px;
}
.ai-compact-table th,
.ai-compact-table td { padding: 7px 9px; }
.ai-compact-table td:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}
.ai-disclosure {
  min-width: 0;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-disclosure > summary {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 13px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.ai-disclosure > summary::-webkit-details-marker { display: none; }
.ai-disclosure > summary::after {
  margin-left: auto;
  color: var(--text-muted);
  content: '+';
  font-size: 16px;
  font-weight: 400;
}
.ai-disclosure[open] > summary::after { content: '−'; }
.ai-disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.ai-disclosure-body { padding: 12px 13px; }
.ai-node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.ai-monitor-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-monitor-metrics > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
}
.ai-monitor-metrics > div:last-child { border-right: 0; }
.ai-monitor-metrics span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-monitor-metrics strong {
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.ai-camera-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.ai-speed-filter-header { align-items: flex-start; }
.ai-speed-custom-range,
.ai-speed-own-range,
.ai-speed-filters {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  margin-top: 9px;
  flex-wrap: wrap;
}
.ai-speed-custom-range[hidden],
.ai-speed-own-range[hidden] { display: none; }
.ai-speed-custom-range label,
.ai-speed-own-range label,
.ai-speed-filters label:not(.ai-speed-checkbox) {
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
  color: var(--text-muted);
  font-size: 10px;
}
.ai-speed-filters select,
.ai-speed-filters input[type="number"],
.ai-speed-custom-range input,
.ai-speed-own-range input {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.ai-speed-filters .ai-speed-number { flex-grow: 0; flex-basis: 105px; }
.ai-speed-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}
.ai-speed-checkbox input { width: 15px; height: 15px; accent-color: var(--primary); }
.ai-speed-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ai-speed-kpis > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--border);
}
.ai-speed-kpis > div:last-child { border-right: 0; }
.ai-speed-kpis span,
#ai-speed-range-label,
#ai-speed-events-count {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-speed-kpis strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ai-speed-chart { position: relative; width: 100%; height: 250px; }
.ai-speed-table { width: 100%; min-width: 820px; font-size: 11px; }
.ai-speed-table th,
.ai-speed-table td { padding: 8px 9px; }
.ai-speed-table th:not(:first-child),
.ai-speed-table td:not(:first-child) { text-align: right; }
.ai-speed-table td { font-variant-numeric: tabular-nums; }
.ai-speed-events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 9px;
}
.ai-speed-event {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  font: inherit;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}
.ai-speed-event:hover { border-color: var(--text-muted); }
.ai-speed-event-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-secondary);
}
.ai-speed-event-media img { width: 100%; height: 100%; object-fit: cover; }
.ai-speed-event-value,
.ai-speed-event-gost {
  position: absolute;
  top: 6px;
  padding: 2px 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 35%);
}
.ai-speed-event-value { right: 6px; background: #0284c7; }
.ai-speed-event-gost { left: 6px; }
.ai-speed-event-meta { display: grid; gap: 2px; padding: 7px 8px; }
.ai-speed-event-meta strong,
.ai-speed-event-meta span,
.ai-speed-event-meta time {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-speed-event-meta strong { font-size: 11px; }
.ai-speed-event-meta span,
.ai-speed-event-meta time { color: var(--text-muted); }
.ai-speed-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
  margin-top: 11px;
  color: var(--text-muted);
  font-size: 11px;
}
.ai-event-filters button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.ai-event-filters button:hover { color: var(--text); border-color: var(--text-muted); }
.ai-training-disclosure { margin-bottom: 12px; }
.ai-axle-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ai-weather-current-table { min-width: 780px; }
.ai-weather-current-table td { vertical-align: middle; }
.ai-weather-current-name {
  max-width: 340px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-weather-current-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
}
.ai-weather-current-dot {
  width: 7px;
  min-width: 7px;
  height: 7px;
  background: var(--ai-state-color);
  border-radius: 50%;
}
.ai-weather-current-meta {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}
.ai-weather-current-table tr.is-stale td { opacity: .7; }
.ai-weather-current-table tr.is-stale .ai-weather-current-meta { color: var(--warning); }
/* Скрытие панелей неактивной вкладки — !important перебивает инлайновый display */
.ai-hidden { display: none !important; }

@media (max-width: 900px) {
  .ai-page-header { align-items: flex-start; flex-direction: column; }
  .ai-page-toolbar { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  #ai-camera-filter-wrap { width: min(420px, 48vw); }
  .ai-traffic-grid { grid-template-columns: 1fr; }
  .ai-chart-panel { min-height: 0; }
  .ai-speed-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-speed-kpis > div:nth-child(3) { border-right: 0; }
  .ai-speed-kpis > div:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 620px) {
  .ai-page-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .ai-toolbar-field,
  #ai-camera-filter-wrap { width: auto; min-width: 0; }
  #ai-camera-filter-wrap { grid-column: 1 / -1; }
  .ai-runtime-status { grid-column: 1 / -1; overflow-x: auto; }
  .ai-tabs { margin-right: -8px; margin-left: -8px; padding-left: 8px; }
  .ai-tab { min-width: 76px; padding-right: 11px; padding-left: 11px; }
  .ai-panel { padding: 10px; }
  .ai-panel-header { align-items: flex-start; flex-direction: column; }
  .ai-panel-actions { width: 100%; align-items: flex-start; flex-direction: column; }
  .ai-period-toggle { width: 100%; overflow-x: auto; }
  .ai-gost-custom-range { width: 100%; flex-wrap: wrap; }
  .ai-gost-custom-range label { flex: 1 1 180px; }
  .ai-gost-custom-range input { width: 100%; }
  .ai-monitor-metrics { grid-template-columns: 1fr 1fr; }
  .ai-monitor-metrics > div { border-bottom: 1px solid var(--border); }
  .ai-monitor-metrics > div:nth-child(2) { border-right: 0; }
  .ai-camera-preview-grid { grid-template-columns: 1fr; }
  .ai-speed-filter-header { align-items: flex-start; }
  .ai-speed-filters label:not(.ai-speed-checkbox) { flex-basis: calc(50% - 5px); }
  .ai-speed-filters .ai-speed-number { flex-basis: calc(50% - 5px); }
  .ai-speed-filters .btn { flex: 1 1 100%; }
  .ai-speed-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-speed-kpis > div:nth-child(3) { border-right: 1px solid var(--border); }
  .ai-speed-kpis > div:nth-child(2n) { border-right: 0; }
  .ai-speed-kpis > div:nth-child(-n+4) { border-bottom: 1px solid var(--border); }
  .ai-speed-events { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-event-filters { width: 100%; justify-content: flex-start; }
}

.ai-event-photo {
  text-align: center;
}

.ai-event-photo-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.ai-event-photo-stage > img {
  display: block;
  max-width: 100%;
  max-height: 48vh;
  border-radius: 8px;
}

.ai-event-trajectory {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ai-event-trajectory polyline {
  fill: none;
  stroke: #22d3ee;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ai-event-trajectory circle {
  fill: #22d3ee;
  stroke: rgba(0, 0, 0, .72);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ai-event-detection {
  --detection-color: #ef4444;
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--detection-color);
  border-radius: 2px;
  pointer-events: none;
}

.ai-event-detection.is-high {
  --detection-color: #22c55e;
}

.ai-event-detection.is-medium {
  --detection-color: #f59e0b;
}

.ai-event-detection-label {
  position: absolute;
  top: -2px;
  left: 0;
  max-width: min(190px, 55vw);
  padding: 2px 4px;
  transform: translateY(-100%);
  overflow: hidden;
  color: #fff;
  background: color-mix(in srgb, var(--detection-color) 88%, transparent);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}

.ai-event-detection.is-label-below .ai-event-detection-label {
  top: 2px;
  transform: none;
}

.ai-event-detection.is-label-right .ai-event-detection-label {
  right: 0;
  left: auto;
}

/* Каплевидные пины на карте (маяки/камеры) */
.map-pin-wrap { background: none; border: none; }
.map-pin-wrap .ui-icon, .map-emoji .ui-icon { stroke-width: 2.4; }
.map-pin {
  width: 36px; height: 36px; margin: 4px;
  border-radius: 50% 50% 50% 0;
  background: var(--pc);
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.55);
}
.map-pin svg { transform: rotate(45deg); }
.map-pin.pulse { animation: pinGlow 1.3s ease-in-out infinite; }
@keyframes pinGlow {
  0%, 100% { box-shadow: 0 3px 8px rgba(0,0,0,.4), 0 0 6px 1px var(--pc); }
  50%      { box-shadow: 0 3px 8px rgba(0,0,0,.4), 0 0 16px 5px var(--pc); }
}
/* Круглый бейдж */
.map-badge {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--pc); border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.map-badge.pulse { animation: pinGlow 1.3s ease-in-out infinite; }
/* Эмодзи-маркер */
.map-emoji {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 3px solid var(--pc);
  box-shadow: 0 0 0 2px #fff, 0 3px 9px rgba(0,0,0,.55);
  line-height: 1; text-align: center;
}
.map-emoji.pulse { animation: emojiPulse 1s ease-in-out infinite; }
@keyframes emojiPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); } }

/* Квадрат */
.map-sq { width: 36px; height: 36px; border-radius: 8px; background: var(--pc); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.map-sq.pulse { animation: pinGlow 1.3s ease-in-out infinite; }
/* Ромб */
.map-diamond { width: 30px; height: 30px; margin: 6px; border-radius: 6px; background: var(--pc); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.55); transform: rotate(45deg); display: flex; align-items: center; justify-content: center; }
.map-diamond-in { transform: rotate(-45deg); display: flex; }
.map-diamond.pulse { animation: pinGlow 1.3s ease-in-out infinite; }
/* Кольцо */
.map-ring { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 3px solid var(--pc); box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.map-ring.pulse { animation: ringGlow 1.3s ease-in-out infinite; }
@keyframes ringGlow { 0%,100% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 5px 1px var(--pc); } 50% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 14px 4px var(--pc); } }
/* Радар (пульсирующий пинг) */
.map-radar { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; position: relative; }
.map-radar-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); border: 2px solid #fff; z-index: 1; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.map-radar::before, .map-radar::after { content: ''; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--pc); opacity: .55; animation: radarPing 1.8s ease-out infinite; }
.map-radar::after { animation-delay: .9s; }
@keyframes radarPing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3.2); opacity: 0; } }
/* Звезда шерифа */
.map-star { width: 36px; height: 36px; border-radius: 50%; background: var(--pc); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.map-star.pulse { animation: pinGlow 1.3s ease-in-out infinite; }

/* Освещение — бегущая линия (marching ants) */
.lighting-run { animation: lightRun 1s linear infinite; }
@keyframes lightRun { to { stroke-dashoffset: -24; } }

/* Селектор дорог/камер (master) */
.ai-road-group { border-top: 1px solid var(--border-light); }
.ai-road-ghead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  user-select: none; border-radius: 6px;
}
.ai-road-ghead:hover { background: var(--bg-secondary); }
.ai-road-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px 6px 22px; cursor: pointer; font-size: 13px;
  border-radius: 6px; transition: background .12s;
}
.ai-road-item:hover { background: var(--bg-secondary); }
.ai-road-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.ai-road-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-road-count { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-muted); margin-left: 10px; flex-shrink: 0; }
.ai-road-item.active .ai-road-count { color: var(--primary); }

/* Кликабельные KPI-карточки обзора (фильтр) */
.kpi-card.kpi-clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kpi-card.kpi-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-card.kpi-clickable.active { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Таймлапс на карте */
#map-timelapse-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tl-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-card);
}
.tl-bar input[type="range"] { accent-color: var(--primary); height: 4px; }
.tl-time { font-family: var(--font-mono); font-size: 13px; font-weight: 600; min-width: 118px; text-align: center; color: var(--text); }
.tl-speed { padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; background: var(--bg); }

/* ════════════════════════════════════════════
   RESIZABLE WIDGETS
   ════════════════════════════════════════════ */
.resizable {
  position: relative;
  overflow: hidden;
  min-height: 60px;
}
.resizable.resizing { user-select: none; }

/* Drag handle (bottom-right corner) */
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 10;
  opacity: 0;
  transition: opacity .2s;
}
.resizable:hover .resize-handle { opacity: 1; }

.resize-handle::before,
.resize-handle::after {
  content: '';
  position: absolute;
  background: var(--gray);
  border-radius: 1px;
}
.resize-handle::before {
  width: 10px; height: 2px;
  bottom: 5px; right: 3px;
  transform: rotate(-45deg);
}
.resize-handle::after {
  width: 6px; height: 2px;
  bottom: 4px; right: 2px;
  transform: rotate(-45deg) translate(-2px, -4px);
}

/* Vertical-only resize handle */
.resize-handle-v {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 10;
  opacity: 0;
  transition: opacity .2s;
}
.resizable:hover .resize-handle-v { opacity: 1; }

.resize-handle-v::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--gray);
  border-radius: 2px;
}

/* Reset button (top-right) */
.resize-reset {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 10;
  line-height: 1;
  padding: 0;
}
.resize-reset:hover { background: var(--border); color: var(--text); }
.resizable.resized .resize-reset { display: flex; }
.resizable.resized:hover .resize-reset { display: flex; }

/* Chart cards need overflow visible for handle but clip content */
.detail-chart-card.resizable { overflow: hidden; }
.detail-chart-card.resizable > .card-header { position: relative; z-index: 2; }

/* Map container resizable */
.map-container.resizable { overflow: hidden; }

/* ════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════ */

/* ── Hamburger button ── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--sidebar-bg);
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .hamburger { display: flex; }

  /* Sidebar → slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 260px;
    min-width: 260px;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content fills full width */
  .app { flex-direction: column; }
  .main-content {
    padding: 60px 12px 16px 12px;
    width: 100%;
  }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-title { font-size: 18px; }
  .page-actions { width: 100%; flex-wrap: wrap; }

  /* KPI grid → 2 columns */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 11px; }

  /* Device cards → single column */
  .device-grid { grid-template-columns: 1fr; gap: 10px; }


  /* Filter rows wrap */
  .filter-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .filter-row .select-sm,
  .filter-row .input-sm { width: 100%; }
  .filter-row > span[style*="flex:1"] { display: none; }

  /* Tables */
  .data-table { font-size: 12px; }
  .data-table thead th { padding: 8px 10px; font-size: 10.5px; }
  .data-table td { padding: 8px 10px; }

  /* Detail grid → single column on mobile */
  .detail-grid > .card {
    flex: 1 1 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }

  /* Map */
  .map-container { height: calc(100vh - 200px); min-height: 300px; }

  /* Map page header actions */
  .map-layer-toggle { margin-right: 0; }
  .map-legend { font-size: 11px; gap: 8px; padding: 5px 10px; }

  /* Reports */
  .report-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .report-tab { padding: 8px 12px; font-size: 12px; flex-shrink: 0; }
  .report-period-presets { width: 100%; }
  .report-chart-wrap { height: 200px; margin: 12px 8px; }

  /* Multi-select */
  .multi-select { min-width: 100%; }
  .multi-select-dropdown { min-width: 100%; }

  /* Bulk schedule */
  #bulk-schedule-body > div[style*="display:flex"] { flex-direction: column; }

  /* Modals */
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal-card { max-width: 100%; max-height: 85vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .form-row { grid-template-columns: 1fr; gap: 0; }

  /* Toast → full width */
  #toast-container { left: 12px; right: 12px; max-width: none; }

  /* Timeline */
  .timeline-legend { font-size: 11px; gap: 8px; }
  .timeline-legend span[style*="margin-left:auto"] { display: none; }

  /* Section headers */
  .section-header { flex-direction: column; align-items: flex-start; }

  /* Disable resize on mobile */
  .resize-handle,
  .resize-handle-v,
  .resize-reset { display: none !important; }
  .resizable { overflow: visible; }

  /* Login card */
  .login-screen { padding: 16px; }
  .login-card { width: 100%; padding: 28px 22px 24px; margin: 0; }
  .login-brand { padding-bottom: 20px; margin-bottom: 20px; }
  .login-brand h1 { font-size: 25px; }

  /* Detail page back + title */
  #view-device-detail .page-header > div[style] { flex-wrap: wrap; }

  /* Buttons in page actions */
  .page-actions .btn { font-size: 12px; padding: 6px 10px; }
}

/* Small phones */
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .kpi-value { font-size: 20px; }
  .main-content { padding: 56px 8px 12px 8px; }
  .device-card { padding: 12px; }
  .page-title { font-size: 16px; }
}

/* Print styles */
@media print {
  .sidebar, .page-actions, .report-tabs, .report-filters,
  #btn-report-csv, #btn-report-print, .sidebar-footer,
  .report-period-presets, #btn-report-generate,
  #report-district-filter { display: none !important; }
  .app { display: block !important; }
  .main-content { margin-left: 0 !important; padding: 10px !important; overflow: visible !important; }
  .view { display: none !important; }
  #view-reports { display: block !important; }
  #view-reports .page-header .page-title { display: block !important; font-size: 18pt; }
  #view-reports .page-header .page-subtitle { display: block !important; }
  #view-reports .page-header { display: block !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; margin-bottom: 12px !important; }
  .data-table { font-size: 9pt; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .kpi-value { font-size: 18pt; }
  #report-content { display: block !important; }
}

/* ═══════════════════════════════════════════════════════════════
   ДАШБОРД-ДИСПЕТЧЕРСКАЯ — шапка, приборы, лампа-маяк
   (элементы шаблона «Ночная диспетчерская»)
   ═══════════════════════════════════════════════════════════════ */
.dispatch-header { align-items: flex-end; }
.page-header .eyebrow, .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 2px;
}
.page-title.display {
  font-family: var(--font-display);
  font-weight: 600; text-transform: uppercase; letter-spacing: .01em;
  font-size: 26px; line-height: 1.12; margin-top: 3px;
  text-wrap: balance;
}
.dispatch-clock {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
}
.dispatch-clock .clock-geo { letter-spacing: .08em; }
.dispatch-clock b {
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  color: var(--text); letter-spacing: .04em; line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* KPI — приборные подписи снизу */
.kpi-foot {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}

/* Заголовок секции устройств — дисплейный, с линией-разделителем */
.section-header h3 {
  font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: .06em; font-size: 15px; color: var(--text-muted); font-weight: 600;
}

/* Карточка: полоса-статус слева (как в шаблоне), а не сверху */
.device-card::before {
  top: 0; bottom: 0; right: auto; width: 4px; height: auto;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* Строка ID · округ под названием */
.device-card-id {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.device-card-name { font-family: var(--font-display); font-size: 17px; letter-spacing: .01em; }

/* Лампа-маяк — сигнатурный индикатор состояния балки */
.lamp {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--card-2); border: 1px solid var(--border);
}
.lamp i { width: 11px; height: 11px; border-radius: 50%; background: var(--gray); opacity: .45; transition: .2s; }
.device-card.s-on:not(.beacon-live) .lamp i {
  background: var(--success); opacity: 1;
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--success) 60%, transparent);
}
.device-card.beacon-live .lamp {
  border-color: color-mix(in srgb, var(--beacon) 55%, transparent);
  box-shadow: 0 0 0 3px var(--beacon-soft), 0 0 20px 3px var(--beacon-glow);
}
.device-card.beacon-live .lamp i {
  background: var(--beacon); opacity: 1;
  box-shadow: 0 0 10px 2px var(--beacon);
  animation: beacon-flash 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .device-card.beacon-live .lamp i { animation: none; } }

/* Метрики в строку (метка слева — значение справа) с пунктирным разделителем */
.device-card-metrics .metric {
  flex-direction: row; justify-content: space-between; align-items: baseline;
  gap: 10px; border-bottom: 1px dashed var(--border); padding-bottom: 5px;
}
.metric-value.warn { color: var(--beacon); }
.metric-value.crit { color: var(--danger); }

/* «Всего» — синий приборный акцент */
.kpi-card[data-kpi-filter="all"] { border-left-color: var(--info); }

/* Батарея — чуть толще и с воздухом сверху (как в шаблоне) */
.battery-bar { height: 6px; margin-top: 11px; }

/* Счётчик у заголовка секции */
.section-header .sect-count {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
  font-weight: 400; margin-left: 10px;
}

/* Нативные контролы (селекты, скроллбары, дата-пикеры) — в тон теме */
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

/* Leaflet: «хвостик» и кнопка закрытия попапа — под тёмную карточку */
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-close-button { color: var(--text-muted) !important; }
.gpu-manager-modal {
  width: min(1240px, calc(100vw - 32px));
  max-width: 1240px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.gpu-camera-form-modal {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
}

.gpu-live-modal {
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.gpu-zones-modal {
  display: flex;
  flex-direction: column;
  width: calc(100vw - 20px);
  max-width: none;
  height: calc(100vh - 20px);
  max-height: none;
  overflow: hidden;
  border-radius: 8px;
}

.gpu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.gpu-modal-header h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.gpu-header-actions,
.gpu-camera-actions,
.gpu-zone-tools,
.gpu-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gpu-muted {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.gpu-manager-body {
  max-height: calc(100vh - 112px);
  padding: 16px 18px 20px;
  overflow: auto;
}

.gpu-manager-toolbar {
  position: sticky;
  top: -16px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 0 12px;
  background: var(--bg-card, var(--bg-secondary));
}

.gpu-manager-toolbar .input-field {
  flex: 1 1 145px;
  width: auto;
  min-width: 130px;
  height: 36px;
}

#gpu-filter-search {
  flex-basis: 230px;
}

#gpu-sort {
  flex-basis: 190px;
}

.gpu-filter-reset {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.gpu-camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.gpu-camera-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card, var(--bg-secondary));
}

.gpu-camera-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111820;
}

.gpu-camera-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gpu-camera-state {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  color: #fff;
  background: rgba(24, 32, 40, .84);
  font-size: 11px;
  font-weight: 600;
}

.gpu-camera-state.is-online {
  background: rgba(13, 135, 80, .9);
}

.gpu-camera-state.is-offline {
  background: rgba(190, 48, 48, .92);
}

.gpu-camera-info {
  min-width: 0;
  padding: 12px 14px;
}

.gpu-camera-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gpu-camera-name {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.gpu-camera-id {
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-family: monospace;
  font-size: 11px;
}

.gpu-camera-district {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 11px;
}

.gpu-camera-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.gpu-roi-badge {
  color: #0d8750;
  border-color: rgba(13, 135, 80, .35);
  background: rgba(13, 135, 80, .1);
}

.gpu-speed-badge {
  color: #c83edc;
  border-color: rgba(200, 62, 220, .38);
  background: rgba(200, 62, 220, .1);
}

.gpu-camera-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.gpu-camera-metric {
  min-width: 0;
  padding: 7px 8px;
  border-left: 2px solid #3b82f6;
  background: var(--bg-secondary);
}

.gpu-camera-metric:nth-child(2) {
  border-color: #19a565;
}

.gpu-camera-metric:nth-child(3) {
  border-color: #e5a800;
}

.gpu-camera-metric:nth-child(4) {
  border-color: #a879ff;
}

.gpu-camera-metric:nth-child(5) {
  border-color: #ef5da8;
}

.gpu-camera-metric:nth-child(6) {
  border-color: #06a5bd;
}

.gpu-camera-metric span {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-camera-metric strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-camera-actions {
  flex-wrap: wrap;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
}

.gpu-camera-actions .btn {
  flex: 1 1 auto;
}

.gpu-camera-actions .gpu-delete-button {
  flex: 0 0 40px;
  width: 40px;
  padding: 0;
  justify-content: center;
}

.gpu-empty {
  grid-column: 1 / -1;
  padding: 42px 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  text-align: center;
}

.gpu-camera-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.gpu-camera-form .form-group {
  min-width: 0;
  margin: 0;
}

.gpu-form-wide {
  grid-column: 1 / -1;
}

.gpu-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.gpu-form-error {
  min-height: 18px;
  color: var(--danger, #c62828);
  font-size: 12px;
}

.gpu-form-actions {
  justify-content: flex-end;
}

.gpu-live-stage {
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  background: #111820;
}

.gpu-live-stage img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 104px);
  object-fit: contain;
}

.gpu-live-header-actions,
.gpu-live-modes {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gpu-live-modes {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.gpu-live-modes button {
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.gpu-live-modes button:last-child {
  border-right: 0;
}

.gpu-live-modes button.active {
  color: #fff;
  background: var(--primary);
}

.gpu-zones-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
  max-height: none;
}

.gpu-zone-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
  border-right: 1px solid var(--border);
}

.gpu-editor-modes,
.gpu-speed-line-select {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 36px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.gpu-editor-modes button,
.gpu-speed-line-select button {
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.gpu-editor-modes button:last-child,
.gpu-speed-line-select button:last-child {
  border-right: 0;
}

.gpu-editor-modes button.active {
  color: #fff;
  background: var(--primary);
}

#gpu-zone-controls,
.gpu-speed-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#gpu-zone-controls[hidden],
.gpu-speed-controls[hidden] {
  display: none;
}

.gpu-speed-line-select button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gpu-speed-line-select button.active {
  color: var(--text);
  background: var(--bg-secondary);
  box-shadow: inset 0 -2px var(--speed-color);
}

.gpu-speed-line-select button[data-gpu-speed-line="line_a"] {
  --speed-color: #28bde9;
}

.gpu-speed-line-select button[data-gpu-speed-line="line_b"] {
  --speed-color: #df56f4;
}

.gpu-speed-swatch {
  width: 12px;
  height: 3px;
  background: var(--speed-color);
}

.gpu-zone-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gpu-zone-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: left;
}

.gpu-zone-list button.active {
  border-color: #3b82f6;
  box-shadow: inset 3px 0 #3b82f6;
}

.gpu-zone-swatch {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.gpu-zone-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-zone-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
}

.gpu-danger-action {
  color: var(--danger, #c62828);
}

.gpu-zone-tools {
  flex-wrap: wrap;
}

.gpu-zone-tools .btn {
  min-height: 34px;
}

.gpu-zone-tools .btn:disabled,
.gpu-zone-sidebar > .btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.gpu-zone-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #111820;
}

.gpu-zone-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.gpu-zone-stage canvas {
  position: absolute;
  cursor: default;
  touch-action: none;
  outline: none;
}

.gpu-zone-stage canvas.is-drawing {
  cursor: crosshair;
}

.gpu-zone-stage canvas.is-speed {
  cursor: crosshair;
}

.gpu-zone-stage canvas.is-over-vertex {
  cursor: grab;
}

.gpu-zone-stage canvas.is-over-edge {
  cursor: copy;
}

.gpu-zone-stage canvas.is-dragging {
  cursor: grabbing;
}

.gpu-zone-stage canvas:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(53, 167, 255, .9);
}

.gpu-zone-loading {
  position: absolute;
  padding: 7px 10px;
  border-radius: 4px;
  color: #fff;
  background: rgba(17, 24, 32, .86);
  font-size: 12px;
}

@media (max-width: 760px) {
  #modal-gpu-cameras { z-index: 1110; }
  #modal-gpu-camera-form,
  #modal-gpu-live,
  #modal-gpu-zones { z-index: 1120; }

  #modal-gpu-zones {
    align-items: stretch;
    padding: 0;
  }

  .gpu-manager-modal,
  .gpu-camera-form-modal,
  .gpu-live-modal,
  .gpu-zones-modal {
    width: 100vw;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .gpu-zones-modal {
    height: 100vh;
    max-height: none;
  }

  .gpu-camera-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gpu-manager-toolbar {
    top: -16px;
  }

  .gpu-manager-toolbar .input-field,
  #gpu-filter-search,
  #gpu-sort {
    flex-basis: calc(50% - 4px);
    min-width: 0;
  }

  #gpu-filter-search {
    flex-basis: 100%;
  }

  .gpu-camera-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .gpu-camera-form .form-group,
  .gpu-form-wide {
    grid-column: 1;
  }

  .gpu-zones-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(190px, auto) minmax(0, 1fr);
    min-height: 0;
    max-height: none;
  }

  .gpu-zone-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    max-height: 300px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .gpu-zone-list,
  .gpu-editor-modes,
  #gpu-zone-controls,
  .gpu-speed-controls,
  .gpu-zone-sidebar .form-group,
  .gpu-zone-sidebar > .btn:last-child {
    grid-column: 1 / -1;
  }

  .gpu-zone-list {
    flex-direction: row;
    overflow-x: auto;
  }

  .gpu-zone-list button {
    flex: 0 0 150px;
  }

  .gpu-zone-stage {
    min-height: 0;
  }
}

/* Native Helpdesk */
.helpdesk-native-header {
  margin-bottom: 14px;
}

.helpdesk-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.helpdesk-metric {
  display: flex;
  min-width: 0;
  min-height: 68px;
  padding: 12px 16px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.helpdesk-metric:last-child { border-right: 0; }
.helpdesk-metric:hover { background: var(--bg-hover); }
.helpdesk-metric.active { box-shadow: inset 3px 0 0 var(--primary); background: var(--primary-light); }
.helpdesk-metric span { font-size: 11px; font-weight: 600; }
.helpdesk-metric strong { color: var(--text); font-size: 22px; line-height: 1.1; }
.helpdesk-metric[data-helpdesk-state="overdue"] strong { color: var(--warning); }
.helpdesk-metric[data-helpdesk-state="open"] strong { color: var(--info); }
.helpdesk-metric[data-helpdesk-state="closed"] strong { color: var(--success); }

.helpdesk-native-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.helpdesk-native-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 1fr) minmax(140px, .7fr) minmax(160px, .75fr);
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.helpdesk-native-filters .input-sm,
.helpdesk-native-filters .select-sm {
  width: 100%;
  min-width: 0;
  height: 36px;
}
.helpdesk-period-filters .btn-icon { width: 36px; height: 36px; }
.helpdesk-native-panel > .active-filter-summary { margin: 8px 12px; }
.table-skeleton-line { display: block; height: 14px; width: 80%; border-radius: 3px; }
.ai-panel-state { width: 100%; min-width: 0; padding: 16px 0; color: var(--text-muted); font-size: 13px; }
.ai-panel-state > .btn { margin-top: 12px; }
#ai-hourly-chart > .ai-panel-state { align-self: center; }
.ai-state-skeleton { display: grid; gap: 8px; margin-top: 16px; }
.ai-state-skeleton > span { display: block; min-width: 0; border-radius: 4px; }
.ai-state-rows { grid-template-columns: 1fr; }
.ai-state-rows > span { height: 18px; }
.ai-state-rows > span:nth-child(even) { width: 75%; }
.ai-state-bars { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; height: 180px; }
.ai-state-bars > span { height: var(--bar-height); }
.ai-state-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ai-state-tiles > span { aspect-ratio: 16 / 9; }
@media (max-width: 600px) {
  .ai-state-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-state-bars { gap: 4px; }
  .ai-gost-toolbar .ai-period-toggle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; overflow: visible; }
  .ai-gost-toolbar .ai-period-toggle .map-toggle-btn { min-width: 0; min-height: 38px; padding: 8px 4px; white-space: nowrap; justify-content: center; }
}
.helpdesk-loading-label { color: var(--text-muted); font-size: 12px; }
.helpdesk-native-error p { margin: 0 0 12px; }

@media (min-width: 769px) {
  #view-devices > .table-wrapper,
  #view-events > .table-wrapper,
  .helpdesk-table-wrap { max-height: 65vh; overflow: auto; scrollbar-gutter: stable; }
  #devices-table thead th,
  #journal-table thead th,
  .helpdesk-native-table thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px var(--border); }
  #devices-table :is(th, td):is(:nth-child(6), :nth-child(7), :nth-child(8)) { text-align: right; font-variant-numeric: tabular-nums; }
  #devices-table th:is(:nth-child(6), :nth-child(7), :nth-child(8)) .table-sort-button { justify-content: flex-end; }
}
.data-table tbody tr:focus-within { background: var(--card-2); outline: 2px solid var(--info); outline-offset: -2px; }
.data-table th:is([aria-sort='ascending'], [aria-sort='descending']) { box-shadow: inset 0 -2px var(--info); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

.helpdesk-date-field {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr);
  gap: 6px;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
}

.helpdesk-period-filters {
  display: flex;
  grid-column: 1 / -1;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.helpdesk-month-field { grid-template-columns: auto minmax(150px, 1fr); }
.helpdesk-period-filters .btn-icon { flex: 0 0 34px; height: 34px; }

.helpdesk-table-wrap { overflow-x: auto; }
.helpdesk-native-table { min-width: 980px; }
.helpdesk-native-table th { white-space: nowrap; }
.helpdesk-native-table td { vertical-align: middle; }
.helpdesk-native-table td:nth-child(2) { width: 32%; }
.helpdesk-native-table td:nth-child(3) { width: 24%; }
.helpdesk-native-table td span { display: block; color: var(--text-muted); font-size: 11px; }

.helpdesk-ticket-row { cursor: pointer; transition: background-color .15s ease; }
.helpdesk-ticket-row:hover,
.helpdesk-ticket-row:focus-visible { background: var(--bg-hover); outline: none; }
.helpdesk-ticket-row:focus-visible { box-shadow: inset 3px 0 0 var(--primary); }
.helpdesk-ticket-number { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.helpdesk-ticket-subject-native { display: block; color: var(--text); font-size: 13px; line-height: 1.3; }
.helpdesk-ticket-created { margin-top: 3px; }
.helpdesk-ticket-updated { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

.helpdesk-status-badge {
  display: inline-flex !important;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary) !important;
  background: var(--bg-secondary);
  font-size: 11px !important;
  font-weight: 600;
  white-space: nowrap;
}

.helpdesk-status-badge i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.helpdesk-native-state {
  height: 120px;
  padding: 28px !important;
  color: var(--text-muted);
  text-align: center;
}

.helpdesk-native-error { color: var(--danger); }

.helpdesk-native-pagination {
  display: flex;
  min-height: 52px;
  padding: 9px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.helpdesk-native-pagination > div { display: flex; align-items: center; gap: 8px; }
.helpdesk-page-current { min-width: 72px; text-align: center; }

.helpdesk-ticket-modal-card {
  width: min(1080px, 100%);
  max-width: 1080px;
  max-height: 92vh;
  border-radius: 8px;
}

.helpdesk-ticket-modal-card .modal-header { align-items: flex-start; }
.helpdesk-ticket-modal-card .modal-header h3 { max-width: 760px; margin-top: 2px; font-size: 18px; line-height: 1.3; }
.helpdesk-ticket-modal-body { padding: 0; }
.helpdesk-detail-topline { display: flex; padding: 12px 18px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.helpdesk-detail-status,
.helpdesk-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.helpdesk-detail-actions { justify-content: flex-end; }
.helpdesk-detail-actions .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.helpdesk-detail-actions .ui-icon { width: 15px; height: 15px; }
.helpdesk-priority { color: var(--text-muted); font-size: 12px; }

.helpdesk-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.helpdesk-detail-meta {
  min-width: 0;
  padding: 12px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.helpdesk-detail-meta:nth-child(3n) { border-right: 0; }
.helpdesk-detail-meta:nth-last-child(-n+3) { border-bottom: 0; }
.helpdesk-detail-meta span { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.helpdesk-detail-meta strong { display: block; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-detail-meta strong.text-danger { color: var(--danger); }

.helpdesk-detail-section { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.helpdesk-detail-section:last-child { border-bottom: 0; }
.helpdesk-detail-section h4 { margin-bottom: 10px; color: var(--text); font-size: 13px; }
.helpdesk-detail-section h4 span { margin-left: 5px; color: var(--text-muted); font-weight: 500; }
.helpdesk-description { color: var(--text-secondary); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.helpdesk-comments { display: grid; gap: 8px; }
.helpdesk-comment { padding: 10px 12px; border-left: 2px solid var(--border); background: var(--bg-secondary); }
.helpdesk-comment > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.helpdesk-comment strong { font-size: 12px; }
.helpdesk-comment span,
.helpdesk-comment em { color: var(--text-muted); font-size: 10px; font-style: normal; }
.helpdesk-comment em { color: var(--warning); }
.helpdesk-comment p { margin-top: 5px; color: var(--text-secondary); font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.helpdesk-detail-empty { padding: 10px 0; color: var(--text-muted); font-size: 12px; }

.helpdesk-attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.helpdesk-attachment {
  display: flex;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg-secondary);
  text-align: left;
  cursor: pointer;
}
.helpdesk-attachment:hover { border-color: var(--primary); background: var(--bg-hover); }
.helpdesk-attachment:disabled { opacity: .55; cursor: wait; }
.helpdesk-attachment-icon { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border-radius: 5px; color: var(--primary); background: var(--primary-light); font-weight: 700; }
.helpdesk-attachment-icon .ui-icon { width: 15px; height: 15px; }
.helpdesk-attachment > span:last-child { min-width: 0; }
.helpdesk-attachment strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-attachment small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 10px; }

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

.helpdesk-media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.helpdesk-media-card.is-loading { display: grid; min-height: 210px; grid-template-rows: 1fr auto; }
.helpdesk-media-loading,
.helpdesk-media-error { display: grid; min-height: 170px; place-items: center; color: var(--text-muted); font-size: 12px; }
.helpdesk-media-card video { display: block; width: 100%; aspect-ratio: 16 / 10; max-height: 420px; background: var(--bg-secondary); object-fit: contain; }
.helpdesk-media-open { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; background: var(--bg-secondary); cursor: zoom-in; }
.helpdesk-media-open img { display: block; width: 100%; aspect-ratio: 16 / 10; max-height: 420px; object-fit: cover; transition: transform .2s ease; }
.helpdesk-media-open:hover img { transform: scale(1.015); }
.helpdesk-media-open > .ui-icon { position: absolute; right: 9px; bottom: 9px; width: 28px; height: 28px; padding: 6px; border-radius: 5px; color: #fff; background: rgba(0,0,0,.65); }
.helpdesk-media-caption { display: flex; min-width: 0; padding: 8px 10px; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); color: var(--text); background: var(--card); }
.helpdesk-media-caption strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-media-caption span { flex: 0 0 auto; color: var(--text-muted); font-size: 10px; }

.modal-overlay.helpdesk-media-viewer { z-index: 1150; align-items: center; padding: 24px; background: rgba(15,23,42,.42); backdrop-filter: blur(5px); }
.helpdesk-media-viewer-frame {
  display: grid;
  width: min(980px, 100%);
  height: min(760px, 88dvh);
  max-height: 88dvh;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.helpdesk-media-viewer-head { display: flex; min-height: 52px; padding: 8px 14px; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.helpdesk-media-viewer-head > div { display: flex; min-width: 0; align-items: baseline; gap: 10px; }
.helpdesk-media-viewer-head .helpdesk-media-viewer-info { flex: 1; flex-direction: column; align-items: stretch; gap: 3px; }
.helpdesk-media-viewer-head > button { flex-shrink: 0; width: 36px; height: 36px; }
#helpdesk-media-viewer-counter { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.helpdesk-media-viewer-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-media-viewer-head span { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.helpdesk-media-viewer-head .modal-close { color: var(--text); }
.helpdesk-media-viewer-body { position: relative; display: grid; min-height: 0; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 12px; padding: 12px; align-items: center; background: var(--bg-secondary); }
.helpdesk-media-viewer-stage { position: relative; display: grid; width: 100%; height: 100%; min-height: 0; min-width: 0; place-items: center; }
.helpdesk-media-viewer-loading { gap: 12px; justify-items: center; color: var(--text-muted); font-size: 13px; text-align: center; }
.helpdesk-media-viewer-stage img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.helpdesk-media-nav {
  position: static;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: var(--card);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  cursor: pointer;
}
.helpdesk-media-nav:hover { color: var(--primary); border-color: var(--primary); }
.helpdesk-media-nav .ui-icon { width: 24px; height: 24px; }
.helpdesk-media-nav-prev { left: 24px; }
.helpdesk-media-nav-next { right: 24px; }

@media (max-width: 1180px) {
  .helpdesk-native-filters { grid-template-columns: 1fr 1fr; }
  .helpdesk-date-field { grid-template-columns: auto 1fr; }
}

@media (max-width: 700px) {
  .helpdesk-metrics { grid-template-columns: repeat(2, 1fr); }
  .helpdesk-metric:nth-child(2) { border-right: 0; }
  .helpdesk-metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .helpdesk-native-filters { grid-template-columns: 1fr 1fr; }
  #helpdesk-filter-search,
  #helpdesk-filter-device { grid-column: 1 / -1; }
  .helpdesk-period-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .helpdesk-month-field { grid-column: 1 / -1; }
  .helpdesk-period-filters .btn-icon { justify-self: end; }
  .helpdesk-native-pagination { align-items: flex-start; flex-direction: column; }
  .helpdesk-detail-grid { grid-template-columns: 1fr; }
  .helpdesk-detail-meta,
  .helpdesk-detail-meta:nth-child(3n),
  .helpdesk-detail-meta:nth-last-child(-n+3) { border-right: 0; border-bottom: 1px solid var(--border); }
  .helpdesk-detail-meta:last-child { border-bottom: 0; }
  .helpdesk-detail-topline { align-items: stretch; flex-direction: column; }
  .helpdesk-detail-actions { justify-content: flex-start; }
  .helpdesk-media-grid { grid-template-columns: 1fr; }
  .helpdesk-attachments { grid-template-columns: 1fr; }
  .modal-overlay.helpdesk-media-viewer { padding: 8px; }
  .helpdesk-media-viewer-frame { height: 94dvh; max-height: 94dvh; }
  .helpdesk-media-viewer-head { gap: 6px; padding: 8px; }
  .helpdesk-media-viewer-body { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) 42px; gap: 8px; padding: 8px; }
  .helpdesk-media-viewer-stage { grid-column: 1 / -1; grid-row: 1; }
  .helpdesk-media-nav-prev { grid-column: 1; grid-row: 2; justify-self: end; }
  .helpdesk-media-nav-next { grid-column: 2; grid-row: 2; justify-self: start; }
  .helpdesk-media-nav { width: 38px; height: 38px; }
  .helpdesk-media-nav-prev { left: 8px; }
  .helpdesk-media-nav-next { right: 8px; }
}

/* Mobile usability pass */
@media (max-width: 760px) {
  html { overflow: hidden; }
  body.mobile-menu-open .main-content { overflow: hidden; }

  .hamburger {
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    width: 42px;
    height: 42px;
  }

  .sidebar {
    width: min(280px, calc(100vw - 48px));
    min-width: 0;
    max-width: calc(100vw - 48px);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
    transition: none;
  }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar:not(.open) { transform: translateX(-100%) !important; }
  .nav-item { min-height: 44px; }

  .sidebar-overlay { backdrop-filter: blur(2px); }
  .main-content {
    overflow-x: hidden;
    padding-top: calc(62px + env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .btn,
  .input-sm,
  .select-sm,
  .input-field,
  select {
    min-height: 40px;
  }

  .btn-icon,
  .modal-close { min-width: 40px; width: 40px; height: 40px; }

  .page-header { margin-bottom: 14px; }
  .page-subtitle { line-height: 1.35; }
  .page-actions { gap: 8px; }
  #view-map .map-layer-toggle {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #view-map .map-layer-toggle::-webkit-scrollbar { display: none; }

  .modal-overlay {
    align-items: flex-end;
    padding: max(4px, env(safe-area-inset-top)) 4px 0;
  }
  .modal-card {
    width: 100%;
    min-width: 0 !important;
    max-height: calc(100dvh - max(4px, env(safe-area-inset-top)));
    border-radius: 10px 10px 0 0;
    resize: none !important;
  }
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px 14px;
    background: var(--card);
  }
  .modal-header h3 { line-height: 1.25; }
  .modal-body { padding: 14px; }
  .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
    background: var(--card);
  }
  .modal-footer .btn { flex: 1 1 120px; }

  /* Operational lists become scan-friendly cards instead of clipped rows. */
  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table { min-width: 0 !important; background: transparent; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table tbody { display: grid; gap: 9px; }
  .mobile-card-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--card);
    box-shadow: var(--shadow-card);
  }
  .mobile-card-table tbody tr:hover { background: var(--card); }
  .mobile-card-table tbody td {
    display: grid;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 38px;
    padding: 8px 10px !important;
    grid-template-columns: minmax(88px, .75fr) minmax(0, 1.25fr);
    gap: 10px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border-light);
    text-align: right;
    overflow-wrap: anywhere;
  }
  .mobile-card-table tbody td:last-child { border-bottom: 0; }
  .mobile-card-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
  }
  .mobile-card-table tbody td > * { min-width: 0; }
  .mobile-card-table tbody td strong,
  .mobile-card-table tbody td span { overflow-wrap: anywhere; }
  .mobile-card-table tbody td[colspan] {
    display: block;
    padding: 24px 12px !important;
    text-align: center;
  }
  .mobile-card-table tbody td[colspan]::before { display: none; }
  .mobile-card-table .card-actions { justify-content: flex-end; }
  .mobile-card-table .tbl-device-name {
    display: inline-block;
    padding: 3px 0;
    font-weight: 700;
  }
  #devices-table tbody tr,
  .helpdesk-native-table tbody tr { cursor: pointer; }
  #devices-table + *,
  .helpdesk-table-wrap { overflow: visible; }

  /* Device detail */
  .view-dd { margin: 0 -10px; }
  .dd-layout { width: 100%; overflow: hidden; }
  .dd-sidebar {
    width: 100%;
    max-height: min(56vh, 360px);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .dd-layout.dd-sidebar-collapsed .dd-sidebar { max-height: 45px; }
  .dd-main { width: 100%; padding: 10px; gap: 10px; }
  .dd-titlebar { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; padding: 4px 0; }
  .dd-titlebar-actions { gap: 4px; }
  .dd-titlebar-actions .btn { min-height: 38px; padding: 6px 9px; }
  .dd-toolbar { width: 100%; padding: 10px; align-items: stretch; }
  .dd-toolbar-controls { width: 100%; flex-wrap: wrap; flex-shrink: 1; }
  .dd-toolbar-controls .btn { flex: 1 1 54px; }
  .dd-toolbar-controls .input-sm { min-height: 40px; }
  .dd-toolbar-period { width: 100%; margin-left: 0; align-items: stretch; }
  .dd-toolbar-period > .dd-toolbar-label { width: 100%; }
  .dd-period-btns { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dd-period-btns .btn { min-width: 0; padding-right: 5px; padding-left: 5px; }
  .dd-period-custom { display: grid; width: 100%; margin-left: 0; grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); }
  .dd-period-custom input { width: 100%; min-width: 0; }
  .dd-period-custom .btn { grid-column: 1 / -1; width: 100%; }
  .dd-card-chart .dd-chart-wrap { height: 260px; padding-right: 6px; padding-left: 6px; }

  /* Cameras */
  #view-cameras [data-cam-view] { min-height: 38px; }
  .cam-object-actions .btn,
  .cam-object-actions .cam-refresh-btn { min-height: 38px; }

  /* Reports and device analytics */
  .report-filters { padding: 12px !important; overflow: hidden; }
  .report-filters .filter-row { display: grid !important; width: 100%; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .report-period-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .report-period-presets .report-preset { width: 100%; }
  .report-period-presets .report-preset:last-child { grid-column: 1 / -1; }
  .report-date-range { display: grid !important; width: 100%; grid-template-columns: 24px minmax(0, 1fr); gap: 6px 8px !important; }
  .report-date-range input { width: 100%; min-width: 0; }
  #btn-report-generate { width: 100%; }
  #view-analytics .analytics-actions { display: grid !important; width: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #view-analytics .analytics-actions #analytics-date { grid-column: 1 / -1; width: 100% !important; }
  #view-analytics .analytics-actions .btn { min-width: 0; padding-right: 8px; padding-left: 8px; white-space: normal; }
  #analytics-search { width: 100% !important; margin-left: 0 !important; }

  /* Local weather station */
  #weather-charts { grid-template-columns: minmax(0, 1fr) !important; }
  #weather-charts > div { width: 100%; min-width: 0; }
  #weather-charts canvas { width: 100% !important; max-width: 100% !important; }

  /* Helpdesk */
  .helpdesk-native-panel { overflow: visible; background: transparent; border: 0; }
  .helpdesk-native-filters { border: 1px solid var(--border); border-radius: 7px; background: var(--card); }
  .helpdesk-table-wrap { margin-top: 10px; }
  .helpdesk-ticket-modal-card { max-height: calc(100dvh - 4px); }
  .helpdesk-detail-actions .btn { flex: 1 1 145px; justify-content: center; }

  /* AI keeps comparison matrices scrollable, but makes touch targets clear. */
  .ai-tabs,
  .ai-period-toggle { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .ai-tabs::-webkit-scrollbar,
  .ai-period-toggle::-webkit-scrollbar { display: none; }
  .ai-tab,
  .map-toggle-btn { min-height: 40px; }
  .ai-lane-table-wrap,
  .ai-compact-table-wrap { -webkit-overflow-scrolling: touch; }
  .ai-speed-pagination { flex-wrap: wrap; }
  #modal-ai-event button { min-height: 40px; }
  #ai-snapshots .ai-event-card {
    width: calc(50% - 4px) !important;
    margin: 2px !important;
  }
  #ai-snapshots .ai-event-thumb {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10;
  }

  /* Settings */
  .settings-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .settings-tab { flex: 0 0 auto; min-height: 42px; }
  .section-header .btn { width: 100%; }
}

@media (max-width: 480px) {
  .main-content { padding-right: 8px; padding-left: 8px; }
  .view-dd { margin-right: -8px; margin-left: -8px; }
  .kpi-card { min-width: 0; }
  .kpi-value { overflow-wrap: anywhere; }
  .ai-speed-events { grid-template-columns: minmax(0, 1fr); }
  .helpdesk-native-table td:nth-child(5),
  .helpdesk-native-table td:nth-child(6) { display: none; }
  #devices-table td:nth-child(3),
  #devices-table td:nth-child(4),
  #devices-table td:nth-child(8),
  #users-tbody td:first-child { display: none; }
  .mobile-card-table tbody td { grid-template-columns: minmax(78px, .7fr) minmax(0, 1.3fr); }
  .camera-player-header { grid-template-columns: minmax(0, 1fr) 124px 40px; gap: 4px; }
  .camera-player-mode { min-width: 62px; padding: 0 5px; }
  .camera-player { grid-template-rows: auto minmax(0, 1fr) auto; }
}

/* User activity */
.activity-panel {
  min-width: 0;
  padding-bottom: 28px;
}

.activity-toolbar,
.activity-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.activity-toolbar { margin-bottom: 18px; }
.activity-toolbar h3,
.activity-section-header h4 { margin: 0; }
.activity-toolbar p,
.activity-section-header span {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.activity-toolbar .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

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

.activity-metric {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: 6px;
  background: var(--bg-secondary);
}

.activity-metric-online { border-left-color: var(--success); }
.activity-metric:nth-child(3) { border-left-color: var(--warning); }
.activity-metric:nth-child(4) { border-left-color: var(--primary); }
.activity-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}
.activity-metric strong {
  display: block;
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
}

.activity-section {
  padding: 18px 0 22px;
  border-top: 1px solid var(--border);
}
.activity-section-header { margin-bottom: 12px; }
.activity-users-wrap,
.activity-log-wrap {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.activity-users-table { min-width: 880px; }
#audit-table { min-width: 790px; }

.activity-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.activity-status i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--text-light);
}
.activity-status.is-online { color: var(--success); }
.activity-status.is-online i {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 16%, transparent);
}
.activity-table-sub {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}
.activity-ip {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
}
.activity-time { white-space: nowrap; font-size: 11px; }
.activity-empty {
  padding: 24px !important;
  color: var(--text-muted);
  text-align: center !important;
}
.activity-error { color: var(--danger); }

.activity-filters {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}
.activity-filters .input-field { min-width: 0; height: 38px; }
.activity-filters .btn { min-height: 38px; }

.activity-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-left: 2px solid var(--text-light);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}
.activity-action-auth { border-left-color: var(--success); }
.activity-action-navigation { border-left-color: var(--info); }
.activity-action-control { border-left-color: var(--warning); }
.activity-action-admin { border-left-color: var(--primary); }

.activity-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .activity-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-filters .btn { width: 100%; }
}

@media (max-width: 700px) {
  .activity-toolbar { align-items: flex-start; }
  .activity-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-filters { grid-template-columns: minmax(0, 1fr); }
  .activity-toolbar .btn { min-width: 42px; padding: 8px; font-size: 0; }
  .activity-toolbar .btn .ui-icon { width: 18px; height: 18px; }
  .activity-metric { padding: 12px; }
  .activity-metric strong { font-size: 21px; }
  .activity-pagination { justify-content: center; }
}


/* /css/traffic-objects.css?v=20260907b */
.traffic-ui { color: var(--text); letter-spacing: 0; }
#view-map > .page-header { flex-wrap: wrap; }
#view-map > .page-header > div:first-child { flex: 1 0 100%; }
#view-map > .page-header .page-actions { width: 100%; flex-wrap: wrap; gap: 10px; }
#view-map .map-layer-toggle { flex-shrink: 0; max-width: 100%; overflow-x: auto; }
.traffic-ui * { box-sizing: border-box; letter-spacing: 0; }
.traffic-ui h1 { font-size: 24px; margin: 0; }
.traffic-ui h2 { font-size: 16px; margin: 0 0 14px; }
.traffic-ui h3 { font-size: 14px; margin: 0 0 12px; }
.traffic-ui p { line-height: 1.6; }
.traffic-ui button, .traffic-ui input, .traffic-ui select, .traffic-ui textarea { font: inherit; }
.traffic-ui button { cursor: pointer; }
.traffic-ui button:disabled { opacity: .5; cursor: default; }
.traffic-ui button:focus-visible, .traffic-ui input:focus-visible, .traffic-ui select:focus-visible, .traffic-ui textarea:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }
.traffic-head, .traffic-actions, .traffic-tabs, .traffic-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.traffic-head { justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.traffic-head small { display: block; color: var(--text-muted); margin-top: 5px; }
.traffic-btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 6px; padding: 8px 12px; min-height: 38px; text-decoration: none; }
.traffic-btn.icon { width: 38px; flex: 0 0 38px; padding: 0; }
.traffic-btn.primary { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.traffic-btn:hover { filter: brightness(.96); }
.traffic-status { font-size: 12px; display: inline-flex; gap: 6px; align-items: center; color: var(--text-muted); }
.traffic-status.project { color: var(--warning); }
.traffic-tabs { border-bottom: 1px solid var(--border); gap: 0; margin-bottom: 20px; }
.traffic-tabs button { background: none; color: var(--text-muted); border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; white-space: nowrap; }
.traffic-tabs button[aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); }
.traffic-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); border-bottom: 1px solid var(--border); margin-bottom: 20px; padding-bottom: 18px; gap: 18px; }
.traffic-metrics span { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 5px; }
.traffic-metrics strong { font-size: 18px; font-weight: 700; }
.traffic-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 20px; align-items: start; }
.traffic-stage { position: relative; height: 510px; min-width: 0; overflow: hidden; background: var(--card-2); }
.traffic-stage canvas, .traffic-stage iframe { border: 0; display: block; width: 100%; height: 100%; }
.traffic-stage canvas { touch-action: none; }
.traffic-tools { margin-bottom: 10px; justify-content: space-between; }
.traffic-mode { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.traffic-mode button { background: var(--card); color: var(--text-muted); border: 0; padding: 8px 13px; min-height: 36px; }
.traffic-mode button[aria-pressed=true] { background: var(--primary-light); color: var(--primary); }
.traffic-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 5px; }
.traffic-north { position: absolute; left: 14px; top: 12px; font-weight: 700; color: var(--text-muted); font-size: 12px; pointer-events: none; }
.traffic-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.traffic-labels button { position: absolute; transform: translate(-50%,-50%); pointer-events: auto; padding: 5px 9px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 12px; border-radius: 5px; min-width: 36px; min-height: 30px; }
.traffic-labels button[aria-pressed=true] { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
.traffic-inspector { border-left: 1px solid var(--border); padding-left: 20px; min-width: 0; }
.traffic-inspector .traffic-status { margin-bottom: 10px; }
.traffic-inspector p, .traffic-note { font-size: 12px; color: var(--text-muted); }
.traffic-inspector dl { margin: 14px 0; }
.traffic-inspector dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.traffic-inspector dt { color: var(--text-muted); }
.traffic-inspector dd { text-align: right; margin: 0; overflow-wrap: anywhere; }
.traffic-select, .traffic-input { padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--card); max-width: 100%; min-width: 0; }
.traffic-select { width: 100%; margin-bottom: 14px; }
.traffic-layers { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 12px; }
.traffic-layers summary { cursor: pointer; font-size: 13px; }
.traffic-layers label { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 12px; }
.traffic-layers input { accent-color: var(--primary); }
.traffic-band { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 20px; }
.traffic-empty { padding: 22px 0; color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.traffic-error { color: var(--danger); }
.traffic-loading { padding: 50px 20px; text-align: center; color: var(--text-muted); }
.traffic-table-wrap { overflow-x: auto; }
.traffic-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.traffic-table th, .traffic-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.traffic-table th { color: var(--text-muted); font-weight: 600; background: var(--card); }
.traffic-table td small { display: block; color: var(--text-muted); margin-top: 3px; }
.traffic-table tbody tr:hover { background: var(--card); }
.traffic-doc { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.traffic-doc > div { flex: 1; }
.traffic-doc small { display: block; color: var(--text-muted); margin-top: 3px; }
.traffic-form { max-width: 760px; }
.traffic-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.traffic-form label { display: grid; gap: 6px; font-size: 13px; }
.traffic-form input, .traffic-form textarea { width: 100%; }
.traffic-form .wide { grid-column: 1 / -1; }
.traffic-device-options { max-height: 240px; overflow: auto; margin: 12px 0 18px; border: 1px solid var(--border); padding: 12px; }
.traffic-device-options label { display: flex; align-items: center; padding: 6px 0; gap: 8px; }
.traffic-device-options input { width: auto; }
.traffic-cameras { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 12px; }
.traffic-camera { width: 100%; aspect-ratio: 16/9; position: relative; border: 0; background: var(--card-2); color: var(--text-muted); overflow: hidden; }
.traffic-camera img { width: 100%; height: 100%; object-fit: contain; }
.traffic-camera-play { position: absolute; right: 12px; bottom: 12px; padding: 10px; background: #0008; border-radius: 50%; color: white; display: flex; }
.traffic-cameras small { color: var(--text-muted); }
.traffic-map-pin { background: var(--card,#fff); border: 2px solid #b77520; color: #b77520; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; box-shadow: 0 2px 8px #0005; }
.traffic-map-pin .ui-icon { width: 24px; height: 24px; }
.traffic-popup { min-width: 210px; line-height: 1.7; }
.traffic-project-drop { display:flex;flex-direction:column;align-items:center;gap:10px;border:1px dashed var(--border);border-radius:6px;padding:22px;cursor:pointer;margin:16px 0; }
.traffic-project-drop.dragging { outline:2px solid var(--accent, #e30019); }
.traffic-project-drop input { max-width:100%; }
.traffic-project-drop span { font-size:12px;color:var(--text-muted); }
.traffic-project-history .traffic-doc>div:first-child { min-width:0;overflow-wrap:anywhere; }
.traffic-project-preview { display:none;flex-direction:column; }
.traffic-project-preview[open] { display:flex; }
.traffic-project-frame { flex:1;min-height:200px; }
.traffic-project-frame iframe { width:100%;height:100%;border:0;background:#edf1f4; }
.traffic-project-preview footer { padding:12px 16px;border-top:1px solid var(--border);max-height:30%;overflow:auto; }
.traffic-project-preview footer label { display:flex;align-items:center;gap:8px; }
.traffic-popup small { display: block; }
.traffic-popup button { margin-top: 10px; }
.traffic-dialog { width: min(1100px,96vw); max-width: 96vw; height: min(860px,92vh); max-height: 92vh; margin: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); padding: 0; }
.traffic-dialog::backdrop { background: #0007; }
.traffic-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.traffic-dialog header strong { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.traffic-dialog header .traffic-actions { flex-wrap: nowrap; }
.traffic-document-page { height: calc(100% - 82px); overflow: auto; background: #f2f3f5; padding: 12px; }
.traffic-document-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.traffic-document-page.enlarged img { width: max(1100px,150%); height: auto; max-width: none; }
@media(max-width:1000px) { .traffic-layout { grid-template-columns: minmax(0,1fr) 230px; gap: 14px; } .traffic-inspector { padding-left: 14px; } .traffic-stage { height: 460px; } }
@media(max-width:700px) {
  .traffic-head h1 { font-size: 21px; } .traffic-head { align-items: flex-start; }
  .traffic-tabs { flex-wrap: nowrap; overflow-x: auto; } .traffic-tabs button { padding: 12px; }
  .traffic-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
  .traffic-metrics strong { font-size: 16px; }
  .traffic-layout { grid-template-columns: minmax(0,1fr); }
  .traffic-stage { height: 410px; }
  .traffic-inspector { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .traffic-form-grid { grid-template-columns: minmax(0,1fr); }
  .traffic-cameras { grid-template-columns: minmax(0,1fr); }
  .traffic-btn { min-height: 42px; } .traffic-btn.icon { width: 42px; flex-basis: 42px; }
  .traffic-doc { flex-wrap: wrap; } .traffic-table { min-width: 600px; }
}


/* /css/energy-meters.css?v=20260927-consumption */
.energy-card{background:var(--bg-card,var(--bg-secondary));border:1px solid var(--border-color,#334155);border-radius:12px;padding:24px;margin:20px 0}.energy-head{display:flex;justify-content:space-between;align-items:center;gap:16px}.energy-head h2{margin:0}.energy-status{border-radius:20px;padding:6px 12px;font-size:13px}.energy-status.online{color:#16a34a;background:#16a34a18}.energy-status.offline{color:#ea580c;background:#ea580c18}.energy-totals{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin:24px 0}.energy-totals small{display:block;color:var(--text-muted);margin-bottom:8px}.energy-totals strong{font-size:26px;font-variant-numeric:tabular-nums}.energy-history{color:var(--accent,#3b82f6);margin-top:20px}.energy-history svg{display:block;width:100%;max-height:200px}.energy-history small{color:var(--text-muted)}.energy-card .table-wrapper{overflow-x:auto}@media(max-width:700px){.energy-totals{grid-template-columns:1fr}.energy-card{padding:16px}.energy-head{align-items:flex-start;flex-direction:column}}

.energy-toolbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:12px 0}.energy-toolbar [hidden],.energy-toolbar[hidden]{display:none!important}
.section-header[data-collapse] h3[role=button]{cursor:pointer;border-radius:4px}.section-header[data-collapse] h3[role=button]:focus-visible{outline:2px solid var(--primary,#e30613);outline-offset:5px}.energy-form input[type=radio]{width:auto;padding:0;accent-color:var(--primary,#e30613)}
.device-settings-toolbar{margin-bottom:24px}.device-settings-toolbar h3{margin:0}#edit-energy-fields[hidden]{display:none!important}#edit-modal.energy-editing .modal-body>:not(#edit-type-row):not(#edit-energy-fields){display:none!important}#edit-modal.energy-editing #edit-type-row>.form-group:last-child{display:none}#edit-modal.energy-editing #edit-type-row{grid-template-columns:1fr}#edit-modal.energy-editing #edit-energy-fields .energy-card{padding:0;margin:0;border:0;background:transparent}#edit-modal.energy-editing .energy-form>h2{display:none}#edit-modal.energy-editing .energy-form>.energy-toolbar:last-child>button{display:none}#edit-modal.energy-editing .energy-fields{grid-template-columns:repeat(2,minmax(0,1fr))}#edit-modal.energy-editing .energy-form fieldset{padding:12px;margin:16px 0}#edit-modal #modal-save[hidden]{display:none!important}@media(max-width:600px){#edit-modal.energy-editing .energy-fields{grid-template-columns:1fr}#edit-modal.energy-editing .energy-camera-options{grid-template-columns:1fr}}
#edit-modal .modal-card{display:flex;flex-direction:column;overflow:hidden;max-height:90dvh}#edit-modal .modal-header,#edit-modal .modal-footer{flex-shrink:0}#edit-modal .modal-body{min-height:0;overflow-y:auto;flex:1}#edit-energy-fields .energy-form>label{display:flex;flex-direction:column;gap:6px}#edit-energy-fields input:not([type=checkbox]):not([type=radio]),#edit-energy-fields select{width:100%;background:var(--bg-card,#fff);border-color:var(--border,#e2e8f0);font:inherit}#edit-energy-fields #energy-save-status{color:var(--danger,#dc2626)}
.energy-toolbar label,.energy-fields label{display:flex;gap:8px;align-items:center}.energy-fields label{flex-direction:column;align-items:stretch}
.energy-toolbar select,.energy-form input:not([type=checkbox]),.energy-form select,.energy-toolbar input:not([type=checkbox]){background:var(--bg-secondary,#152032);color:var(--text-primary,#e2e8f0);border:1px solid var(--border,#334155);border-radius:6px;padding:8px;max-width:100%}
.energy-charts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.energy-chart-card{min-width:0;border:1px solid var(--border,#334155);border-radius:9px;padding:14px}.energy-chart-card h3{font-size:15px;margin:0 0 12px}.energy-chart-card small{font-weight:normal;color:var(--text-muted,#94a3b8);margin-left:6px}.energy-canvas{height:240px;position:relative}
.energy-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.energy-form fieldset{border:1px solid var(--border,#334155);border-radius:8px;margin:20px 0;padding:16px}.energy-form legend{font-weight:600;padding:0 8px}.energy-camera-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:240px;overflow:auto}.energy-camera-options label{display:flex;align-items:center;gap:8px}#energy-picker{height:280px;border-radius:8px;margin:12px 0}
.energy-camera-summary{display:block;width:100%;margin:7px 0 0;padding:8px;border:1px solid var(--border,#334155);border-radius:6px;background:var(--bg-secondary,#152032);color:var(--text-primary,#e2e8f0);font-size:12px;text-align:center;cursor:pointer}.energy-camera-summary:hover{border-color:#38bdf8}.energy-totals small{display:block}#energy-error{color:var(--danger,#f87171)}#energy-coverage{font-size:11px;line-height:1.5;margin-top:6px}
@media(max-width:900px){.energy-charts,.energy-fields{grid-template-columns:1fr}.energy-camera-options{grid-template-columns:1fr}.energy-canvas{height:220px}}

.energy-explorer{padding:24px!important}.energy-explorer-heading{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:22px}.energy-explorer-heading h2{font-size:24px;margin:5px 0 0;letter-spacing:-.5px}.energy-eyebrow{font-size:10px;letter-spacing:2px;color:var(--text-muted);font-weight:700}.energy-explorer-heading>label{display:flex;align-items:center;gap:10px;color:var(--text-muted);font-size:12px}.energy-explorer select{padding:9px 14px;border:1px solid var(--border,#dbe1e8);border-radius:8px;background:var(--bg-card,#fff);color:var(--text-primary)}
.energy-metric-picker{display:flex;gap:8px;flex-wrap:wrap}.energy-metric-chip{position:relative;cursor:pointer}.energy-metric-chip input,.energy-phase-picker input{position:absolute;opacity:0;width:1px;height:1px}.energy-metric-chip>span{display:flex;gap:10px;align-items:center;padding:10px 12px;border:1px solid var(--border,#dbe1e8);border-radius:8px;color:var(--text-muted);font-size:12px;font-weight:600;transition:background .15s,border-color .15s}.energy-metric-chip small{font-size:10px;font-weight:400;opacity:.7}.energy-metric-chip>span:before{content:'';height:7px;width:7px;flex-shrink:0;border-radius:50%;background:var(--metric-color);opacity:.4}.energy-metric-chip input:checked+span{border-color:var(--metric-color);background:color-mix(in srgb,var(--metric-color) 8%,transparent);color:var(--text-primary)}.energy-metric-chip input:checked+span:before{opacity:1}.energy-metric-chip input:focus-visible+span,.energy-phase-picker input:focus-visible+span{outline:2px solid var(--primary,#3b82f6);outline-offset:3px}
.energy-graph-options{display:flex;justify-content:space-between;gap:14px;align-items:center;flex-wrap:wrap;margin:18px 0;border-top:1px solid var(--border,#e2e8f0);padding-top:15px}.energy-graph-options .energy-toolbar{margin:0;font-size:12px;color:var(--text-muted)}.energy-phase-picker{display:flex;gap:8px;align-items:center;font-size:12px}.energy-phase-picker>span{color:var(--text-muted);margin-right:4px}.energy-phase-picker label{position:relative;cursor:pointer}.energy-phase-picker label span{display:block;padding:6px 10px;border-radius:6px;background:var(--bg-secondary,#f1f5f9);color:var(--text-muted);border:1px solid transparent}.energy-phase-picker input:checked+span{border-color:var(--phase-color);color:var(--text-primary);box-shadow:inset 0 -2px var(--phase-color)}
.energy-main-canvas{height:440px;position:relative;width:100%;min-width:0}.energy-chart-footer{border-top:1px solid var(--border,#e2e8f0);padding-top:14px;margin-top:14px;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;color:var(--text-muted);font-size:10px}.energy-phase-details summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--text-muted);padding:8px 0}.energy-phase-details[open] summary{margin-bottom:10px}.energy-device-id{display:block;font-size:10px;color:var(--text-muted);margin-top:5px}#energy-device-settings{margin-bottom:28px}#energy-settings-detail{scroll-margin-top:20px}.map-energy-summary:not(:empty){margin-top:14px;border-top:1px solid var(--border,#e2e8f0);padding-top:12px}.map-energy-summary .energy-camera-summary{background:color-mix(in srgb,#3b82f6 5%,var(--bg-card,#fff));border-color:color-mix(in srgb,#3b82f6 25%,var(--border,#e2e8f0));font-size:13px;padding:12px;font-weight:600}
@media(max-width:700px){.energy-explorer{padding:16px!important}.energy-explorer-heading{align-items:flex-start;flex-direction:column}.energy-explorer-heading h2{font-size:20px}.energy-main-canvas{height:340px}.energy-metric-chip>span{padding:8px 9px}.energy-metric-chip small{display:none}.energy-phase-picker{flex-wrap:wrap}}
.energy-map-popup{font-size:12px;line-height:1.45;min-width:260px;color:var(--text-primary,#172033)}.energy-map-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.energy-map-heading>strong{font-size:15px}.energy-map-heading .energy-status{font-size:10px;padding:4px 7px;white-space:nowrap}.energy-map-object{color:var(--text-muted,#64748b);margin:6px 0 14px}.energy-map-totals{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px}.energy-map-totals small,.energy-map-camera-values small{display:block;color:var(--text-muted,#64748b);font-size:11px;margin-bottom:5px}.energy-map-totals strong{font-size:19px;font-variant-numeric:tabular-nums}.energy-map-phases{border-collapse:collapse;width:100%;font-variant-numeric:tabular-nums}.energy-map-phases th,.energy-map-phases td{padding:6px 7px;text-align:right;border-bottom:1px solid var(--border,#e2e8f0)}.energy-map-phases th:first-child{text-align:left}.energy-map-phases thead{color:var(--text-muted,#64748b);font-size:10px}.energy-map-light{margin:12px 0 7px}.energy-map-stamp{display:block;color:var(--text-muted,#64748b);font-size:10px;line-height:1.5}.energy-map-graphs{margin-top:14px;width:100%}.energy-map-camera-card{padding:12px;border:1px solid var(--border,#dbe3ec);border-radius:9px;background:var(--bg-card,#fff);margin-bottom:8px}.energy-map-camera-name{display:flex;justify-content:space-between;gap:12px;font-size:11px;font-weight:600;margin-bottom:10px}.energy-map-camera-name span{font-weight:400;color:var(--text-muted,#64748b)}.energy-map-camera-values{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:9px}.energy-map-camera-values button{background:color-mix(in srgb,#3b82f6 5%,var(--bg-card,#fff));color:var(--text-primary,#172033);border:1px solid var(--border,#dbe3ec);border-radius:7px;padding:10px;text-align:left;cursor:pointer}.energy-map-camera-values button:hover{border-color:#3b82f6}.energy-map-camera-values strong{font-size:18px;font-variant-numeric:tabular-nums}.energy-map-unavailable{padding:10px;color:var(--text-muted,#64748b);font-size:12px}

/* Compact map camera card: 70% of the former desktop footprint. */
.map-camera-popup .leaflet-popup-content{margin:12px 14px;max-height:min(476px,calc(100dvh - 120px))}.map-camera-popup .map-camera-previews{width:min(504px,calc(100vw - 64px));gap:6px}.map-camera-popup .map-camera-count-1{width:min(322px,calc(100vw - 64px))}.map-camera-popup .map-preview-caption{min-height:24px;padding:4px 0}.map-camera-popup .map-preview-play{width:30px;height:30px}.map-camera-popup .map-energy-summary:not(:empty){margin-top:8px;padding-top:8px}.map-camera-popup .energy-map-camera-card{padding:8px;margin-bottom:5px}.map-camera-popup .energy-map-camera-name{margin-bottom:6px}.map-camera-popup .energy-map-camera-values{gap:7px;margin-bottom:5px}.map-camera-popup .energy-map-camera-values button{padding:7px}.map-camera-popup .energy-map-camera-values strong{font-size:16px}
.energy-access{padding:8px 0;border-bottom:1px solid var(--border,#e2e8f0);margin-bottom:10px}
.energy-access h4{margin:0 0 6px;font-size:13px}
.energy-access-hint{font-size:11px;color:var(--text-secondary);line-height:1.45;margin:4px 0 8px}
.energy-access-list{margin-top:8px}
.energy-access details{border:1px solid var(--border,#e2e8f0);border-radius:8px;margin-bottom:6px;overflow:hidden}
.energy-access details[hidden]{display:none}
.energy-access summary{display:flex;gap:8px;align-items:center;padding:8px;background:var(--bg-secondary,#f8fafc);cursor:pointer;font-size:12px;font-weight:600}
.energy-access summary:before{content:'▸';font-size:11px;color:var(--text-secondary)}
.energy-access details[open]>summary:before{content:'▾'}
.energy-access summary small{margin-left:auto;color:var(--text-secondary)}
.energy-access-meter{display:flex;align-items:center;gap:8px;padding:7px 12px;font-size:12px;cursor:pointer}
.energy-access-meter small{display:block;color:var(--text-secondary);font-size:10px;margin-top:2px}
.energy-overview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:22px}
.energy-overview>div{background:var(--card);border-radius:var(--radius-lg);box-shadow:var(--shadow-card);padding:18px 20px;display:flex;flex-direction:column;gap:8px}
.energy-overview small{color:var(--text-muted);font-size:12px}.energy-overview strong{font-size:25px;font-variant-numeric:tabular-nums;color:var(--text)}
.energy-grid-tools{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin-bottom:18px}.energy-grid-tools label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--text-muted)}.energy-grid-tools label:first-child{flex:1;max-width:440px;min-width:200px}.energy-grid-tools input,.energy-grid-tools select{width:100%;min-height:38px;border:1px solid var(--border);border-radius:8px;background:var(--card);color:var(--text);padding:8px 12px;font:inherit}.energy-grid-tools>span{margin-left:auto;padding-bottom:10px;font-size:12px;color:var(--text-muted)}
.energy-device-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:14px}
.energy-device-tile{appearance:none;text-align:left;font:inherit;color:var(--text);background:var(--card);border:0;border-top:3px solid var(--danger);border-radius:var(--radius-lg);box-shadow:var(--shadow-card);padding:16px 18px;cursor:pointer;display:flex;flex-direction:column;gap:14px;min-width:0;transition:box-shadow .2s,transform .2s}
.energy-device-tile.is-online{border-top-color:var(--success)}.energy-device-tile:hover{box-shadow:var(--shadow-hover);transform:translateY(-3px)}.energy-device-tile:focus-visible{outline:3px solid var(--primary);outline-offset:3px}
.energy-tile-heading{display:flex;justify-content:space-between;gap:12px}.energy-tile-heading>span:first-child{min-width:0}.energy-tile-heading strong{display:block;font-size:14px;line-height:1.4;overflow-wrap:anywhere}.energy-tile-heading small{display:block;color:var(--text-muted);font-size:11px;margin-top:4px;overflow-wrap:anywhere}.energy-tile-icon{display:grid;place-items:center;flex-shrink:0;width:38px;height:38px;border-radius:10px;background:var(--primary-light);color:var(--primary);font-size:32px;line-height:1}
.energy-tile-badges{display:flex;align-items:center;flex-wrap:wrap;gap:7px}.energy-tile-light{font-size:11px;color:var(--text-muted)}.energy-tile-metrics{display:grid;grid-template-columns:1fr 1fr;gap:12px}.energy-tile-metrics>span{display:flex;flex-direction:column;gap:5px}.energy-tile-metrics small{font-size:11px;color:var(--text-muted);font-weight:400}.energy-tile-metrics strong{font-size:23px;font-variant-numeric:tabular-nums;line-height:1.25}.energy-tile-metrics strong small{font-size:12px}
.energy-tile-phases{display:flex;justify-content:space-between;gap:8px;border-radius:8px;background:var(--card-2);padding:9px 10px;color:var(--text-muted);font-size:11px}.energy-tile-phases b{color:var(--text);font-weight:600}.energy-tile-note{font-size:10px;color:var(--text-muted);line-height:1.4}.energy-tile-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;border-top:1px solid var(--border);padding-top:12px;margin-top:auto;font-size:11px;color:var(--text-muted)}.energy-tile-footer b{color:var(--primary);font-weight:600}
@media(max-width:700px){.energy-overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.energy-overview>div{padding:14px}.energy-overview strong{font-size:21px}.energy-device-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr))}.energy-grid-tools{gap:10px}.energy-grid-tools label:first-child{max-width:none;min-width:0;flex-basis:100%}.energy-grid-tools>span{font-size:11px}.energy-device-tile{padding:14px}.energy-tile-metrics strong{font-size:22px}}
@media(prefers-reduced-motion:reduce){.energy-device-tile{transition:none}.energy-device-tile:hover{transform:none}}
.energy-form [data-energy-network][hidden],.energy-form [data-energy-serial][hidden]{display:none!important}
.leaflet-container .energy-road-path:focus{outline:none}
.leaflet-container .energy-road-path:focus-visible{filter:drop-shadow(0 0 3px #2563eb)}
.energy-row-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;white-space:nowrap}
/* Two-rate utility meter T1/T2 readings. */
.energy-tariff-current{border:1px dashed var(--border,#334155);border-radius:8px;padding:10px 12px;margin:8px 0 12px}.energy-tariff-current .page-subtitle{margin:4px 0 8px}
.energy-tariff-fields,#edit-modal.energy-editing .energy-tariff-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:600px){.energy-tariff-fields,#edit-modal.energy-editing .energy-tariff-fields{grid-template-columns:1fr}}
/* Consumption table (kWh per day / month, T1/T2). */
.energy-consumption{margin-top:16px}.energy-consumption .energy-toolbar{flex-wrap:wrap;gap:8px}
.energy-consumption-group{display:inline-flex;border:1px solid var(--border,#334155);border-radius:8px;overflow:hidden}.energy-consumption-group button{padding:6px 12px;border:0;background:transparent;color:var(--text-secondary);font:inherit;cursor:pointer}.energy-consumption-group button.active{background:var(--primary);color:#fff}
.energy-consumption-scroll{overflow-x:auto;margin-top:10px}.energy-consumption-table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
.energy-consumption-table th,.energy-consumption-table td{padding:6px 10px;border-bottom:1px solid var(--border,#334155);text-align:right;white-space:nowrap}.energy-consumption-table th:first-child,.energy-consumption-table td:first-child{text-align:left}
.energy-consumption-table th{font-weight:600;color:var(--text-muted);font-size:12px}.energy-consumption-table tfoot td{font-weight:700;border-top:2px solid var(--border,#334155);border-bottom:0}.energy-consumption-table tr.is-empty td{color:var(--text-muted)}.energy-consumption-table tbody tr:hover td{background:var(--bg-hover)}

.lighting-load-monitor .energy-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin:12px 0}.lighting-load-monitor .energy-form-grid label{display:flex;flex-direction:column;gap:6px}.lighting-load-monitor input[type=checkbox]{width:auto}.lighting-load-monitor .energy-totals{margin:12px 0;gap:12px}.lighting-load-monitor .energy-totals strong{font-size:16px}.lighting-load-monitor .energy-totals small{margin:4px 0}.lighting-load-monitor [data-load-save]{margin-left:8px}


/* /css/map-camera-card.css?v=20260920-camera-v12 */
/* A compact camera card keeps previews, energy and analytics together. */
.map-camera-popup .leaflet-popup-content{margin:12px 14px;max-height:none;overflow:visible;width:min(504px,calc(100vw - 52px))!important}
.map-camera-popup .leaflet-popup-content-wrapper{max-width:calc(100vw - 24px)}
.map-camera-popup .camera-card-body{font-size:12px;line-height:1.35}
.map-camera-popup .map-popup-title{font-size:14px;line-height:20px;margin:0;padding-right:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.map-camera-popup .map-popup-title .ui-icon{vertical-align:middle;margin-right:6px}
.map-camera-popup .map-camera-previews,.map-camera-popup .map-camera-count-1{width:100%;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:6px;gap:6px}
.map-camera-popup .map-camera-count-1{grid-template-columns:1fr}
.map-camera-popup .map-preview-stage,.map-camera-popup .map-preview-image-button{height:clamp(64px,min(calc(var(--camera-card-height,500px)*.24),calc((var(--camera-card-width,532px) - 36px)*.28125)),120px);aspect-ratio:auto}
.map-camera-popup .map-preview-caption{min-height:24px;padding:3px 0;font-size:10px}
.map-camera-popup .map-preview-play{height:30px;width:30px}
.map-camera-popup .cam-snaps{display:flex;gap:6px;max-width:100%;margin:0}
.map-camera-popup .cam-snap-wrap{flex:1;min-width:0;max-width:50%}
.map-camera-popup .cam-snap-img{height:clamp(64px,calc(var(--camera-card-height,500px)*.24),120px);object-fit:contain;width:100%}
.map-camera-popup .map-live-controls:empty{display:none}
.map-camera-popup .map-live-controls img{max-height:130px;object-fit:contain}
.map-camera-popup .map-energy-summary:not(:empty){margin-top:5px;padding-top:6px}
.map-camera-popup .map-weather-station-summary:not(:empty){margin-top:5px}
.map-camera-popup .weather-map-camera-card{display:block;width:100%;margin:0;padding:7px 8px;border:1px solid var(--border,#dbe2ea);border-radius:8px;background:var(--bg-card,#fff);color:var(--text,#172235);font:inherit;text-align:left;cursor:pointer}
.map-camera-popup .weather-map-camera-card:hover{border-color:#8edbd3;background:var(--hover,#f8fafc)}
.map-camera-popup .weather-map-camera-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;min-width:0}
.map-camera-popup .weather-map-camera-name{display:flex;align-items:center;gap:5px;min-width:0}
.map-camera-popup .weather-map-camera-name>svg{color:#0f9387;flex:0 0 auto}
.map-camera-popup .weather-map-camera-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.map-camera-popup .weather-map-camera-name i{width:7px;height:7px;border-radius:50%;background:var(--danger,#ef4444);flex:0 0 auto}
.map-camera-popup .weather-map-camera-name i.online{background:var(--success,#16a34a)}
.map-camera-popup .weather-map-camera-name span,.map-camera-popup .weather-map-camera-head>small{color:var(--text-muted,#64748b);font-size:9px;font-style:normal;white-space:nowrap}
.map-camera-popup .weather-map-camera-values{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:0}
.map-camera-popup .weather-map-camera-values>span{min-width:0;padding:0 7px;border-left:1px solid var(--border-light,#edf1f5)}
.map-camera-popup .weather-map-camera-values>span:first-child{padding-left:0;border-left:0}
.map-camera-popup .weather-map-camera-values>span:last-child{padding-right:0}
.map-camera-popup .weather-map-camera-values b,.map-camera-popup .weather-map-camera-values small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.map-camera-popup .weather-map-camera-values b{font-size:14px;line-height:1.2;font-variant-numeric:tabular-nums}
.map-camera-popup .weather-map-camera-values small{margin-top:2px;color:var(--text-muted,#64748b);font-size:9px}
.map-camera-popup .weather-map-unavailable{padding:7px;border:1px dashed var(--border,#dbe2ea);border-radius:7px;color:var(--text-muted,#64748b);font-size:10px;text-align:center}
.map-camera-popup .energy-map-camera-card{padding:5px 7px;margin:0 0 4px}
.map-camera-popup .energy-map-camera-name{margin-bottom:2px;font-size:10px}
.map-camera-popup .energy-map-camera-values{margin-bottom:0;gap:6px}
.map-camera-popup .energy-map-camera-values button{padding:4px 7px;min-width:0}
.map-camera-popup .energy-map-camera-values small{font-size:9px;margin-bottom:1px}
.map-camera-popup .energy-map-camera-values strong{font-size:15px;line-height:1.15}
.map-camera-popup .energy-map-stamp{display:inline;font-size:8px;line-height:1.2;margin-top:1px}
.map-camera-popup .energy-map-stamp+.energy-map-stamp::before{content:' · '}
.map-camera-popup .map-ai-stats{margin-top:5px}
.map-camera-popup .map-analytics-panel{display:block;width:100%;padding:5px 7px;border:1px solid var(--border,#dbe2ea);border-radius:8px;background:var(--bg-card,#fff);color:var(--text,#172235);font:inherit;text-align:left;cursor:pointer}
.map-camera-popup .map-analytics-panel:hover{border-color:#8eb5ff;background:var(--hover,#f8fafc)}
.map-camera-popup .map-analytics-panel:focus-visible{outline:2px solid var(--primary,#2563eb);outline-offset:2px}
.map-camera-popup .map-analytics-heading{padding:0 0 2px;font-size:11px}
.map-camera-popup .map-analytics-open{color:var(--primary,#2563eb);font-size:9px;font-weight:500}
.map-camera-popup .map-analytics-grid{gap:8px}
.map-camera-popup .map-analytics-metric{padding:2px 0}
.map-camera-popup .map-analytics-metric span{font-size:9px}
.map-camera-popup .map-analytics-metric strong{margin-top:1px;font-size:15px;white-space:nowrap}
.map-camera-popup .map-analytics-metric small{font-size:9px}
.map-camera-popup .map-analytics-value-row{display:flex;align-items:baseline;gap:5px;min-width:0;white-space:nowrap}
.map-camera-popup .map-analytics-value-row strong,.map-camera-popup .map-analytics-value-row small{display:inline;margin-top:1px;overflow:visible}
.map-camera-popup .map-weather-summary{padding-top:5px;gap:4px 8px;font-size:10px}
.map-camera-popup .map-weather-summary small{font-size:9px}
.map-camera-popup .map-popup-row{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.map-camera-popup .map-traffic-categories{grid-template-columns:repeat(3,minmax(0,1fr));gap:3px 12px;padding:4px 0 0}
.map-camera-popup .map-helpdesk{margin-top:8px;padding-top:8px;font-size:11px}
.map-camera-popup .map-helpdesk-ticket{min-height:20px;align-items:center;margin-top:0}
.map-camera-popup.camera-card-sheet{position:fixed!important;left:50%!important;top:var(--camera-card-top,12px)!important;bottom:auto!important;transform:translateX(-50%)!important;width:var(--camera-card-width)!important;margin:0!important;z-index:1200}
.camera-card-sheet .leaflet-popup-content{width:auto!important;max-width:none}
.camera-card-sheet .leaflet-popup-tip-container{display:none}
.map-camera-popup .leaflet-popup-close-button{position:absolute!important;top:0!important;right:0!important;width:36px!important;height:36px!important;font-size:22px!important;line-height:34px!important;text-align:center;text-decoration:none;color:var(--text-muted,#64748b);z-index:2}

.map-camera-popup .map-traffic-category{font-size:10px}
.map-camera-popup .camera-card-compact .map-preview-stage,.map-camera-popup .camera-card-compact .map-preview-image-button,.map-camera-popup .camera-card-compact .cam-snap-img{height:64px}
.map-camera-popup .camera-card-compact .energy-map-camera-card{padding:5px}
.map-camera-popup .camera-card-compact .weather-map-camera-card{padding:5px 6px}
.map-camera-popup .camera-card-compact .map-helpdesk{margin-top:4px;padding-top:4px}
.map-camera-popup .camera-card-compact .map-helpdesk-ticket{min-height:18px}
@media(max-width:480px){
 .map-camera-popup .leaflet-popup-content{margin:10px 12px}
 .map-camera-popup .map-preview-caption-action{font-size:0}
 .map-camera-popup .map-preview-caption-action svg{width:14px;height:14px}
 .map-camera-popup .map-analytics-metric strong{font-size:14px}
 .map-camera-popup .energy-map-camera-values strong{font-size:15px}
 .map-camera-popup .map-traffic-categories{grid-template-columns:repeat(2,minmax(0,1fr))}
 .map-camera-popup .weather-map-camera-head>small{display:none}
 .map-camera-popup .weather-map-camera-values>span{padding:0 4px}
 .map-camera-popup .weather-map-camera-values b{font-size:12px}
 .map-camera-popup .weather-map-camera-values small{font-size:8px}
}

.map-camera-popup .camera-card-compact .map-analytics-heading{padding-top:4px}.map-camera-popup .camera-card-compact .map-analytics-metric{padding:2px 0}.map-camera-popup .camera-card-compact .map-camera-previews{margin-top:3px}.map-camera-popup .camera-card-compact .map-traffic-categories{gap:3px 10px;padding:4px 0}

/* Every object uses the same bounded, scrollable card on a phone. */
.map-object-popup .leaflet-popup-content,.map-object-popup .wh65-map-popup{color:var(--text-primary,var(--text,#172235))}
.map-object-popup.camera-card-sheet{position:fixed!important;left:var(--camera-card-left,50%)!important;top:max(var(--camera-card-top,12px),env(safe-area-inset-top,0px))!important;bottom:auto!important;transform:translateX(-50%)!important;width:var(--camera-card-width)!important;margin:0!important;z-index:1200}
.map-object-popup.camera-card-sheet .leaflet-popup-content-wrapper{max-width:100%;box-sizing:border-box}
.map-object-popup.camera-card-sheet .leaflet-popup-content{width:auto!important;max-width:none;margin:12px;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.map-object-popup.camera-card-sheet .leaflet-popup-tip-container{display:none}
.map-object-popup.camera-card-sheet .leaflet-popup-close-button{position:absolute!important;top:0!important;right:0!important;z-index:3;width:44px!important;height:44px!important;line-height:42px!important;font-size:26px!important;text-align:center}
.map-object-popup.camera-card-sheet .map-popup-title{padding-right:30px;white-space:normal;overflow-wrap:anywhere;line-height:1.35}
.map-object-popup.camera-card-sheet .map-popup-buttons .btn,.map-object-popup.camera-card-sheet .map-site-devices button{min-height:44px}
.map-object-popup.camera-card-sheet .map-site-devices{padding-right:28px}
.map-object-popup.camera-card-sheet .map-site-devices>div{max-height:150px;overscroll-behavior:contain}
.map-object-popup.camera-card-sheet .map-popup-row{white-space:normal;overflow-wrap:anywhere}

@media(max-width:768px){
 #view-map.active{display:flex;flex-direction:column;height:calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0}
 #view-map.active>.page-header{flex:0 0 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px;margin-bottom:8px;min-width:0}
 #view-map.active>.page-header>div:first-child{flex:0 0 auto;min-width:0}
 #view-map .page-title{font-size:18px;line-height:1.2}
 #view-map .eyebrow{font-size:9px;margin-bottom:4px}
 #view-map .page-actions{display:grid;grid-template-columns:minmax(0,1fr) 40px;gap:6px;min-width:0}
 #view-map .map-layer-toggle{display:flex;min-width:0;max-width:100%;overflow-x:auto;white-space:nowrap;overscroll-behavior-x:contain;scrollbar-width:none}
 #view-map .map-toggle-btn{flex:0 0 auto;min-height:40px;display:inline-flex;align-items:center;padding:6px 10px;font-size:11px;white-space:nowrap}
 #view-map #map-timelapse-btn{width:40px;min-height:40px;padding:8px;font-size:0;justify-content:center}
 #view-map .map-legend{grid-column:1/-1;gap:5px;font-size:10px;line-height:1.2;padding:5px 8px;border-radius:8px;box-shadow:none}
 #view-map .legend-dot{width:7px;height:7px;flex:0 0 7px}
 #view-map .map-container{flex:1 1 0;min-height:0!important;height:auto!important}
 #view-map .leaflet-control-layers-expanded{max-width:calc(100vw - 76px);max-height:60dvh;overflow:auto}
 #view-map .leaflet-control-zoom a{width:38px;height:38px;line-height:38px}
 .road-map-panel button{min-height:40px}.road-panel-head{position:sticky;top:-10px;z-index:2;padding-top:4px;background:var(--bg-card,var(--card,#fff))}
 @supports selector(:has(*)){
  .main-content:has(#view-map.active){padding-top:max(10px,env(safe-area-inset-top));padding-bottom:max(10px,env(safe-area-inset-bottom))}
  #view-map.active{height:calc(100dvh - max(10px,env(safe-area-inset-top)) - max(10px,env(safe-area-inset-bottom)))}
  #view-map .page-header>div:first-child{padding-left:48px;min-height:42px}
 }
}


/* /css/device-access-search.css?v=20260913-permissions */
#device-access-search{display:flex;flex-direction:column;gap:6px;margin:0 0 10px}
#device-access-search input{width:100%}
#device-access-search small{font-size:11px;color:var(--text-muted)}
#perm-devices [hidden]{display:none!important}


/* /css/system-health.css?v=20260919-retention */
.sys-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.sys-header .card-header{margin:0}.sys-status,.sys-note{font-size:12px;color:var(--text-muted)}.sys-status{margin-top:5px}.sys-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.sys-metric{border:1px solid var(--border);border-radius:12px;padding:16px;display:flex;flex-direction:column;gap:10px;min-width:0;background:var(--bg-secondary)}.sys-metric>span{color:var(--text-secondary);font-size:12px}.sys-metric strong{font-size:22px;line-height:1.25}.sys-metric small{font-size:12px;color:var(--text-muted)}.sys-metric progress{width:100%;height:7px;border:0}.sys-details{display:grid;grid-template-columns:1fr 1fr;gap:0 24px;margin:18px 0 12px}.sys-details>div{padding:10px 0;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;gap:12px;font-size:12px}.sys-details dt{color:var(--text-secondary);flex-shrink:0}.sys-details dd{margin:0;text-align:right;overflow-wrap:anywhere}.sys-note{line-height:1.5;margin:0}@media(max-width:1100px){.sys-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sys-details{grid-template-columns:1fr}}@media(max-width:540px){.sys-header{align-items:flex-start}.sys-metric{padding:12px}.sys-metric strong{font-size:18px}.sys-details>div{flex-direction:column;gap:4px}.sys-details dd{text-align:left}}
#system-health,#database-storage{padding:20px;margin-bottom:20px}#system-health .sys-header .card-header,#database-storage .sys-header .card-header{padding:0;border:0}#system-health .sys-metric progress{display:block;border-radius:8px;overflow:hidden}#system-health progress::-webkit-progress-bar{background:var(--border);border-radius:8px}#system-health progress::-webkit-progress-value{background:var(--primary);border-radius:8px}.db-storage-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.db-storage-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}.db-storage-summary>div{border:1px solid var(--border);border-radius:10px;background:var(--bg-secondary);padding:12px;display:flex;flex-direction:column;gap:5px}.db-storage-summary span{font-size:11px;color:var(--text-muted)}.db-storage-summary strong{font-size:16px}.db-storage-table-wrap{max-height:520px;overflow:auto;margin-bottom:12px}.db-storage-table{min-width:1280px}.db-storage-table th{position:sticky;top:0;z-index:1;background:var(--bg-secondary)}.db-storage-table .num{text-align:right;white-space:nowrap}.db-storage-table code{font-family:var(--font-mono,monospace);font-size:12px;color:var(--text-primary);background:none}.db-storage-description{min-width:230px;max-width:330px;color:var(--text-secondary);line-height:1.35}.db-storage-period{min-width:180px;white-space:nowrap}.db-retention{display:flex;align-items:center;gap:5px;white-space:nowrap}.db-retention-input{width:76px!important;min-width:76px;padding:6px 8px!important}.db-retention span{color:var(--text-muted);font-size:12px}.db-storage-empty{text-align:center;color:var(--text-muted);padding:24px!important}@media(max-width:800px){.db-storage-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:540px){#system-health,#database-storage{padding:14px}.db-storage-actions{width:100%;justify-content:stretch}.db-storage-actions button{flex:1}.db-storage-summary{gap:8px}.db-storage-summary>div{padding:10px}.db-storage-summary strong{font-size:14px}}


/* /css/energy-compact.css?v=20260913-compact */
/* Current readings: compact summary above the graph, scoped to the detail page. */
#energy-live>.energy-card{display:grid;grid-template-columns:minmax(240px,1fr) minmax(0,2fr);column-gap:28px;row-gap:6px;padding:16px 20px;margin:12px 0}
#energy-live .energy-head{grid-column:1;grid-row:1;gap:10px;align-items:flex-start}
#energy-live .energy-head h2{font-size:18px;line-height:1.3}
#energy-live .energy-head .page-subtitle{font-size:11px;margin:4px 0 0}
#energy-live .energy-status{font-size:10px;padding:4px 8px;white-space:nowrap}
#energy-live>.energy-card>p:first-of-type{grid-column:1;grid-row:2;margin:0;font-size:12px}
#energy-live .energy-totals{grid-column:2;grid-row:1 / span 2;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin:0;align-self:center}
#energy-live .energy-totals small{font-size:11px;line-height:1.4;margin-bottom:4px}
#energy-live .energy-totals strong{font-size:22px;line-height:1.3}
#energy-live #energy-coverage{font-size:10px;margin-top:4px;margin-bottom:0}
#energy-live .energy-phase-details{grid-column:1 / -1;margin-top:4px;border-top:1px solid var(--border,#e2e8f0)}
#energy-live .energy-phase-details summary{padding:6px 0;font-size:11px}
#energy-live>.energy-card>p:last-child{grid-column:1 / -1;margin:0;font-size:10px;line-height:1.4}
#energy-live .energy-phase-details[open] summary{margin-bottom:6px}
@media(max-width:1000px){
 #energy-live>.energy-card{grid-template-columns:1fr;gap:6px;padding:14px 16px}
 #energy-live .energy-head{flex-direction:row;align-items:flex-start}
 #energy-live .energy-totals{grid-column:1;grid-row:3;gap:12px;margin-top:6px}
}
@media(max-width:480px){
 #energy-live .energy-totals{grid-template-columns:1fr 1fr}
 #energy-live .energy-totals>div:last-child{grid-column:1 / -1;display:flex;align-items:baseline;gap:8px}
 #energy-live .energy-totals>div:last-child strong{font-size:15px}
 #energy-live .energy-totals strong{font-size:19px}
}


/* /css/energy-sidebar.css?v=20260913-energy-ccu */
.energy-object-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:20px;align-items:start}.energy-object-main{min-width:0}.energy-object-main>.energy-toolbar{margin-top:0}.energy-object-sidebar{height:calc(100dvh - 155px);max-height:780px;min-height:200px;border:1px solid var(--border);border-radius:10px;top:12px}.energy-object-sidebar .dd-sidebar-item{width:100%;background:transparent;border:0;border-left:3px solid transparent;text-align:left;color:var(--text-primary)}.energy-object-sidebar .dd-sidebar-item.active{background:var(--primary-light);border-left-color:var(--primary)}.energy-object-sidebar .dd-sidebar-item:hover{background:var(--card-2,var(--bg-card))}.energy-sidebar-name{display:flex;flex-direction:column;gap:4px;min-width:0}.energy-sidebar-name b{font-weight:500;white-space:normal;overflow-wrap:anywhere;font-size:12px}.energy-sidebar-name small{font-size:10px;color:var(--text-muted)}.energy-sidebar-empty{font-size:12px;color:var(--text-muted);padding:12px}.energy-sidebar-group{padding:10px 12px 6px;color:var(--text-muted);font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;border-top:1px solid var(--border)}.energy-sidebar-group:first-child{border-top:0}.energy-object-main #energy-meter-group>h2,.energy-object-main #energy-controller-group>h2{margin:22px 0 10px;font-size:16px}.energy-object-main #energy-meter-group[hidden],.energy-object-main #energy-controller-group[hidden]{display:none}.energy-object-sidebar #energy-sidebar-toggle{font-size:24px;line-height:1;padding:4px 8px}.energy-sidebar-collapsed{grid-template-columns:44px minmax(0,1fr)}.energy-sidebar-collapsed .dd-sidebar-filters,.energy-sidebar-collapsed .dd-sidebar-list,.energy-sidebar-collapsed .dd-sidebar-footer,.energy-sidebar-collapsed .dd-sidebar-title{display:none}.energy-sidebar-collapsed .dd-sidebar-head{padding:6px;justify-content:center}.energy-sidebar-collapsed .energy-object-sidebar{min-height:0;height:auto}
@media(max-width:1200px) and (min-width:901px){.energy-object-layout{grid-template-columns:210px minmax(0,1fr);gap:14px}.energy-sidebar-collapsed{grid-template-columns:44px minmax(0,1fr)}.energy-object-main #energy-live>.energy-card{grid-template-columns:1fr}.energy-object-main #energy-live .energy-totals{grid-column:1;grid-row:3;margin-top:6px}}
@media(max-width:900px){.energy-object-layout,.energy-sidebar-collapsed{grid-template-columns:minmax(0,1fr);gap:12px}.energy-object-sidebar{position:static;height:auto;max-height:310px;min-height:0}.energy-sidebar-collapsed .dd-sidebar-title{display:block}.energy-sidebar-collapsed .dd-sidebar-head{justify-content:space-between;padding:8px 12px}.energy-object-sidebar .dd-sidebar-list{max-height:180px}.energy-object-sidebar .dd-sidebar-filters{flex-direction:row}.energy-object-sidebar .dd-sidebar-filters>*{min-width:0;flex:1}.energy-sidebar-collapsed .dd-sidebar-filters{display:none}}


/* /css/device-settings-filter.css?v=20260913-device-filter */
.device-settings-filter{display:grid;grid-template-columns:minmax(240px,2fr) minmax(190px,1fr) auto auto;gap:10px;align-items:end;margin:0 0 18px;padding:14px;background:var(--bg-card);border:1px solid var(--border);border-radius:10px}.device-settings-filter label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--text-muted)}.device-settings-filter .input-field{width:100%}.device-settings-filter-count{align-self:center;white-space:nowrap;color:var(--text-muted);font-size:12px}.device-filter-empty{display:none!important}.device-settings-filter-empty{margin:8px 0 18px;color:var(--text-muted)}
@media(max-width:760px){.device-settings-filter{grid-template-columns:1fr}.device-settings-filter .btn{width:100%}.device-settings-filter-count{text-align:center}}


/* /css/notifications.css?v=20260914-active-panel */
.notification-shell { position: relative; }
.notification-toggle { width: 100%; position: relative; justify-content: flex-start; }
.notification-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}
.notification-panel {
  position: fixed;
  left: 252px;
  bottom: 16px;
  z-index: 5000;
  width: min(420px, calc(100vw - 268px));
  max-height: min(560px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card, var(--surface));
  color: var(--text-primary);
  box-shadow: 0 22px 64px rgba(0,0,0,.32), 0 0 0 1px rgba(0,0,0,.04);
  isolation: isolate;
}
.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card, var(--surface));
}
.notification-panel-header div { display: flex; flex-direction: column; gap: 2px; }
.notification-panel-header small { color: var(--text-muted); font-size: 11px; }
.notification-list {
  max-height: 465px;
  overflow: auto;
  background: var(--bg-card, var(--surface));
}
.notification-empty { padding: 34px 18px; color: var(--text-muted); text-align: center; font-size: 13px; }
.notification-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card, var(--surface));
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.notification-item:hover { background: var(--bg-secondary); }
.notification-item.unread { background: color-mix(in srgb, var(--warning) 9%, var(--bg-card, var(--surface))); }
.notification-item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warning-bg);
  color: var(--warning);
}
.notification-item-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notification-item-main strong { font-size: 13px; line-height: 1.3; }
.notification-item-main span { color: var(--text-secondary); font-size: 12px; }
.notification-item-main small { color: var(--text-muted); font-size: 11px; }
.notification-resolved { color: var(--success); }

@media (max-width: 760px) {
  .notification-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
  }
  .notification-list { max-height: calc(100vh - 105px); }
}


/* /css/anpr.css?v=20260914-anpr1 */
#view-anpr { padding-bottom: 24px; }
.anpr-page-header { margin-bottom: 18px; }
.anpr-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.anpr-sidebar { padding: 12px; position: sticky; top: 14px; }
.anpr-sidebar-title { padding: 2px 6px 10px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.anpr-camera-list { display: grid; gap: 7px; }
.anpr-camera-option { width: 100%; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-primary); padding: 10px; text-align: left; cursor: pointer; display: grid; gap: 3px; }
.anpr-camera-option:hover { border-color: var(--primary); }
.anpr-camera-option.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); box-shadow: inset 3px 0 var(--primary); }
.anpr-camera-option strong { font-size: 13px; }
.anpr-camera-option small { color: var(--text-muted); font-size: 11px; }
.anpr-camera-empty { padding: 14px 8px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.anpr-content { min-width: 0; display: grid; gap: 16px; }
.anpr-live-card { padding: 14px; display: grid; grid-template-columns: minmax(260px, 520px) minmax(180px, 1fr); gap: 16px; align-items: center; }
.anpr-live-image-wrap { min-height: 180px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #111827; position: relative; }
.anpr-live-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anpr-live-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #aeb8c7; font-size: 13px; }
.anpr-live-name { font-size: 20px; font-weight: 700; margin-bottom: 7px; }
.anpr-live-meta { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.anpr-live-info { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.anpr-live-info .badge { white-space: nowrap; }
.anpr-events-card { padding: 14px; }
.anpr-toolbar { display: grid; grid-template-columns: minmax(180px, 360px) 190px 1fr; gap: 10px; align-items: center; margin-bottom: 14px; }
.anpr-count { justify-self: end; color: var(--text-muted); font-size: 12px; }
.anpr-events { display: grid; gap: 8px; }
.anpr-event { display: grid; grid-template-columns: 170px minmax(120px, 180px) minmax(140px, 1fr) minmax(130px, .8fr); gap: 14px; align-items: center; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.anpr-event-photo { height: 94px; border: 0; border-radius: 7px; overflow: hidden; padding: 0; background: #111827; cursor: zoom-in; }
.anpr-event-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anpr-event-photo-placeholder { height: 94px; border-radius: 7px; background: var(--surface-muted, #eef1f5); color: var(--text-muted); display: grid; place-items: center; font-size: 11px; }
.anpr-plate { display: grid; gap: 5px; }
.anpr-plate strong { width: fit-content; min-width: 108px; border: 2px solid currentColor; border-radius: 5px; padding: 6px 10px; background: var(--surface); color: var(--text-primary); font: 800 18px/1.05 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-align: center; }
.anpr-plate small, .anpr-event-meta small { color: var(--text-muted); font-size: 11px; }
.anpr-event-meta { display: grid; gap: 4px; min-width: 0; font-size: 12px; }
.anpr-event-camera { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.anpr-events-state { padding: 34px 12px; color: var(--text-muted); text-align: center; }
.anpr-photo-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.anpr-photo-overlay img { max-width: 96vw; max-height: 92vh; object-fit: contain; border-radius: 8px; box-shadow: 0 18px 70px rgba(0,0,0,.45); }

@media (max-width: 980px) {
  .anpr-layout { grid-template-columns: 1fr; }
  .anpr-sidebar { position: static; overflow-x: auto; }
  .anpr-camera-list { display: flex; min-width: max-content; }
  .anpr-camera-option { width: 210px; }
  .anpr-event { grid-template-columns: 150px 145px minmax(120px, 1fr); }
  .anpr-event-meta:last-child { display: none; }
}

@media (max-width: 680px) {
  #view-anpr { padding-left: 10px; padding-right: 10px; }
  .anpr-page-header { align-items: flex-start; }
  .anpr-live-card { grid-template-columns: 1fr; padding: 10px; }
  .anpr-live-image-wrap { min-height: 0; }
  .anpr-live-name { font-size: 17px; }
  .anpr-toolbar { grid-template-columns: 1fr 145px; }
  .anpr-count { grid-column: 1 / -1; justify-self: start; }
  .anpr-events-card { padding: 10px; }
  .anpr-event { grid-template-columns: 116px minmax(0, 1fr); gap: 10px; padding: 7px; }
  .anpr-event-photo, .anpr-event-photo-placeholder { height: 76px; }
  .anpr-event-meta { grid-column: 2; }
  .anpr-event-meta:last-child { display: grid; }
  .anpr-plate strong { min-width: 0; max-width: 100%; font-size: 15px; padding: 5px 7px; }
}


/* /css/map-ticket-wrap.css?v=20261009 */
/* Ticket numbers must never shrink into or overlap adjacent links. */
.leaflet-popup-content .map-helpdesk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 5px;
  white-space: normal;
  min-width: 0;
}
.leaflet-popup-content .map-helpdesk-row .map-helpdesk-title {
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0;
}
.leaflet-popup-content .map-helpdesk-row .map-helpdesk-ticket {
  display: flex;
  flex: 1 1 140px;
  min-width: min(140px, 100%);
  max-width: 100%;
  width: auto;
  box-sizing: border-box;
  margin: 0;
  padding: 3px 5px;
  gap: 6px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-secondary);
}
.leaflet-popup-content .map-helpdesk-ticket span:first-child { flex: 0 0 auto; }
.leaflet-popup-content .map-helpdesk-ticket span:last-child { min-width: 0; }
.map-device-popup .leaflet-popup-content .map-helpdesk-row { display: grid; grid-template-columns: minmax(0, 1fr); }
.map-device-popup .leaflet-popup-content .map-helpdesk-row .map-helpdesk-ticket { min-width: 0; width: 100%; }


/* /css/map-card-style.css?v=20261009 */
/* Shared visual hierarchy for the multi-device map popup. */
.map-camera-popup .map-camera-device,
.map-camera-popup .energy-map-camera-card,
.map-camera-popup .weather-map-camera-card,
.map-camera-popup .map-analytics-panel,
.map-camera-popup .map-helpdesk {
  display:block;box-sizing:border-box;width:100%;padding:8px;margin:6px 0 0;
  border:1px solid var(--border,#dbe2ea);border-radius:8px;
  background:var(--card,#fff);color:var(--text-primary,var(--text,#172235));
  font:inherit;text-align:left;
}
.map-camera-popup .map-camera-device{margin-top:0}
.map-camera-popup .map-energy-summary:not(:empty),.map-camera-popup .map-weather-station-summary:not(:empty),.map-camera-popup .map-ai-stats:not(:empty){margin:0;padding:0;border:0}
.map-camera-popup .map-unified-heading,.map-camera-popup .weather-map-camera-head,.map-camera-popup .map-analytics-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 6px;padding:0;min-width:0}
.map-camera-popup .map-unified-name,.map-camera-popup .weather-map-camera-name{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px;font-weight:700;color:var(--text-primary,var(--text,#172235))}
.map-camera-popup .map-unified-name strong,.map-camera-popup .weather-map-camera-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.map-camera-popup .map-unified-name svg{flex-shrink:0;width:16px;height:16px}
.map-camera-popup .map-connection-status{display:inline-flex;align-items:center;gap:5px;flex:0 0 auto;white-space:nowrap;font-size:10px;font-weight:400;color:var(--text-muted,#64748b)}
.map-camera-popup .map-connection-status::before{content:'';width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--text-muted,#94a3b8)}
.map-camera-popup .map-connection-status.online::before{background:var(--success,#16a34a)}
.map-camera-popup .map-connection-status.offline::before{background:var(--danger,#ef4444)}
.map-camera-popup .map-connection-status.partial::before{background:var(--warning,#f59e0b)}
.map-camera-popup .map-unified-updated{display:block!important;margin-top:5px;color:var(--text-muted,#64748b);font-size:9px;line-height:1.4;font-weight:400}
.map-camera-popup .energy-map-camera-values{margin:0;gap:6px}
.map-camera-popup .energy-map-camera-values button{background:var(--card-2,var(--bg-secondary,#f4f7fc));color:var(--text-primary,var(--text,#172235));padding:5px 7px}
.map-camera-popup .map-helpdesk-row{gap:5px}
.map-camera-popup .map-helpdesk-row .map-helpdesk-title{flex:0 0 100%;margin-bottom:2px}
.map-camera-popup .map-helpdesk-row .map-helpdesk-ticket{flex-basis:calc(50% - 5px);min-width:140px;background:var(--card-2,var(--bg-secondary,#f4f7fc))}
.map-camera-popup .map-camera-previews{margin-top:0}
.map-camera-popup .map-analytics-panel:hover,.map-camera-popup .weather-map-camera-card:hover{background:var(--card-2,var(--bg-secondary,#f4f7fc));border-color:var(--primary,#ef000f)}
@media(max-width:400px){.map-camera-popup .map-helpdesk-row .map-helpdesk-ticket{flex-basis:100%;min-width:0}.map-camera-popup .weather-map-camera-values{grid-template-columns:repeat(3,minmax(0,1fr));row-gap:6px}.map-camera-popup .weather-map-camera-values>span:nth-child(4){padding-left:0;border-left:0}.map-camera-popup .map-connection-status{font-size:9px}}


/* /css/activity-details.css?v=20261010 */
.activity-result{display:block;color:var(--text-muted,#64748b);font-size:11px;margin-top:4px}.activity-result.is-error{color:var(--danger,#ef4444)}
.activity-details{min-width:180px;max-width:520px;color:var(--text-primary,#263445)}.activity-details summary{cursor:pointer;overflow-wrap:anywhere}.activity-details>div{margin-top:8px;padding:8px;border:1px solid var(--border-color,#dce2eb);border-radius:6px;background:var(--bg-secondary,#f5f7fa);font-size:12px;overflow-wrap:anywhere}.activity-details pre{white-space:pre-wrap;margin:6px 0}.activity-change-title{font-weight:600;margin:8px 0 4px}.activity-change{display:grid;grid-template-columns:minmax(120px,1fr) 2fr;gap:8px;padding:4px 0;border-bottom:1px solid var(--border-color,#dce2eb)}
:root:not([data-theme="light"]) .activity-details{color:#e2e8f0}:root:not([data-theme="light"]) .activity-details>div{background:#19212c;border-color:#334155}
@media(max-width:700px){.activity-change{grid-template-columns:1fr}.activity-details{min-width:140px}}


/* /css/map-roads.css?v=20261008-3 */
.road-map-panel{position:absolute;z-index:1100;left:12px;bottom:18px;width:340px;max-width:calc(100% - 24px);max-height:70%;overflow:auto;background:var(--bg-card,#fff);color:var(--text-primary,#18212b);border:1px solid var(--border,#bdc7d2);border-radius:12px;padding:12px;box-shadow:0 4px 22px #0004;font:13px/1.45 sans-serif;box-sizing:border-box}
.road-map-panel[hidden]{display:none}.road-panel-head,.road-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:8px}.road-panel-head{justify-content:space-between}.road-map-panel button,.road-layer-button button{background:var(--bg-card,#fff);color:var(--text-primary,#18212b);border:1px solid var(--border,#bdc7d2);border-radius:5px;padding:6px 9px;cursor:pointer;font:inherit}.road-layer-button button{font-size:12px}.road-map-panel label{display:block;margin:6px 0}.road-map-panel input:not([type=checkbox]),.road-map-panel textarea{box-sizing:border-box;width:100%;background:var(--bg-input,var(--bg-card,#fff));color:inherit;border:1px solid var(--border,#bdc7d2);border-radius:5px;padding:6px;font:inherit}.road-map-panel small{display:block;color:var(--text-secondary,#566475);font-size:11px}.road-results{max-height:240px;overflow:auto}.road-results button{display:block;text-align:left;width:100%;margin:4px 0}.road-description{white-space:pre-wrap;overflow-wrap:anywhere}.road-map-panel [data-message]{color:var(--danger,#e33636);margin-top:7px}.road-vertex{background:#fff;border:2px solid #176cd3;border-radius:50%;box-sizing:border-box}.road-map-label span{background:var(--bg-card,#fff);color:var(--text-primary,#18212b);padding:2px 5px;border:1px solid var(--border,#bdc7d2);border-radius:4px;white-space:nowrap;font-size:11px;box-shadow:0 1px 3px #0003}.road-map-panel h3{margin:8px 0;font-size:14px}
@media(max-width:600px){.road-map-panel{left:8px;bottom:8px;width:calc(100% - 16px);max-width:none;max-height:58%;padding:10px}.road-map-panel button{min-height:36px}}
.road-save-tools{position:sticky;bottom:-12px;background:var(--bg-card,#fff);padding:8px 0;margin:0;border-top:1px solid var(--border,#bdc7d2)}.road-vertex.is-selected{background:#ffd25f;border-color:#cc6600}.road-map-panel button:disabled{opacity:.5;cursor:default}.road-map-panel small{overflow-wrap:anywhere}
.road-selection-outline,.road-selection-pulse{pointer-events:none}.road-selection-pulse{animation:road-selection-pulse 1.8s ease-in-out infinite}
@keyframes road-selection-pulse{0%,100%{stroke-opacity:.35}50%{stroke-opacity:1}}
@media(prefers-reduced-motion:reduce){.road-selection-pulse{animation:none;stroke-opacity:1}}


/* /css/max.css?v=20261023 */
.max-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}.max-box{padding:20px;background:var(--card-bg,var(--bg-card,#fff));border:1px solid var(--border,#dfe3ec);border-radius:12px;margin-bottom:16px;min-width:0}.max-box h3,.max-dialog h3{margin:0 0 12px}.max-muted,.max-box small{color:var(--text-muted,#64748b);line-height:1.5}.max-box form>label:not(.max-check){display:grid;gap:6px;margin:14px 0}.max-box input:not([type=checkbox]){width:100%;box-sizing:border-box;padding:10px;border:1px solid var(--border,#cbd5e1);border-radius:7px;background:var(--input-bg,var(--card-bg,#fff));color:var(--text-primary,#172033)}.max-check{display:flex;align-items:center;gap:9px;margin:14px 0}.max-check input{width:18px;height:18px;flex-shrink:0}.max-actions{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}.max-actions .btn{white-space:normal;min-height:40px}.max-error{color:var(--danger,#b91c1c)!important}.max-details{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 14px;font-size:13px}.max-details dt{color:var(--text-muted,#64748b)}.max-details dd{margin:0;overflow-wrap:anywhere}.max-guide{padding-left:22px;line-height:1.65}.max-guide li{padding:0 0 12px 3px}.max-table-wrap{overflow:auto}.max-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.max-table th,.max-table td{padding:12px 10px;border-bottom:1px solid var(--border,#dfe3ec);vertical-align:top}.max-table small{display:block;margin-top:5px}.max-dialog{box-sizing:border-box;width:min(540px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;padding:22px;border:1px solid var(--border,#dfe3ec);border-radius:14px;background:var(--card-bg,#fff);color:var(--text-primary,#172033);box-shadow:0 16px 80px #0004}.max-dialog::backdrop{background:#0f172a80}.max-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}.max-dialog header .btn{min-width:40px;min-height:40px}.max-dialog p{line-height:1.5;overflow-wrap:anywhere}.max-dialog small{display:block;line-height:1.5}.settings-tabs{flex-wrap:wrap}@media(max-width:760px){.max-layout{grid-template-columns:minmax(0,1fr);gap:0}.max-box{padding:15px}.max-details{grid-template-columns:1fr;gap:4px}.max-details dd{margin-bottom:9px}.max-table{min-width:620px}.max-dialog{padding:16px}.max-actions .btn{flex:1 1 140px;min-height:44px}}
.max-box input:not([type=checkbox]){background:var(--bg-secondary,#f1f5f9);color:var(--text-primary,#172033)}
.max-dialog{margin:auto;inset:0;background:var(--bg-card,#fff)}
.max-dialog [hidden]{display:none!important}
.max-dialog .btn:disabled,.max-box .btn:disabled{opacity:.45;cursor:not-allowed}


/* /css/notification-settings.css?v=20260928-relay2hero */
/* Settings → Оповещения */
.ns-card { margin-bottom: 16px; padding: 16px; }
.ns-card h3 { margin: 0 0 4px; font-size: 15px; }
.ns-thresholds { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.ns-thresholds label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.ns-thresholds input[type=number] { width: 150px; }
.ns-thresholds .ns-inline { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.ns-scroll { overflow-x: auto; margin-top: 12px; }
.ns-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ns-table th { text-align: left; font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ns-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ns-table td:first-child small { display: block; color: var(--text-muted); }
.ns-table .ns-center { text-align: center; }
.ns-stations summary { cursor: pointer; white-space: nowrap; }
.ns-stations[data-disabled] { opacity: .5; pointer-events: none; }
.ns-stations fieldset { border: none; margin: 6px 0 0; padding: 0; }
.ns-stations legend { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.ns-stations label { display: block; white-space: nowrap; }
.ns-all { font-weight: 600; margin-top: 6px; }
.ns-status { color: var(--text-muted); white-space: nowrap; }

/* Settings → Балки по погоде */
.bw-card { margin-bottom: 16px; padding: 16px; }
.bw-card h3 { margin: 0 0 4px; font-size: 15px; }
.bw-global { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.bw-switch { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.bw-warning { margin: 10px 0 0; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--warning, #d97706) 15%, transparent); }
.bw-note { margin: 10px 0 0; font-size: 12px; color: var(--text-muted); }
.bw-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bw-toolbar input[type=search] { flex: 1 1 220px; min-width: 0; }
.bw-bulk { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 10px; margin: 8px 0; border: 1px dashed var(--border); border-radius: 8px; }
.bw-bulk > b { flex-basis: 100%; font-size: 13px; }
.bw-bulk label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.bw-bulk input[type=number] { width: 90px; }
.bw-bulk .bw-inline { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }
.bw-bulk small { color: var(--text-muted); }
.bw-scroll { overflow-x: auto; }
.bw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bw-table th { text-align: left; font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bw-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bw-table td:nth-child(2) small { display: block; color: var(--text-muted); }
.bw-table input[type=number] { width: 70px; }
.bw-table select { max-width: 220px; }
.bw-table .badge { white-space: normal; text-align: left; }
.bw-center { text-align: center; }
.bw-empty { text-align: center; color: var(--text-muted); padding: 16px; }
.ns-table .ns-tech { background: color-mix(in srgb, var(--border) 25%, transparent); }

/* Form labels with a checkbox: same height as plain labels, so fields in a
   form row line up (the checkbox's default margins made the label taller). */
.form-group label:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 6px; }
.form-group label > input[type=checkbox] { margin: 0; }
/* Text inputs and selects of one height (a select renders 2 px taller). */
.form-group select.input-field,
.form-group input.input-field:not([type=checkbox]):not([type=radio]) { box-sizing: border-box; height: 41px; }

/* Device page: second relay chip and buttons */
.dd-hero-relay2 { gap: 8px; align-self: stretch; }
.dd-hero-relay2 .dd-relay2-dot { width: 28px; height: 28px; }
.dd-relay2-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--text-muted, #9ca3af); flex-shrink: 0; }
.dd-hero-relay2.beacon-on .dd-relay2-dot { background: var(--success, #16a34a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #16a34a) 25%, transparent); }
.dd-relay2-controls { display: inline-flex; align-items: center; gap: 6px; }
.dd-hero.has-relay2 { grid-template-columns: auto auto 1fr; }


/* /css/map-device-sites.css?v=20260913-sites */
.map-site-wrap { background:none;border:0; }
.map-site-icon { display:grid;grid-template-columns:repeat(var(--site-columns),28px);padding:4px;background:#fff;border-radius:12px;box-shadow:0 2px 8px #0f172a55,0 0 0 1px #0f172a22;position:relative; }
.map-site-icon:after { content:"";position:absolute;width:10px;height:10px;background:#fff;bottom:-5px;left:calc(50% - 5px);transform:rotate(45deg);border-radius:0 0 2px 0;box-shadow:2px 2px 2px #0f172a22; }
.map-site-symbol { display:flex;align-items:center;justify-content:center;position:relative;width:28px;height:28px;color:var(--site-color); }
.map-site-symbol + .map-site-symbol { border-left:1px solid #e8edf2; }
.map-site-count { position:absolute;right:-1px;top:-3px;background:var(--site-color);color:#fff;border:1px solid #fff;border-radius:8px;font:700 9px/12px Arial,sans-serif;min-width:12px;text-align:center;padding:0 1px; }
.map-site-offline { position:absolute;bottom:0;right:0;width:7px;height:7px;background:#e44848;border:1px solid #fff;border-radius:50%; }
.map-site-devices { margin:0 0 8px;padding-bottom:8px;border-bottom:1px solid #e2e8f0;font:11px/1.3 Arial,sans-serif; }
.map-site-devices > small { display:block;color:var(--text-muted,#64748b);margin-bottom:5px; }
.map-site-devices > div { display:flex;flex-wrap:wrap;gap:4px;max-height:160px;overflow:auto; }
.map-site-devices button { display:flex;align-items:center;gap:5px;max-width:100%;min-height:30px;border:1px solid #dce3ec;border-radius:7px;background:var(--bg-card,#fff);color:var(--text-primary,#172235);padding:4px 7px;cursor:pointer;font:inherit; }
.map-site-devices button span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.map-site-devices button[aria-current] { background:#eff6ff;border-color:#93b7f4;color:#1d4ed8; }
.map-site-devices button:focus-visible { outline:2px solid #2563eb;outline-offset:2px; }
@media(max-width:600px) { .map-site-devices button { min-height:36px; } }


/* /css/map-weather.css?v=20260927-cadastre7 */
/* Map weather layers (Open-Meteo): layer switch, timeline and legend. */
.map-weather-canvas{position:absolute;left:0;top:0;pointer-events:none}
.leaflet-control.map-weather-control{width:min(520px,calc(100vw - 40px));padding:8px 10px;border-radius:12px;background:var(--bg-card);color:var(--text);border:1px solid var(--border);box-shadow:var(--shadow);font-size:12px}
.map-weather-tabs{display:flex;gap:4px;flex-wrap:wrap}
.map-weather-tabs button{flex:1 1 auto;padding:5px 10px;border:1px solid var(--border);border-radius:16px;background:transparent;color:var(--text-secondary);font:inherit;cursor:pointer}
.map-weather-tabs button:hover{background:var(--bg-hover)}
.map-weather-tabs button.active{background:var(--info);border-color:var(--info);color:#fff}
.map-weather-body{margin-top:8px}
.map-weather-body[hidden]{display:none}
.map-weather-time{display:flex;align-items:center;gap:8px}
.map-weather-time b{font-weight:600;font-variant-numeric:tabular-nums}
.map-weather-play{width:28px;height:28px;border-radius:50%;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text);cursor:pointer;font-size:11px;line-height:1}
.map-weather-slider{width:100%;margin:8px 0 2px;accent-color:var(--info)}
.map-weather-marks{position:relative;height:16px;margin:0 8px}
.map-weather-marks span{position:absolute;transform:translateX(-50%);font-size:10px;color:var(--text-muted);white-space:nowrap}
.map-weather-marks i{position:absolute;top:-4px;width:2px;height:4px;background:var(--danger);transform:translateX(-1px)}
.map-weather-legend{margin-top:6px}
.map-weather-legend-bar{height:8px;border-radius:4px}
.map-weather-legend-ticks{position:relative;height:14px;margin-top:2px}
.map-weather-legend-ticks span{position:absolute;transform:translateX(-50%);font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums}
.map-weather-legend small,.map-weather-status{display:block;color:var(--text-muted);font-size:11px;margin-top:2px}
.map-weather-popup b{font-size:18px}
@media(max-width:600px){.leaflet-control.map-weather-control{padding:6px 8px}.map-weather-tabs button{padding:4px 6px}}
/* Cadastral overlays (NSPD): zoom hint and object popup. */
.leaflet-control.cadastre-hint{max-width:260px;padding:6px 10px;border-radius:8px;background:var(--bg-card);color:var(--text-secondary);border:1px solid var(--border);box-shadow:var(--shadow);font-size:12px}
.leaflet-control.cadastre-hint[hidden]{display:none}
.cadastre-popup .cadastre-item+.cadastre-item{margin-top:10px;padding-top:8px;border-top:1px solid var(--border)}
.cadastre-popup .cadastre-item b{font-size:14px;font-variant-numeric:tabular-nums}
.cadastre-popup .cadastre-item small{color:var(--text-muted)}
.cadastre-popup table{margin-top:4px;border-collapse:collapse;font-size:12px}
.cadastre-popup th{padding:2px 8px 2px 0;text-align:left;font-weight:500;color:var(--text-muted);vertical-align:top;white-space:nowrap}
.cadastre-popup td{padding:2px 0;vertical-align:top}
.cadastre-popup .cadastre-source{display:block;margin-top:6px;color:var(--text-muted)}
.cadastre-popup .cadastre-name{margin-top:2px;font-size:12px}
.cadastre-popup details{margin-top:4px;font-size:12px}
.cadastre-popup details p{margin:4px 0 0;max-height:160px;overflow:auto;color:var(--text-secondary)}
.leaflet-control.cadastre-panel{display:flex;flex-direction:column;gap:6px;max-width:300px;padding:6px;border-radius:10px;background:var(--bg-card);border:1px solid var(--border);box-shadow:var(--shadow);font-size:12px}
.leaflet-control.cadastre-panel[hidden]{display:none}
.cadastre-search{display:flex;gap:4px}
.cadastre-search input{flex:1;min-width:0;padding:5px 8px;border-radius:6px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:inherit;font-variant-numeric:tabular-nums}
.cadastre-search button{padding:5px 10px;border-radius:6px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text);font:inherit;cursor:pointer}
.cadastre-search-status{color:var(--text-muted)}
.cadastre-search-status:empty{display:none}
.cadastre-fill{display:flex;align-items:center;gap:6px;color:var(--text-secondary);cursor:pointer}
.cadastre-label{pointer-events:none}
.cadastre-label span{display:inline-block;transform:translate(-50%,-50%);color:#c8102e;font:600 11px/1 system-ui,sans-serif;white-space:nowrap;text-shadow:0 0 2px #fff,0 0 2px #fff,0 0 3px #fff}
.cadastre-label.is-building span{color:#7f0000;font-size:10px;font-style:italic}
/* Road risks at permitted objects; colours describe risk, not confirmed icing. */
.road-weather-times,.road-weather-filters,.road-weather-status{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.road-weather-times button,.road-weather-filters button,.road-weather-status button{border:1px solid var(--border);background:var(--bg-card);color:var(--text);border-radius:8px;padding:6px 9px;font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:4px}
.road-weather-times button{flex:1;justify-content:center}.road-weather-times button.active{background:var(--info);color:#fff;border-color:var(--info)}
.road-weather-filters{margin-top:7px}.road-weather-filters button.active{background:var(--bg-secondary);border-color:var(--info)}.road-weather-filters b{font-variant-numeric:tabular-nums}
.road-weather-status{margin-top:7px;justify-content:space-between;color:var(--text-secondary);font-size:11px}.road-weather-status label{display:flex;gap:4px;align-items:center}.road-weather-status button{padding:2px 7px}.road-weather-empty{display:block;margin-top:4px;color:var(--text-secondary)}
.road-weather-marker{position:relative;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border:2px solid #fff;border-radius:50% 50% 50% 4px;transform:rotate(-45deg);box-shadow:0 2px 8px #0006;color:#fff;background:#64748b}.road-weather-marker svg{transform:rotate(45deg)}.road-weather-marker.danger{background:#d92d20}.road-weather-marker.warning{background:#ad6500}.road-weather-marker.station{background:#008577}.road-weather-marker sup{position:absolute;right:-7px;top:-5px;background:var(--bg-card);color:var(--text);border-radius:50%;padding:1px 4px;transform:rotate(45deg);font-size:10px}
.road-weather-popup .leaflet-popup-content-wrapper{background:var(--bg-card);color:var(--text);border:1px solid var(--border);border-radius:14px}.road-weather-popup .leaflet-popup-tip{background:var(--bg-card)}.road-weather-popup .leaflet-popup-content{margin:14px;line-height:1.4}.road-weather-popup .leaflet-popup-close-button{color:var(--text-secondary)}
.road-weather-heading strong{display:block;font-size:14px;padding-right:16px}.road-weather-heading small,.road-weather-note,.road-weather-footer small{display:block;color:var(--text-secondary);font-size:11px}.road-weather-source{color:var(--text-secondary);font-size:11px;margin-top:6px}.road-weather-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0;padding:8px;border-radius:9px;background:var(--bg-secondary)}.road-weather-metrics b{display:block;font-size:15px}.road-weather-metrics small{color:var(--text-secondary);font-size:10px}.road-weather-reason{border-left:3px solid #ad6500;padding:5px 8px;margin:6px 0;background:var(--bg-secondary);border-radius:4px}.road-weather-reason.likely{border-color:#d92d20}.road-weather-reason strong{display:flex;gap:4px;align-items:center;font-size:12px}.road-weather-reason small{display:block;color:var(--text-secondary);margin-top:3px}.road-weather-clear{color:var(--text-secondary);margin:6px 0}.road-weather-footer{display:flex;gap:8px;align-items:center;justify-content:space-between;margin-top:10px}.road-weather-footer button{border:0;color:var(--info);background:none;padding:4px;cursor:pointer;font:inherit;font-size:12px}
@media(max-width:600px){.map-weather-tabs button{font-size:11px}.road-weather-filters{gap:4px}.road-weather-filters button{padding:5px;font-size:11px}.road-weather-popup{position:fixed!important;left:12px!important;bottom:195px!important;transform:none!important;width:calc(100vw - 24px)!important;margin:0!important}.road-weather-popup .leaflet-popup-tip-container{display:none}.road-weather-popup .leaflet-popup-content{width:auto!important;max-height:42vh;overflow:auto}.road-weather-metrics b{font-size:14px}}
@media(max-width:600px){.road-weather-popup{z-index:700}}
.road-weather-marker svg,.road-weather-filters svg,.road-weather-reason svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.road-weather-footer button{color:var(--text);text-decoration:underline;text-underline-offset:3px}
.road-weather-times{display:grid;grid-template-columns:repeat(6,minmax(0,1fr))}.road-weather-times button{padding:6px 4px;white-space:nowrap}
@media(max-width:600px){.road-weather-times{grid-template-columns:repeat(3,minmax(0,1fr))}.road-weather-popup{bottom:230px!important}}


/* /css/cadastre-cache.css?v=20261011-swr */
.cadastre-freshness{display:block;margin-top:6px;color:var(--text-muted);font-size:11px;line-height:1.4}
.cadastre-freshness.is-refreshing{color:var(--text-secondary)}
.cadastre-panel [hidden]{display:none!important}


/* /css/work-review.css?v=20261024 */
.work-control-settings{border:1px solid var(--border-color,#dbe2ed);border-radius:10px;padding:14px;margin:14px 0}.work-control-settings h4,.work-report-history h4{margin:0 0 8px}.work-control-settings p,.work-report-dialog p{color:var(--text-secondary,#64748b);font-size:13px;line-height:1.5}.work-control-list{max-height:180px;overflow:auto;display:grid;gap:8px;margin:10px 0}.work-control-list label{display:flex;align-items:center;gap:8px;min-height:34px}.work-report-history{border-top:1px solid var(--border-color,#dbe2ed);margin-top:16px;padding-top:16px;overflow-wrap:anywhere}.work-review-row{background:var(--bg-secondary,#f1f5f9);border-radius:8px;margin-top:8px;padding:10px;font-size:13px;line-height:1.6}.work-review-row pre{white-space:pre-wrap;font-family:inherit;margin:6px 0;overflow-wrap:anywhere}.work-report-dialog{box-sizing:border-box;width:min(600px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;border:1px solid #cbd5e1;border-radius:14px;padding:20px;background:var(--bg-primary,#fff);color:var(--text-primary,#172033)}.work-report-dialog::backdrop{background:#0f172a99}.work-report-dialog h3{margin:0 0 12px}.work-report-dialog label{display:block;font-size:13px;font-weight:600;margin:10px 0}.work-report-dialog select,.work-report-dialog input{width:100%;box-sizing:border-box;min-width:0;min-height:42px}.work-report-dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px;background:var(--bg-secondary,#f1f5f9);padding:12px;border-radius:8px;max-height:200px;overflow:auto}.work-report-dialog footer{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:16px}.work-report-dialog [data-error]{color:var(--danger,#b91c1c);white-space:pre-wrap;overflow-wrap:anywhere}.work-report-photos{max-height:100px;overflow:auto;font-size:12px;overflow-wrap:anywhere}.work-report-note{font-size:12px;color:var(--text-secondary,#64748b)}
@media(max-width:480px){.work-report-dialog{padding:14px}.work-report-dialog footer button{flex:1;min-height:44px}.work-control-list label{min-height:42px}.work-report-history .btn{min-height:42px}}
.work-control-settings,.work-report-history{border-color:var(--border,#dbe2ed)}
.work-report-dialog{margin:auto;inset:0;background:var(--bg-card,#fff);border-color:var(--border,#cbd5e1)}
.work-report-dialog [hidden]{display:none!important}
.work-report-dialog button:disabled{opacity:.45;cursor:not-allowed}
.work-report-history{margin:14px 0 18px;padding:16px;border:1px solid var(--border,#dde3eb);border-radius:12px;background:var(--bg-card,#fff)}
.work-review-header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.work-review-header h4{display:inline;margin:0 0 0 8px;font-size:15px;font-weight:700}.work-review-header p{margin:5px 0 0;color:var(--text-muted,#64748b);font-size:12px;line-height:1.5}.work-max-badge{display:inline-flex;align-items:center;justify-content:center;background:var(--primary-light,#fce7e9);color:var(--primary,#c92434);border-radius:6px;font-size:11px;font-weight:800;letter-spacing:.04em;padding:4px 7px}.work-send-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;white-space:nowrap}.work-send-btn svg{width:16px;height:16px}.work-review-row{margin-top:13px;padding:12px 14px;border:1px solid var(--border,#e1e5eb);background:var(--bg-secondary,#f7f9fc)}.work-review-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:6px}.work-state{display:inline-flex;align-items:center;border-radius:20px;padding:3px 10px;font-size:12px;font-weight:700;background:var(--info-bg,#e8f0ff);color:var(--info,#2563eb)}.work-state-accepted{background:var(--success-bg,#e7f5ec);color:var(--success,#16824b)}.work-state-rework{background:var(--warning-bg,#fff2dc);color:var(--warning,#9e620d)}.work-state-superseded{background:var(--hover,#edf0f5);color:var(--text-muted,#64748b)}.work-delivery-line{display:flex;align-items:baseline;gap:7px 16px;flex-wrap:wrap;margin-top:8px;padding-top:8px;border-top:1px solid var(--border,#e1e5eb)}.work-delivery-line strong{font-size:12px}.work-delivery-line span,.work-delivery-line small{color:var(--text-secondary,#64748b);font-size:12px}.work-previous{margin-top:12px;font-size:12px}.work-previous summary{cursor:pointer;color:var(--text-muted,#64748b)}.work-review-empty{font-size:13px;color:var(--text-muted,#64748b);margin:12px 0 0;line-height:1.5}.work-report-photos{max-height:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;overflow:visible}.work-report-photos figure{margin:0;min-width:0;border:1px solid var(--border,#dde3eb);border-radius:7px;overflow:hidden;background:var(--bg-secondary,#eef2f7)}.work-report-photos figure img{display:block;width:100%;height:95px;object-fit:cover}.work-report-photos figure span{display:flex;align-items:center;justify-content:center;min-height:95px;text-align:center;padding:8px;color:var(--text-muted,#64748b)}.work-report-photos figcaption{font-size:10px;padding:5px 6px;overflow-wrap:anywhere;color:var(--text-secondary,#64748b)}.work-report-photos>p{grid-column:1/-1}.work-preview-heading{font-size:13px;font-weight:700;margin:12px 0 7px}
@media(max-width:480px){.work-report-history{padding:13px}.work-review-header{gap:10px}.work-review-header [data-review-actions]{width:100%}.work-send-btn{width:100%}.work-review-row{padding:10px}.work-report-photos{grid-template-columns:repeat(2,minmax(0,1fr))}}

.work-act-panel{margin:16px 0;padding:14px;border:1px solid var(--border-color,#d8dfeb);border-radius:12px;background:var(--bg-secondary,#f4f7fb)}.work-act-panel h4{margin:0 0 8px}.work-act-dates{display:grid;grid-template-columns:1fr 1fr;gap:10px}.work-act-panel label{display:block;margin:10px 0}.work-act-include{display:flex!important;gap:8px;align-items:center}.work-act-include input{width:auto}.work-act-panel [data-act-downloads]{display:flex;gap:8px;flex-wrap:wrap}@media(max-width:480px){.work-act-dates{grid-template-columns:1fr}.work-act-panel{padding:10px}.work-act-panel .input-field{min-width:0;max-width:100%}}
.work-act-include[hidden]{display:none!important}.work-registry-dialog{width:min(1000px,calc(100vw - 24px))}.work-registry-row{padding:12px 0;border-bottom:1px solid var(--border,#d8dfeb);overflow-wrap:anywhere}.work-registry-row p{margin:7px 0;line-height:1.5}.work-binding-warning{color:var(--warning,#9e620d);font-size:12px}.work-binding-options{max-height:320px;overflow:auto;border:1px solid var(--border,#d8dfeb);border-radius:8px;padding:8px}.work-binding-options label,.work-registry-confirm{display:flex!important;align-items:flex-start;gap:9px;line-height:1.5}.work-binding-options input,.work-registry-confirm input{width:auto!important;min-height:20px!important;flex-shrink:0}.work-resource-link{display:block;white-space:normal;text-align:left;max-width:100%;margin:8px 0}.work-registry-dialog details{margin-top:16px}.work-registry-dialog footer{position:sticky;bottom:-20px;background:var(--bg-primary,#fff);padding:12px 0}.work-review-header [data-review-actions]{display:flex;gap:8px;flex-wrap:wrap}@media(max-width:480px){.work-registry-dialog{padding:14px}.work-registry-dialog footer{bottom:-14px}}


/* /css/weather-serial.css?v=20260927-journal */
.wh65-toolbar,.wh65-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 16px}.wh65-toolbar label{display:flex;gap:8px;align-items:center}.wh65-toolbar select{max-width:100%;padding:8px;border:1px solid var(--border);border-radius:7px;background:var(--bg-card);color:var(--text)}.wh65-readings{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:16px 0}.wh65-readings .card{padding:14px}.wh65-readings small{display:block;color:var(--text-muted)}.wh65-readings strong{display:block;font-size:23px;margin-top:7px}.wh65-readings strong span{font-size:13px;font-weight:400}.wh65-chart{padding:18px}.wh65-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.wh65-form label{display:block;margin:8px 0}.wh65-form input,.wh65-form select{display:block;width:100%;padding:9px;border:1px solid var(--border);border-radius:7px;background:var(--bg-card);color:var(--text)}.wh65-form fieldset{border:1px solid var(--border);border-radius:10px;margin:16px 0;padding:12px}.wh65-form [hidden],#weather-legacy[hidden]{display:none!important}@media(max-width:600px){.wh65-fields{grid-template-columns:1fr}.wh65-toolbar label{display:block;width:100%}.wh65-toolbar select{display:block;width:100%;margin-top:5px}.wh65-readings{grid-template-columns:1fr 1fr}.wh65-readings strong{font-size:19px}}

.wh65-form .energy-camera-options input[type=checkbox]{width:auto;display:inline}.wh65-current-card{padding:16px 20px}.wh65-current-card h2{font-size:18px}.wh65-current-card .energy-totals{grid-template-columns:repeat(4,minmax(0,1fr));margin:12px 0}.wh65-current-card .energy-totals strong{font-size:22px}.wh65-current-card .energy-totals strong small{display:inline;font-weight:400}.wh65-current-card details{border-top:1px solid var(--border);padding-top:8px}.wh65-current-card summary{font-size:12px;cursor:pointer}.wh65-current-card>p{font-size:11px;margin:8px 0 0}.wh65-current-card .wh65-readings{margin-bottom:0}@media(max-width:600px){.wh65-current-card .energy-totals{grid-template-columns:1fr 1fr}.wh65-current-card .energy-totals strong{font-size:19px}}
/* Current conditions, hourly strip and map label (25.09.2026). */
.wh65-now{display:grid;grid-template-columns:minmax(200px,1fr) 2fr;gap:16px;margin:14px 0 10px;align-items:start}
.wh65-now-main{display:flex;flex-direction:column;gap:4px}
.wh65-now-temp{font-size:56px;line-height:1;font-weight:600;font-variant-numeric:tabular-nums;color:var(--text)}
.wh65-now-feels{font-size:13px;color:var(--text-muted)}
.wh65-now-rain{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:8px;font-size:13px;color:var(--text-secondary);padding:6px 10px;border-radius:var(--radius-sm,7px);background:var(--bg-secondary)}
.wh65-now-rain b{color:var(--text)}
.wh65-now-rain.is-raining{background:var(--info-bg);color:var(--info)}
.wh65-now-rain.is-raining b{color:var(--info)}
.wh65-now-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.wh65-now-cell{padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm,7px)}
.wh65-now-cell small{display:flex;align-items:center;gap:6px;color:var(--text-muted);font-size:12px}
.wh65-now-cell strong{display:flex;align-items:center;gap:6px;font-size:20px;margin-top:4px;font-variant-numeric:tabular-nums}
.wh65-now-cell strong em{font-style:normal;font-size:14px;color:var(--text-secondary)}
.wh65-now-cell>span{display:block;font-size:12px;color:var(--text-secondary);margin-top:2px}
.wh65-wind-arrow{display:inline-block;vertical-align:middle;color:var(--text-secondary);flex:none}
.wh65-hourly{margin:4px 0 10px}
.wh65-hourly-row{display:flex;gap:4px;overflow-x:auto;padding-bottom:6px;scrollbar-width:thin}
.wh65-hour{flex:0 0 56px;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;border-radius:var(--radius-sm,7px);background:var(--bg-secondary);font-variant-numeric:tabular-nums}
.wh65-hour small{font-size:11px;color:var(--text-muted)}
.wh65-hour b{font-size:15px}
.wh65-hour span{display:flex;align-items:center;gap:2px;font-size:11px;color:var(--text-secondary)}
.wh65-hour i{font-style:normal;font-size:11px;min-height:14px;color:var(--info)}
.wh65-hour.is-raining{background:var(--info-bg)}
.wh65-hourly-legend{display:block;font-size:11px;color:var(--text-muted)}
.wh65-map-tooltip{padding:2px 7px;border-radius:12px;font-weight:600;font-size:12px;box-shadow:var(--shadow)}
.wh65-map-label{display:inline-flex;align-items:center;gap:3px;font-variant-numeric:tabular-nums}
.wh65-map-label.is-raining{color:var(--info)}
.wh65-map-label.is-stale{opacity:.6}
.wh65-map-popup-temp{font-size:24px;font-weight:600;margin:4px 0}
.wh65-map-popup-temp small{font-size:12px;font-weight:400;color:var(--text-muted)}
.weather-map-camera-values .is-raining b{color:var(--info)}
@media(max-width:700px){.wh65-now{grid-template-columns:1fr}.wh65-now-temp{font-size:44px}}
.wh65-hour em{font-style:normal;font-size:10px;line-height:1;color:var(--text-muted);min-height:10px}
/* Road hazards banner and forecast ribbon. */
.wh65-risk{display:flex;flex-direction:column;gap:6px;margin:12px 0 4px}.wh65-risk:empty{display:none}
.wh65-risk-item{display:flex;align-items:flex-start;gap:8px;padding:8px 12px;border-radius:var(--radius-sm,7px);font-size:13px;line-height:1.4;background:var(--bg-secondary);color:var(--text-secondary)}
.wh65-risk-item b{color:var(--text);margin-right:4px}.wh65-risk-item .ui-icon{flex:none;margin-top:2px}
.wh65-risk-item.is-danger{background:var(--danger-bg);color:var(--danger)}.wh65-risk-item.is-danger b{color:var(--danger)}
.wh65-risk-item.is-warning{background:var(--warning-bg);color:var(--warning)}.wh65-risk-item.is-warning b{color:var(--warning)}
.wh65-risk-item.is-ok{background:var(--success-bg);color:var(--text-secondary)}.wh65-risk-item.is-ok .ui-icon{color:var(--success)}
.wh65-risk-note{font-size:11px;color:var(--text-muted)}
.wh65-forecast .wh65-hour{background:transparent;border:1px solid var(--border)}.wh65-forecast .wh65-hour.is-raining{background:var(--info-bg)}
.wh65-wx{color:var(--text-secondary);min-height:16px}.wh65-hour em.is-gusty{color:var(--warning);font-weight:700}
.wh65-day-sep{flex:0 0 auto;writing-mode:vertical-rl;transform:rotate(180deg);font-size:11px;color:var(--text-muted);padding:4px 2px;border-left:1px dashed var(--border)}
/* Weather journal */
.wj-card{margin-top:16px}
.wj-table td:first-child{white-space:nowrap}
.wj-table tr.wj-partial td{font-style:italic;color:var(--text-muted)}


/* /css/radiation.css?v=20261006 */
.radiation-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:16px}.radiation-sidebar,.radiation-card,.radiation-chart{background:var(--bg-card,var(--bg-secondary));border:1px solid var(--border);border-radius:12px;padding:16px;color:var(--text-primary)}.radiation-sidebar label{display:block;margin-bottom:12px}.radiation-sidebar button{display:block;width:100%;text-align:left;margin:6px 0;padding:10px;border:1px solid var(--border);border-radius:8px;background:transparent;color:inherit;cursor:pointer}.radiation-sidebar button.is-selected{border-color:var(--primary);background:var(--bg-hover)}.radiation-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:14px}.radiation-card small,.radiation-chart small{color:var(--text-muted)}.radiation-card h3{margin:0 0 8px}.radiation-value{font-size:28px;font-weight:700;margin:10px 0}.radiation-value span{font-size:14px;font-weight:400}.radiation-chart{margin-top:16px}.radiation-chart canvas{max-height:360px}.radiation-form{display:grid;grid-template-columns:1fr 1fr;gap:14px}.radiation-form label{display:flex;flex-direction:column;gap:6px}.radiation-form .wide{grid-column:1/-1}.radiation-form .input-field{width:100%}.radiation-link{display:block;width:100%;border:1px solid var(--border);border-radius:9px;background:var(--bg-card,var(--bg-secondary));color:var(--text-primary);padding:9px;margin:6px 0;text-align:left;cursor:pointer}.radiation-link small{color:var(--text-muted)}.radiation-link b{margin-right:12px}.radiation-actions{display:flex;gap:8px;flex-wrap:wrap}.radiation-scroll{overflow:auto}.radiation-error{color:var(--danger);margin:8px 0}@media(max-width:700px){.radiation-layout{grid-template-columns:1fr}.radiation-sidebar{padding:10px}.radiation-sidebar [data-rad-list]{display:flex;overflow-x:auto;gap:8px}.radiation-sidebar button{min-width:160px}.radiation-form{grid-template-columns:1fr}.radiation-chart{padding:10px}.radiation-value{font-size:24px}}


/* /css/gost-review.css?v=20260930-rejections */
/* Vehicle category review (views/gost-review.js) */
.gr-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border, #e2e8f0); }
.gr-summary > div { display: flex; flex-direction: column; }
.gr-summary small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.gr-summary strong { font-size: 22px; font-weight: 800; }
.gr-summary span { font-size: 11px; color: var(--text-muted); }
.gr-summary .gr-classes { flex-direction: row; gap: 10px; font-size: 13px; }
.gr-summary .gr-classes span { font-size: 13px; color: var(--text); }
.gr-summary button { margin-left: auto; }
.gr-muted { color: var(--text-muted); }
.gr-dialog { width: min(760px, 96vw); max-height: 94vh; overflow: auto; padding: 16px 18px; }
.gr-dialog .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gr-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--text-muted); }
.gr-kind { padding: 2px 8px; border-radius: 10px; font-weight: 600; color: #fff; background: #6b7280; }
.gr-kind-holdout { background: #2563eb; }
.gr-kind-live { background: #f59e0b; }
.gr-kind-dataset { background: #7c3aed; }
.gr-image { display: flex; justify-content: center; align-items: center; min-height: 240px; margin: 10px 0; background: var(--bg-secondary, #f1f5f9); border-radius: 8px; }
.gr-image img { max-width: 100%; max-height: 52vh; border-radius: 6px; }
.gr-verdicts { font-size: 14px; margin-bottom: 10px; }
.gr-bad { color: var(--danger, #dc2626); }
.gr-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.gr-buttons .gr-cat { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: 8px 10px; border: 1px solid var(--border); background: var(--bg-card, #fff); }
.gr-buttons .gr-cat b { font-size: 20px; }
.gr-buttons .gr-cat small { font-size: 11px; color: var(--text-muted); }
.gr-hint { display: block; margin-top: 8px; color: var(--text-muted); }
.gr-error { color: var(--danger, #dc2626); }
.gr-empty { padding: 30px; text-align: center; color: var(--text-muted); }

.gr-rejections { max-width: 960px; }
.gr-rej-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; max-height: 70vh; overflow: auto; }
.gr-rej { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--border, #ddd); border-radius: 8px; }
.gr-rej img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #111; border-radius: 4px; }
.gr-rej-actions { display: flex; gap: 4px; }
.gr-rej-actions .btn { flex: 1; }


/* /css/users-table.css?v=20261008-1 */
.settings-users-table{width:100%;table-layout:auto}.settings-users-table td{vertical-align:middle!important}.settings-users-table th:last-child,.settings-users-table td:last-child{width:168px;min-width:168px}.user-row-actions{display:grid;grid-template-columns:repeat(4,32px);gap:6px;align-items:center}.user-row-actions .btn{width:32px;height:32px;min-height:32px;padding:0!important;display:inline-flex;justify-content:center;align-items:center;margin:0!important;line-height:1}.user-row-actions .btn-clone-user{grid-column:1}.user-row-actions .btn-edit-user{grid-column:2}.user-row-actions .btn-impersonate-user{grid-column:3}.user-row-actions .btn-delete-user{grid-column:4}.user-row-actions svg{width:15px;height:15px}.user-column-sort{border:0;background:none;color:inherit;font:inherit;text-transform:inherit;letter-spacing:inherit;display:inline-flex;align-items:center;gap:6px;padding:0;cursor:pointer;text-align:left}.user-column-sort span{font-size:11px;color:var(--text-muted)}.user-column-sort:focus-visible{outline:2px solid var(--primary);outline-offset:4px}.settings-users-table .activity-table-sub{white-space:normal;overflow-wrap:anywhere;max-width:250px}.settings-users-table td:nth-child(3){white-space:normal;overflow-wrap:anywhere;max-width:260px}

