:root { font-family: "Segoe UI", Tahoma, sans-serif; font-size: 12px; color: #202020; background: #f0f0f0; color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 679px; min-height: 658px; height: 100%; overflow: hidden; background: #f0f0f0; }
button, input, select { font: inherit; color: #202020; }
.qt-window { height: 100vh; display: flex; flex-direction: column; background: #f0f0f0; }
.titlebar { height: 31px; flex: 0 0 31px; padding: 0 8px; display: flex; align-items: center; justify-content: space-between; background: #f7f7f7; border-bottom: 1px solid #b5b5b5; }
.server-state { display: flex; gap: 7px; align-items: center; }
.server-state i { width: 13px; height: 13px; flex: 0 0 13px; border: 1px solid #777; border-radius: 50%; background: #aaa; }
.server-state i.online { background: #168cff; border-color: #006dcc; box-shadow: 0 0 5px #168cff; }
.central-widget { min-height: 0; flex: 1; display: flex; flex-direction: column; padding: 9px; }
.video-label { position: relative; min-width: 0; max-width: 100%; flex: 1 1 45%; min-height: 240px; display: grid; place-items: center; overflow: hidden; background: #202124; color: #d0d0d0; border: 1px solid #777; cursor: crosshair; }
.video-label img, .video-label #liveFrame { display: none; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.video-label.has-frame img, .video-label.has-frame #liveFrame { display: block; }.video-label.has-frame #viewerEmpty { display: none; }
#regionCanvas { display: none; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; touch-action: none; }
.video-label.region-editing #regionCanvas { display: block; }
.video-label.region-editing #liveFrame { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.video-label.region-editing #hlsPlayer, .video-label.region-editing #viewerEmpty { display: none; }
.splitter-handle { height: 6px; flex: 0 0 6px; cursor: row-resize; touch-action: none; user-select: none; border-block: 1px solid #bbb; background: linear-gradient(#ededed,#d8d8d8); }
.splitter-handle:hover, .splitter-handle.dragging { border-color: #7b9db9; background: linear-gradient(#dcecf8,#bdd8ec); }
body.resizing, body.resizing * { user-select: none !important; cursor: row-resize !important; }
.control-panel { flex: 1 1 55%; min-height: 350px; display: grid; grid-template-columns: minmax(180px, 220px) 1fr; gap: 6px; overflow: hidden; }
.section-list { min-width: 180px; max-width: 240px; overflow: auto; background: white; border: 1px solid #9e9e9e; padding: 0; font: 12px "Segoe UI", Tahoma, sans-serif; }
.nav-category { height: 24px; padding: 4px 5px; display: flex; align-items: center; color: rgb(70,70,70); background: rgb(238,238,238); font-weight: 700; }
.nav-page { width: 100%; height: 20px; min-height: 20px; padding: 1px 5px 1px 18px; border: 0; border-radius: 0; background: white; text-align: left; line-height: 18px; cursor: default; }
.nav-page:hover { background: #e5f3ff; }.nav-page.active { color: white; background: #0078d7; }
.nav-separator { height: 1px; background: rgb(190,190,190); }
.tab-widget { min-width: 0; overflow: hidden; background: #f0f0f0; border: 1px solid #aaa; }
.tab-page { display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; }
.tab-page.active { display: block; }
.description { margin: 0 0 10px; line-height: 1.45; }
fieldset { min-width: 0; margin: 8px 0; padding: 12px 10px 10px; border: 1px solid #aaa; }
legend { padding: 0 5px; }
.form-grid { display: grid; grid-template-columns: max-content minmax(160px,1fr) max-content; gap: 6px 8px; align-items: center; }
.form-grid.compact { max-width: 720px; grid-template-columns: minmax(170px,max-content) minmax(120px,260px) 1fr; }
.form-grid label { text-align: left; }.form-grid > span:empty { min-width: 1px; }
input, select { min-width: 0; height: 25px; padding: 2px 5px; border: 1px solid #8f8f8f; border-radius: 0; background: white; }
input:focus, select:focus { outline: 1px solid #0078d7; border-color: #0078d7; }
input[type=checkbox] { width: 13px; height: 13px; min-height: 0; padding: 0; }
input[type=file] { height: 27px; padding: 2px; }
button { min-height: 26px; padding: 3px 13px; border: 1px solid #8d8d8d; border-radius: 2px; background: linear-gradient(#fff,#e6e6e6); cursor: default; }
button:hover { border-color: #0078d7; background: #e5f1fb; }button:active { background: #cce4f7; }button.default { border: 2px solid #0078d7; padding: 2px 12px; }
button:disabled, input:disabled, select:disabled { color: #888; background: #e8e8e8; }
.check { display: flex; align-items: center; gap: 5px; min-height: 24px; }
.yolo-settings-layout { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 12px; align-items: stretch; }
.yolo-settings-layout > fieldset { width: 100%; min-width: 0; margin: 0; }
.yolo-parameters .form-grid.compact { width: 100%; max-width: none; grid-template-columns: minmax(170px, max-content) minmax(100px, 1fr); }
.yolo-parameters .form-grid > span:empty { display: none; }
.class-filter { max-width: none; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 2px 16px; }
.inline, .button-row, .toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.button-row { margin-top: 9px; }.toolbar { margin-bottom: 9px; }.toolbar label { display: flex; align-items: center; gap: 5px; }
.source-action-row { flex-wrap: nowrap; }
.recording-button { display: inline-flex; align-items: center; gap: 7px; }
.recording-dot { width: 13px; height: 13px; flex: 0 0 13px; border: 1px solid #777; border-radius: 50%; background: #aaa; }
.recording-dot.active { border-color: #bd0000; background: #ff0000; box-shadow: 0 0 6px #ff0000; }
#recordingDuration { width: 82px; flex: 0 0 82px; }
.toolbar .history-settings-save { margin-left: auto; }
.history-filters { margin: 0 0 9px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.history-filters label { display: flex; align-items: center; gap: 5px; }
.history-filters select { min-width: 150px; }
.history-filters .history-time { min-width: 82px; }
.history-sort { width: 100%; min-height: 0; padding: 0 18px 0 0; position: relative; border: 0; background: transparent; text-align: left; }
.history-sort:hover { border: 0; background: transparent; color: #005a9e; }
.history-sort.active::after { content: "▲"; position: absolute; right: 2px; top: 50%; font-size: 9px; transform: translateY(-50%); }
.history-sort.active.desc::after { content: "▼"; }
.spin-suffix { display: inline-flex; align-items: stretch; height: 25px; border: 1px solid #8f8f8f; background: white; }
.spin-suffix input { height: 23px; border: 0; width: 86px; }.spin-suffix span { padding: 4px 5px 0 2px; color: #444; }
.ptz-grid { width: 112px; display: grid; grid-template-columns: repeat(3,34px); grid-template-areas: ". up ." "left stop right" ". down ."; gap: 4px; }
.ptz-grid button { width: 34px; height: 28px; min-height: 28px; padding: 0; }.ptz-grid button:nth-child(1){grid-area:up}.ptz-grid button:nth-child(2){grid-area:left}.ptz-grid button:nth-child(3){grid-area:stop}.ptz-grid button:nth-child(4){grid-area:right}.ptz-grid button:nth-child(5){grid-area:down}
.region-editor { margin-top: 9px; display: flex; flex-direction: column; gap: 8px; min-height: 300px; }
.region-list { width: 100%; min-height: 130px; height: 150px; border: 1px solid #999; background: white; font: inherit; }
.region-details { width: 100%; min-width: 0; }.region-details output { min-height: 25px; padding: 4px 5px; }
.coordinates { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 5px 7px; align-items: center; }.coordinates .head { text-align: center; }.coordinates input { width: 100%; }
.status-text { margin: 9px 0; color: #555; }.preview-scroll { margin-top: 8px; min-height: 180px; overflow: auto; border: 1px solid #999; background: white; }.preview-scroll img { display: none; max-width: none; }.preview-scroll img.ready { display: block; }
h3 { font-size: 12px; font-weight: 400; margin: 12px 0 4px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid #999; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }th,td { height: 24px; padding: 3px 6px; text-align: left; white-space: nowrap; border-right: 1px solid #d3d3d3; border-bottom: 1px solid #d3d3d3; }th { font-weight: 400; background: #f0f0f0; }td.empty { padding: 20px; text-align: center; color: #666; }.history-photo-column,.history-photo-cell { width: 1%; }.history-photo { display: block; width: var(--history-photo-size, 128px); height: var(--history-photo-size, 128px); object-fit: contain; background: #202124; }
.statusbar { height: 25px; flex: 0 0 25px; display: flex; align-items: stretch; justify-content: flex-end; overflow: hidden; border-top: 1px solid #aaa; background: #f7f7f7; }
.statusbar span { min-width: 115px; padding: 4px 8px; border-left: 1px solid #c8c8c8; text-align: right; white-space: nowrap; }.statusbar #statusMessage { flex: 1; border: 0; text-align: left; }
dialog { width: 420px; padding: 0; border: 1px solid #777; border-radius: 0; background: #f0f0f0; color: #202020; box-shadow: 0 12px 35px #0006; }dialog::backdrop { background: #0005; }dialog form { padding: 15px; display: grid; gap: 8px; }dialog h2 { margin: 0 0 4px; font-size: 13px; }dialog label { display: grid; grid-template-columns: 120px 1fr; align-items: center; }.dialog-buttons { display: flex; justify-content: flex-end; gap: 7px; margin-top: 7px; }
#toasts { position: fixed; right: 10px; bottom: 34px; z-index: 50; display: grid; gap: 5px; }.toast { min-width: 260px; padding: 7px 9px; border: 1px solid #777; background: #ffffe1; box-shadow: 2px 3px 8px #0004; }.toast.error { color: #8b0000; border-color: #b44; }
.source-camera,.source-file,.source-sd { display:none; }
@media(max-width:900px){.statusbar #metricQueue,.statusbar #metricBitrate{display:none}.control-panel{grid-template-columns:190px 1fr}.video-label{max-height:42vh}}
.source-grid > .inline.source-ip { display: flex; flex-wrap: nowrap; align-items: center; white-space: nowrap; }
.source-grid > #cameraSelect { width: 100%; }
.source-grid > .inline.source-ip .check { flex: 0 0 auto; }
.source-grid > .inline.source-ip select { width: 92px; flex: 0 0 92px; }
/* Ограничения QSplitter и единая строка камеры/HLS. */
.control-panel { flex: 1 0 350px; }
.source-grid { grid-template-columns: max-content minmax(0, 1fr); }
.source-grid > span:empty { display: none !important; }
.source-grid > .button-row { grid-column: 2; }
.source-grid > .camera-hls-row { width: 100%; min-width: 0; display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; }
.camera-hls-row > #cameraSelect { min-width: 110px; width: auto; flex: 1 1 auto; }
.camera-hls-row > .hls-controls { min-width: max-content; margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex: 0 0 auto; }
.camera-hls-row > .hls-controls .check { white-space: nowrap; }
.camera-hls-row > .hls-controls #hlsHeight { width: 92px; flex: 0 0 92px; }
/* Схлопывание нижнего дочернего элемента как в QSplitter. */
.control-panel.collapsed { min-height: 0; height: 0; flex: 0 0 0; visibility: hidden; }
/* HLS заменяет JPEG-предпросмотр, как в Qt Viewer. */
#hlsPlayer {
  display: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  background: #111;
  object-fit: contain;
  place-self: center;
}
.video-label.hls-active #hlsPlayer { display: block; }
.video-label.hls-active #liveFrame, .video-label.hls-active #viewerEmpty { display: none; }
.video-label.hls-active.region-editing #hlsPlayer { display: none; }
.video-label.hls-active.region-editing #liveFrame { display: block; }
/* Состояние Server находится в одной строке с адресом. */
.titlebar { justify-content: flex-start; }
.server-connection-row { width: 100%; min-width: 0; display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; }
.server-connection-row > #serverUrl { min-width: 140px; width: auto; flex: 1 1 auto; }
.server-connection-row > .server-state { min-width: max-content; margin-left: auto; display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; white-space: nowrap; }
.server-connection-row > .server-state #connectionText { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
