/* Page layout for the vision platform, built on the CNC Studio design system (ui.css — copied verbatim).
   Same shell as CNC Studio's admin: translucent side bar, 28 px page titles, white 18 px panels. */
body { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--nav); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-inline-end: 1px solid var(--nav-line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 20; }
.side .brand { padding: 4px 8px 14px; }
.side .grp { font-size: 12px; font-weight: 600; color: var(--faint); padding: 14px 12px 4px; }
.side .nv { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 8px 12px; color: var(--ink); text-decoration: none; font-size: 14px; transition: background .2s, color .2s; }
.side .nv svg { color: var(--copper); }
.side .nv:hover { background: var(--sunk); }
.side .nv.on { background: var(--sunk2); font-weight: 600; }
.side .nv .n { margin-inline-start: auto; background: var(--bad); color: #fff; border-radius: 980px; font-size: 11px; padding: 0 7px; font-weight: 700; font-style: normal; }
.side .foot { margin-top: auto; display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 6px 0; }
.sysline { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
main { padding: 32px 36px 70px; min-width: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 8px 12px; border-inline-end: 0; border-bottom: 1px solid var(--nav-line); }
  .side .nv { flex: none; white-space: nowrap; } .side .grp, .side .brand b, .sysline span:last-child { display: none; }
  .side .brand { padding: 0 0 0 6px; flex: none; } .side .foot { margin-top: 0; padding: 0; flex: none; }
  main { padding: 22px 16px 60px; }
}

/* page head */
.bar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.bar h1 { font-size: 28px; line-height: 1.14; }
.bar p { margin: 6px 0 0; color: var(--muted); }
.bar .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back svg { transform: rotate(-90deg); }
.back { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.back:hover { color: var(--ink); }
.stack18 { display: grid; gap: 18px; }

/* KPIs + panels (CNC admin) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid transparent; border-radius: 18px; padding: 18px; display: grid; gap: 4px; }
.kpi .h { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; }
.kpi .h svg { color: var(--copper); }
.kpi b { font-family: var(--display); font-size: 28px; letter-spacing: -.005em; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--faint); font-size: 11.5px; }
.kpi.dark { background: var(--deep); border-color: var(--line); color: #f5f5f7; }
.kpi.dark .h, .kpi.dark small { color: #a1a1a6; } .kpi.dark .h svg { color: #2997ff; }
.kpi.alarm { background: var(--bad-soft); border-color: var(--bad-line); } .kpi.alarm b { color: var(--bad-ink); }
.panel { background: var(--card); border: 1px solid transparent; border-radius: 18px; overflow: hidden; }
.panel > h3 { font-size: 15px; padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel > h3 .tools { display: flex; gap: 6px; align-items: center; font-family: var(--font); font-weight: 400; }
.panel .inner { padding: 18px; display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1150px) { .two, .main-side { grid-template-columns: 1fr; } }
.empty { color: var(--muted); text-align: center; padding: 44px 16px; display: grid; gap: 10px; justify-items: center; }
.empty svg { width: 30px; height: 30px; color: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.wait { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.off { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.chip.info { background: var(--info-soft); color: var(--info-ink); }
.chip.exp { background: var(--ai-soft); color: var(--ai1); }
.search { position: relative; }
.search input { padding-inline-start: 34px; width: 240px; border-radius: 980px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 140px; border-radius: 980px; }
.toolbar input[type=date] { width: auto; border-radius: 980px; }

/* live video tiles — always dark, like a monitor wall */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.screen { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 16/9; cursor: pointer; box-shadow: var(--shadow); }
.screen img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.screen .ph, .viewer .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #a1a1a6; font-size: 13px; }
.screen .cap { position: absolute; z-index: 2; inset-inline: 0; bottom: 0; padding: 26px 14px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); color: #f5f5f7; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.screen .cap b { font-weight: 600; }
.screen .cap .r { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; color: #d2d2d7; font-size: 12px; }
.screen .live-tag, .viewer .live-tag { position: absolute; z-index: 2; top: 10px; right: 10px; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #f5f5f7; padding: 3px 10px; border-radius: 980px; font-size: 11.5px; display: inline-flex; align-items: center; gap: 6px; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: #ff453a; animation: blink 1.6s infinite; }
.live-tag.stale i { background: #ff9f0a; animation: none; }
@keyframes blink { 50% { opacity: .25; } }

/* camera cards */
.camcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cam { background: var(--card); border-radius: 18px; overflow: hidden; display: grid; border: 1px solid transparent; }
.cam.on { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.cam .im { aspect-ratio: 16/9; background: #000; position: relative; cursor: pointer; }
.cam .im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .b { padding: 12px 14px; display: grid; gap: 8px; }
.cam .t { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.cam .t b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam .m { display: flex; gap: 6px; flex-wrap: wrap; }
.cam.offline { opacity: .55; }

/* camera page */
.camgrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(380px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1250px) { .camgrid { grid-template-columns: 1fr; } }
.viewer { position: relative; background: #000; aspect-ratio: 16/9; }
.viewer img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; display: block; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.stats4 div { padding: 12px 16px; display: grid; gap: 2px; }
.stats4 div + div { border-inline-start: 1px solid var(--line); }
.stats4 span { color: var(--muted); font-size: 12px; } .stats4 b { font-family: var(--display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.feat { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.feat:last-child { border-bottom: 0; }
.feat .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--copper-soft); color: var(--copper); display: grid; place-items: center; }
.feat .t { font-weight: 600; }
.feat .d { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.feat .a { display: flex; gap: 6px; align-items: center; }
.feat.off { opacity: .55; }

/* feature catalogue */
.catg { font-size: 12px; font-weight: 600; color: var(--faint); margin: 6px 0 -2px; }
.catl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cat { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px; text-align: start; cursor: pointer; display: grid; gap: 6px; align-content: start; transition: border-color .2s, box-shadow .2s, transform .25s; }
.cat:hover { border-color: var(--copper); box-shadow: 0 0 0 3px var(--ring); transform: translateY(-2px); }
.cat b { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.cat span { color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* events */
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ev { background: var(--card); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid transparent; }
.ev.ok { border-color: var(--ok); } .ev.bad { border-color: var(--bad); }
.ev .im { position: relative; aspect-ratio: 16/10; background: #000; cursor: zoom-in; }
.ev .im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev .im .sev { position: absolute; top: 10px; inset-inline-start: 10px; }
.ev .im .play { position: absolute; bottom: 10px; inset-inline-start: 10px; }
.ev .b { padding: 12px 14px; display: grid; gap: 6px; flex: 1; align-content: start; }
.ev .tt { font-weight: 600; }
.ev .mm { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; gap: 8px; }
.ev .act { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 14px 14px; }
.ev .act .btn.on-ok { background: var(--ok); color: #fff; } .ev .act .btn.on-bad { background: var(--bad); color: #fff; }
.feed .it { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; transition: background .2s; }
.feed .it:hover { background: var(--hover); }
.feed .it:last-child { border-bottom: 0; }
.feed .it img { width: 76px; height: 46px; object-fit: cover; border-radius: 9px; background: #000; }
.feed .it b { font-size: 13px; font-weight: 600; display: block; }
.feed .it small { color: var(--muted); font-size: 11.5px; display: flex; gap: 6px; align-items: center; }

/* modal sizes (ui.css gives the look) */
.modal > .sheet.xl { width: min(1180px, 100%); }
.modal > .sheet.lg { width: min(820px, 100%); }
.modal .foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal .foot .note-t { color: var(--muted); font-size: 12.5px; margin-inline-end: auto; }
.modal .body.flush { padding: 0; }
.modal .body h4 { font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.modal .body h4 svg { color: var(--copper); }
.zoom { width: 100%; display: block; border-radius: 0 0 18px 18px; background: #000; }

/* zone editor */
.ze { position: relative; background: #000; border-radius: 14px; overflow: hidden; user-select: none; touch-action: none; cursor: crosshair; }
.ze img { width: 100%; display: block; }
.ze svg.ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ze .wait { position: absolute; inset: 0; display: grid; place-items: center; color: #a1a1a6; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { min-width: 44px; height: 34px; border-radius: 980px; border: 0; background: var(--btn2); color: var(--ink); cursor: pointer; font-size: 12.5px; }
.days button.on { background: var(--solid); color: var(--on-solid); }
.pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; padding: 10px; border: 1px solid var(--line2); border-radius: 12px; }
.pick button { border: 0; background: var(--btn2); border-radius: 980px; padding: 4px 11px; font-size: 12px; cursor: pointer; color: var(--ink); }
.pick button.on { background: var(--solid); color: var(--on-solid); }
.people-pick label { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 13px; }
.people-pick input { width: auto; }
.slider .unit input { padding-top: 7px; padding-bottom: 7px; }

/* reports */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 18px; }
.bars .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars .b { width: 100%; max-width: 34px; background: linear-gradient(180deg, #2997ff, #0071e3); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; }
.bars .b:hover::after { content: attr(data-t); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--tile); color: #f5f5f7; padding: 3px 8px; border-radius: 8px; font-size: 11px; white-space: nowrap; z-index: 2; }
.bars .c span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 10px; padding: 18px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .tr { height: 8px; background: var(--sunk2); border-radius: 99px; overflow: hidden; }
.hbar .tr i { display: block; height: 100%; background: var(--copper); border-radius: 99px; }
.hbar b { text-align: end; font-variant-numeric: tabular-nums; }
pre.code { margin: 0; background: var(--tile); color: #f5f5f7; border-radius: 12px; padding: 14px; font-size: 12px; line-height: 1.6; overflow-x: auto; direction: ltr; text-align: left; font-family: var(--mono); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv span { color: var(--muted); }

/* lift (transform) and reveal (translate) animate together without overriding each other */
.lift.rv { transition-property: opacity, translate, filter, transform, box-shadow, border-color; transition-duration: 1.1s, 1.1s, 1.1s, .35s, .35s, .25s; }

/* sheets with a footer: the footer always stays on screen, the body scrolls */
.modal { overflow-y: auto; }
.modal > .sheet:has(> .foot) > .body { max-height: calc(100vh - 210px); }
.two > *, .stack > * { min-width: 0; }
/* narrow panels: a feature's buttons drop under its text instead of covering it */
.panel { container-type: inline-size; }
@container (max-width: 520px) {
  .feat { grid-template-columns: 36px minmax(0, 1fr); }
  .feat .a { grid-column: 2; justify-content: flex-start; }
}

/* face photos */
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.face { position: relative; border-radius: 14px; overflow: hidden; background: var(--sunk); aspect-ratio: 1; }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face .btn { position: absolute; top: 6px; inset-inline-end: 6px; }
.pickface { border: 0; padding: 0; cursor: pointer; } .pickface:hover { box-shadow: 0 0 0 3px var(--copper); }

/* login (CNC Studio admin) */
#login { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 16px; }
#login .card { width: min(380px, 100%); display: grid; gap: 16px; padding: 30px 28px; border-color: transparent; box-shadow: var(--shadow); }
#login .err { color: var(--bad); font-size: 13px; min-height: 18px; }
.side .foot { flex-wrap: wrap; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.who span { display: grid; font-size: 13px; font-weight: 600; } .who small { color: var(--muted); font-weight: 400; font-size: 11.5px; }

/* worker screen (kiosk) */
body.kiosk .side { display: none; } body.kiosk .shell { grid-template-columns: 1fr; } body.kiosk main { padding: 0; }
.qcs { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: #111; color: #fff; transition: background .4s; }
.qcs-top { display: flex; gap: 22px; align-items: center; padding: 18px 26px; font-size: 18px; background: rgba(0,0,0,.35); flex-wrap: wrap; }
.qcs-top b { font-size: 22px; } .qcs-top span { color: #d2d2d7; }
.qcs-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: center; padding: 24px; }
.qcs-res { font-family: var(--display); font-size: clamp(48px, 8vw, 120px); font-weight: 700; text-align: center; }
.qcs-main img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 18px; background: #000; }
.qcs-issues { padding: 0 26px 26px; font-size: 22px; display: grid; gap: 6px; }
.qcs.r-ok { background: #0c5d2a; } .qcs.r-fail { background: #8c1414; } .qcs.r-review { background: #8a5a00; } .qcs.r-pending { background: #133e78; }
@media (max-width: 800px) { .qcs-main { grid-template-columns: 1fr; } }
