/* QorğanAI · 02 · пульт Vision AI на камерах предприятия (26.11.2026).
   Перенесён из пульта компьютерного зрения ChefUp AI («Пульт зала»), свой префикс qv-, чтобы не пересекаться с cv-* в qorgan.css.
   Кадр камеры сгенерирован (img/cv-site.jpg, пример условный), рамки распознавания — в процентах от кадра.
   Цвета — только токены: --g* (каска на месте), --alert (нарушение), --hot* (акт), --st-dirty (предупреждение).
   Анимации — только transform и opacity; вне экрана стоят, при «меньше движения» разметка показывает финальное состояние. */

.qv-stage { display: block; min-height: 0; padding: clamp(14px, 3.2vw, 48px) clamp(12px, 3.2vw, 48px) clamp(34px, 4vw, 56px); border-radius: 32px; margin-top: 8px; }
.qv-win { position: relative; z-index: 1; width: 100%; max-width: none; border-radius: 20px; overflow: hidden; background: color-mix(in srgb, var(--surface) 97%, transparent); color: var(--ink); border: 1px solid var(--hair); box-shadow: var(--lift); }
.qv-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.qv-ava.ava { --s: 36px; flex: none; }
.qv-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qv-title b { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.qv-title i { font-style: normal; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qv-tabs { margin-left: auto; display: flex; gap: 3px; padding: 3px; border-radius: 11px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.qv-tabs span { font-size: 12.5px; font-weight: 500; padding: 7px 11px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.qv-tabs .is-on { background: var(--surface); color: var(--ink); box-shadow: var(--lift-sm); }

.qv-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.qv-cam { position: relative; container-type: inline-size; aspect-ratio: 1344 / 760; overflow: hidden; background: #121212; }
.qv-cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.9) contrast(1.04); }
.qv-vig { position: absolute; inset: 0; background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.36)); pointer-events: none; }
.qv-scan { position: absolute; left: 0; right: 0; top: 0; height: 7%; pointer-events: none; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--g2) 9%, transparent) 70%, color-mix(in srgb, var(--g2) 26%, transparent) 100%); transform: translateY(-100%); animation: qvScan 7s linear infinite; }
@keyframes qvScan { to { transform: translateY(1450%); } }

/* опасная зона: контур поверх жёлтой разметки на площадке */
.qv-zone { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.qv-zone path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.qv-zone .qv-zb { stroke: rgba(255, 255, 255, 0.7); stroke-width: 1.6; stroke-dasharray: 6 6; transition: opacity 0.4s; }
.qv-zone .qv-za { stroke: var(--alert); stroke-width: 3.5; opacity: 0; transition: opacity 0.4s; }
.qv-zone .qv-zg { stroke: var(--alert); stroke-width: 11; opacity: 0; transition: opacity 0.4s; }
.qv-zone.is-alert .qv-zb { opacity: 0; }
.qv-zone.is-alert .qv-za { opacity: 1; }
.qv-zone.is-alert .qv-zg { animation: qvGlow 1.6s ease-in-out infinite; }
@keyframes qvGlow { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.32; } }

.qv-ztag, .qv-siren {
  position: absolute; left: var(--x); top: var(--y); display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap;
  font: 600 clamp(7.5px, 1.18cqi, 11.5px) / 1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: #fff;
  padding: 0.5em 0.65em; border-radius: 5px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.qv-ztag { background: rgba(12, 12, 14, 0.6); transition: background-color 0.4s; }
.qv-ztag i { width: 0.75em; height: 0.75em; border-radius: 2px; border: 1.5px dashed rgba(255, 255, 255, 0.85); }
.qv-ztag.is-alert { background: color-mix(in srgb, var(--alert) 86%, #000); }
.qv-ztag.is-alert i { border-style: solid; border-color: #fff; }
/* сигнал на месте: звук на участке, пока человек в зоне */
.qv-siren { background: color-mix(in srgb, var(--alert) 86%, #000); opacity: 0; transform: translateY(6px) scale(0.92); transition: opacity 0.4s, transform 0.5s var(--ease); }
.qv-siren.is-on { opacity: 1; transform: none; }
.qv-siren svg { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qv-siren .qv-w1, .qv-siren .qv-w2 { opacity: 0.25; }
.qv-siren.is-on .qv-w1 { animation: qvWave 1s steps(1) infinite; }
.qv-siren.is-on .qv-w2 { animation: qvWave 1s steps(1) 0.5s infinite; }
@keyframes qvWave { 0% { opacity: 1; } 50% { opacity: 0.25; } }

.qv-box {
  --c: rgba(255, 255, 255, 0.85); --tag: rgba(12, 12, 14, 0.66);
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); border-radius: 6px;
  background: color-mix(in srgb, var(--c) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent);
  transition: opacity 0.4s var(--ease), transform 0.55s var(--ease), background-color 0.4s, box-shadow 0.4s;
}
.qv-box::before { content: ""; position: absolute; inset: -2px; border: 2.5px solid var(--c); border-radius: 8px; -webkit-mask: conic-gradient(at 10px 10px, #0000 75%, #000 0) 0 0 / calc(100% - 10px) calc(100% - 10px); mask: conic-gradient(at 10px 10px, #0000 75%, #000 0) 0 0 / calc(100% - 10px) calc(100% - 10px); transition: border-color 0.4s; }
.qv-box.is-hide { opacity: 0; transform: scale(1.08); }
.qv-box.is-person { --c: rgba(255, 255, 255, 0.9); }
.qv-box.is-ok { --c: var(--g2); --tag: color-mix(in srgb, var(--g3) 78%, #000); }
.qv-box.is-bad { --c: var(--alert); --tag: color-mix(in srgb, var(--alert) 86%, #000); }
.qv-box.is-machine { --c: #ffffff; }
.qv-box.is-machine::before { border-style: dashed; -webkit-mask: none; mask: none; border-width: 1.5px; }
.qv-box.is-alert::after { content: ""; position: absolute; inset: -4px; border: 1.5px solid var(--c); border-radius: 10px; animation: qvPulse 1.8s var(--ease) infinite; pointer-events: none; }
@keyframes qvPulse { 0% { transform: scale(0.99); opacity: 0.85; } 100% { transform: scale(1.06); opacity: 0; } }
.qv-tag {
  position: absolute; left: -2px; bottom: calc(100% + 5px); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font: 600 clamp(7.5px, 1.18cqi, 11.5px) / 1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: var(--tag); padding: 0.45em 0.6em; border-radius: 5px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background-color 0.4s;
}
.qv-tag em { font-style: normal; font-variant-numeric: tabular-nums; opacity: 0.92; }
.qv-box.is-r .qv-tag { left: auto; right: -2px; }

.qv-hud { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.qv-hud.is-bottom { top: auto; bottom: 10px; }
.qv-hud > span { display: inline-flex; align-items: center; gap: 6px; font: 500 clamp(8px, 1.15cqi, 11px) / 1 var(--mono); letter-spacing: 0.06em; color: #fff; background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); padding: 0.5em 0.7em; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qv-hud b { font-weight: 600; }
.qv-rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--alert); animation: qvRec 1.4s steps(1) infinite; }
@keyframes qvRec { 50% { opacity: 0.2; } }

.qv-feed { position: relative; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--hair); }
.qv-feed-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 13px 14px 11px; border-bottom: 1px solid var(--hair); }
.qv-feed-h b { font-size: 13.5px; font-weight: 600; }
.qv-feed-h span { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--muted); }
.qv-feed-h span i { width: 7px; height: 7px; border-radius: 50%; background: var(--g3); animation: qvRec 1.8s steps(1) infinite; }
.qv-events { list-style: none; margin: 0; padding: 8px; display: grid; gap: 6px; align-content: start; }
.qv-events li { --c: var(--muted); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; padding: 10px 11px; border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); }
.qv-events li.is-bad { --c: var(--alert); }
.qv-events li.is-wait { --c: var(--st-dirty); }
.qv-events li.is-act { --c: var(--hot); }
.qv-events li.is-ok { --c: var(--g3); }
:root[data-theme="dark"] .qv-events li.is-ok { --c: var(--g1); }
.qv-events time { font-family: var(--mono); font-size: 10.5px; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.qv-events p { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qv-events p b { font-size: 12.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.qv-events p small { font-size: 11px; color: var(--muted); }
.qv-events li > span { grid-column: 2; justify-self: start; margin-top: 3px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.qv-events li.is-new { animation: qvIn 0.6s var(--ease); }
@keyframes qvIn { from { opacity: 0; transform: translateY(-10px); } }

.qv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--hair); }
.qv-kpis > div { display: flex; flex-direction: column; gap: 4px; padding: 13px 16px 14px; min-width: 0; }
.qv-kpis > div + div { border-left: 1px solid var(--hair); }
.qv-kpis b { font-size: clamp(18px, 1.7vw, 24px); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: color 0.4s; }
.qv-kpis b small { font-size: 0.6em; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.qv-kpis b.is-up { color: var(--hot-ink); }
.qv-kpis b.is-bad { color: var(--alert); }
.qv-kpis span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

/* высота пульта не меняется, пока события приходят: на компьютере ленту задаёт высота кадра (лишнее уходит под затухание),
   на планшете и телефоне у каждой карточки высота двухстрочной */
@media (min-width: 1101px) {
  .qv-feed { height: 0; min-height: 100%; overflow: hidden; }
  .qv-events { -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
}
@media (max-width: 1100px) { .qv-events li { min-height: 100px; align-content: start; } }

.qv-stage:not(.is-vis) *, .qv-stage:not(.is-vis) *::before, .qv-stage:not(.is-vis) *::after { animation-play-state: paused !important; }
@container (max-width: 560px) {
  /* маленький кадр: подписи только у нарушения, остальное — цветом рамок и лентой событий */
  .qv-tag { display: none; }
  .qv-box.is-alert .qv-tag, .qv-box.is-bad .qv-tag { display: inline-flex; }
  .qv-hud .qv-rec, .qv-hud.is-bottom .qv-count { display: none; }
  .qv-siren span, .qv-ztag { display: none; }
}
@media (max-width: 1100px) {
  .qv-body { grid-template-columns: minmax(0, 1fr); }
  .qv-feed { border-left: 0; border-top: 1px solid var(--hair); }
  .qv-events { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .qv-stage { border-radius: 26px; }
  .qv-win { border-radius: 16px; }
  .qv-top { padding: 10px 12px; }
  .qv-tabs { display: none; }
  .qv-events { grid-template-columns: minmax(0, 1fr); }
  .qv-events li:nth-child(n + 4) { display: none; }
  .qv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qv-kpis > div { padding: 11px 13px 12px; }
  .qv-kpis > div:nth-child(3) { border-left: 0; }
  .qv-kpis > div:nth-child(n + 3) { border-top: 1px solid var(--hair); }
}
@media (prefers-reduced-motion: reduce) {
  .qv-scan { display: none; }
  .qv-box::after, .qv-rec i, .qv-feed-h span i, .qv-zone .qv-zg, .qv-siren .qv-w1, .qv-siren .qv-w2 { animation: none !important; }
  .qv-zone.is-alert .qv-zg { opacity: 0.2; }
  .qv-siren .qv-w1, .qv-siren .qv-w2 { opacity: 1; }
}
