/* portal-ui2 (ui2-layer-marker) - 2026-11-12
   Friendlier menu + slimmer Live View status line. Style only; no feature is removed or moved in the page code.
   Everything is scoped under html.ui2, which is set only when this browser has hdr_ui2=1 (open the portal once with ?ui2=1 to turn on, ?ui2=0 to turn off).
   Rollback: remove the <link>/<script> pair marked ui2-layer-marker from index.html, or just open ?ui2=0. */

/* ── 1. Menu group headers: a full row in normal letters instead of a tiny capital label ── */
html.ui2 #sidebar-nav .nav-section-label-injected{
  display:flex!important;align-items:center!important;gap:8px!important;
  height:36px!important;padding:0 10px!important;margin:6px 6px 0!important;border-radius:8px;
  font-size:13px!important;font-weight:600!important;letter-spacing:0!important;
  text-transform:lowercase!important;color:var(--text-secondary)!important;
}
html.ui2 #sidebar-nav .nav-section-label-injected .navsec-text{display:block;flex:1;min-width:0}
html.ui2 #sidebar-nav .nav-section-label-injected .navsec-text::first-letter{text-transform:uppercase}
html.ui2 #sidebar-nav .nav-section-label-injected .navsec-caret{
  order:3;margin-left:auto;width:16px;font-size:12px!important;color:var(--text-muted)!important;
}
html.ui2 #sidebar-nav .nav-section-label-injected .navsec-ico{opacity:.85}
html.ui2 #sidebar-nav .nav-section-label-injected:hover{background:var(--surface-2);color:#fff!important}
html.ui2 #sidebar-nav .nav-section-label-injected:focus-visible{outline:2px solid var(--action);outline-offset:-2px}
html.ui2 #sidebar-nav .nav-section-label-injected[aria-expanded="true"]{color:var(--text-primary)!important}

/* ── 2. Pinned pages: a normal-looking group at the top instead of small chips ── */
html.ui2 #nav-pins{display:flex!important;flex-direction:column!important;flex-wrap:nowrap!important;gap:1px!important;height:auto!important;padding:0 6px 8px!important;margin-bottom:4px;border-bottom:1px solid var(--border-1)}
html.ui2 #nav-pins:empty{display:none!important}
html.ui2 #nav-pins:not(:empty)::before{content:'Pinned';font-size:13px;font-weight:600;color:var(--text-secondary);padding:6px 10px 4px}
html.ui2 #nav-pins .navpin-chip{
  width:100%;height:34px!important;padding:0 10px!important;border:0!important;border-radius:8px!important;background:transparent!important;
  font-size:14px!important;font-weight:500;color:var(--text-primary)!important;
  display:flex;align-items:center;justify-content:flex-start;gap:8px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;
}
html.ui2 #nav-pins .navpin-chip:hover{background:var(--surface-2)!important}
html.ui2 #nav-pins .navpin-chip:focus-visible{outline:2px solid var(--action);outline-offset:-2px}

/* ── 3. Client menu: short and flat, no groups to open ── */
html.ui2 body.is-client #sidebar-nav .nav-section-label-injected{display:none!important}
html.ui2 body.is-client #sidebar-nav .nav-item.navsec-collapsed-item:not(.hidden-by-filter){display:flex!important}

/* ── 4. Live View (staff, wide screens): the four status boxes become one slim line, so the video sits higher ── */
@media (min-width:769px){
  html.ui2 body:not(.is-client) #page-live .stats{display:flex!important;height:auto!important;margin-bottom:10px!important}
  html.ui2 body:not(.is-client) #page-live .stats .stat{
    display:flex!important;align-items:baseline;gap:8px;flex:1 1 0;min-width:0;height:auto!important;padding:9px 14px!important;
  }
  html.ui2 body:not(.is-client) #page-live .stats .stat::after{display:none!important}
  html.ui2 body:not(.is-client) #page-live .stats .stat-lbl{margin:0!important;flex-shrink:0}
  html.ui2 body:not(.is-client) #page-live .stats .stat-val{margin:0!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  html.ui2 body:not(.is-client) #page-live .stats .stat-sub{margin:0!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1 1 0}
}

/* ── 5. Phones and tablets: every menu row is at least 44 px tall so it is easy to tap ── */
@media (max-width:768px){
  html.ui2 #sidebar-nav .nav-section-label-injected{height:44px!important;font-size:14px!important;margin-top:4px!important}
  html.ui2 #nav-pins .navpin-chip{height:44px!important;font-size:15px!important}
  html.ui2 #nav-pins:not(:empty)::before{font-size:14px}
}
@media (prefers-reduced-motion:reduce){
  html.ui2 #sidebar-nav .nav-section-label-injected .navsec-caret{transition:none!important}
}

/* ── 6. Sites list in the menu (with portal-ui2.js): its own box, about 8 rows tall, scrolls by itself, with a find field ── */
html.ui2 #ui2-sites-box{margin:2px 6px 8px;border:1px solid var(--border-1);border-radius:10px;background:rgba(255,255,255,.02);overflow:hidden;flex-shrink:0}
html.ui2 #ui2-sites-box .ui2-sites-find{
  display:block;width:calc(100% - 12px);margin:6px;height:32px;padding:0 10px;box-sizing:border-box;
  border:1px solid var(--border-1);border-radius:8px;background:var(--bg-input);color:var(--text-primary);
  font-family:inherit;font-size:13px!important;outline:none;
}
html.ui2 #ui2-sites-box .ui2-sites-find:focus{border-color:var(--action)}
html.ui2 #ui2-sites-box .ui2-sites-list{max-height:292px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-bottom:4px}
html.ui2 #ui2-sites-box .ui2-hide{display:none!important}
html.ui2 #ui2-sites-box .ui2-sites-none{padding:8px 14px;font-size:13px;color:var(--text-muted)}
html.ui2 #ui2-sites-box .site-nav-item{margin-left:2px!important;margin-right:2px!important;padding-left:12px!important}
html.ui2 #ui2-sites-box .site-nav-item[data-site-feature]{padding-left:34px!important}
@media (max-width:768px){
  html.ui2 #ui2-sites-box .ui2-sites-find{height:42px;font-size:16px!important}
  html.ui2 #ui2-sites-box .ui2-sites-list{max-height:270px}
}

/* ── 7. Batch 2 (2026-11-12): eight small visual fixes ── */
/* 7a. phones: the status strip no longer runs off the edge - the camera name (already shown right below) is dropped from the strip */
@media (max-width:768px){
  html.ui2 #page-live .stats .stat.s2{display:none!important}
  html.ui2 #page-live .stats .stat{flex:1 1 0!important;min-width:0!important}
}
/* 7b. phones: the last row of the Live View toolbar fills the full width (classes set by portal-ui2.js) */
@media (max-width:768px){
  html.ui2 #player-bar.ui2-grid6{grid-template-columns:repeat(6,1fr)!important}
  html.ui2 #player-bar.ui2-grid6 > *,html.ui2 #player-bar.ui2-grid6 > [role="group"] > *{grid-column:span 2}
  html.ui2 #player-bar.ui2-grid6 .ui2-span3{grid-column:span 3!important}
  html.ui2 #player-bar.ui2-grid6 .ui2-span6{grid-column:span 6!important}
}
/* 7c. phone bottom bar: line icons instead of emoji (icons set by portal-ui2.js) */
html.ui2 .mobile-bottom-nav .mbn-ico.ui2-ico{display:flex;align-items:center;justify-content:center;height:24px}
html.ui2 .mobile-bottom-nav .mbn-ico.ui2-ico svg{width:22px!important;height:22px!important;stroke:currentColor;fill:none}
/* 7d. site names stay on one line */
html.ui2 #sidebar-nav .site-nav-item .ui2-site-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* 7e. Live View: the box that only repeats the page name is hidden, so the video sits higher */
html.ui2 .content-shell:has(#page-live.active) > #page-header{display:none!important}
/* 7f. Sites header matches the other group headers */
html.ui2 #sidebar-nav .site-nav-item.sidebar-heading.ui2-sites-head{
  height:34px;padding:0 10px 0 16px!important;margin:2px 6px 0;border-radius:8px;
  font-size:13px!important;font-weight:600!important;letter-spacing:0!important;text-transform:none!important;opacity:1!important;
  color:var(--text-secondary)!important;
}
html.ui2 #sidebar-nav .site-nav-item.sidebar-heading.ui2-sites-head:hover{background:var(--surface-2);color:#fff!important}
/* 7g. top bar (staff, wide screens): drop the repeated camera name and the word beside the theme icon */
@media (min-width:769px){
  html.ui2 body.is-admin #top-site-name{display:none!important}
  html.ui2 #theme-toggle-label{display:none!important}
}
@media (max-width:768px){
  html.ui2 #sidebar-nav .site-nav-item.sidebar-heading.ui2-sites-head{height:44px;font-size:14px!important}
}

/* ── 8. Batch 3 (2026-11-12, found on the real pages) ── */
/* 8a. medium-width windows: the top bar no longer runs off the right edge (Logout / View as client stay reachable); camera name in Live View gets its own line */
@media (min-width:769px) and (max-width:1150px){
  html.ui2 #topbar-site-filter{max-width:170px!important;min-width:0!important}
  html.ui2 .cmdk-trigger span + span{display:none!important}
  html.ui2 #user-name-display{display:none!important}
  html.ui2 .nav-right .live-txt,html.ui2 .nav-right .pulse{display:none!important}
  html.ui2 .topnav,html.ui2 nav:has(#topbar-site-filter){gap:10px!important;padding-left:14px!important;padding-right:14px!important;overflow-x:auto;scrollbar-width:none}
  html.ui2 #page-live .cam-header{flex-wrap:wrap!important}
  html.ui2 #page-live .cam-header > div:first-child{flex:1 1 100%!important}
}
/* 8b. Manage Users: usernames and emails stay on one line (the table already scrolls sideways when it needs to) */
html.ui2 #page-users .table td:nth-child(2),html.ui2 #page-users .table td:nth-child(3){overflow-wrap:normal!important;word-break:normal!important;white-space:nowrap!important}
/* 8c. Sites box: more room for the site name */
html.ui2 #ui2-sites-box .site-nav-item{gap:6px!important;padding-right:8px!important}
html.ui2 #ui2-sites-box .site-nav-item[title^="View only"] > svg{display:none!important}

/* ── 9. FOR EVERYONE (not tied to the ui2 switch): five staff pages no longer spill past the window on medium widths (2026-11-12) ── */
@media (max-width:1150px){
  #page-bandwidth div,#page-analytics div,#page-branding div,#page-landing-editor div,#page-stream-servers div{max-width:100%;min-width:0;box-sizing:border-box}
  #page-bandwidth div[style*="display:flex"],#page-analytics div[style*="display:flex"],#page-branding div[style*="display:flex"],#page-landing-editor div[style*="display:flex"],#page-stream-servers div[style*="display:flex"]{flex-wrap:wrap!important}
  #page-branding div[style*="grid-template-columns:repeat(3"]{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))!important}
  #page-landing-editor div[style*="grid-template-columns"]{grid-template-columns:1fr!important}
  #page-bandwidth img,#page-analytics img,#page-branding img,#page-landing-editor img,#page-stream-servers img{max-width:100%;height:auto}
  #page-analytics select,#page-bandwidth select{max-width:100%}
  #page-stream-servers .admin-table{display:block;overflow-x:auto;max-width:100%}
}

/* ── 10. Batch 4 (2026-11-12): calmer colors, icons instead of emoji, plain status words ── */
/* 10a. calmer colors: the same hues as before, less neon. Only the shared color tokens change; nothing else is touched.
        To go back to the old colors, delete this one rule. */
html.ui2{
  --accent:#2fb9cc; --accent-hover:#55cddd; --accent-bg:rgba(47,185,204,.10); --accent-border:rgba(47,185,204,.30);
  --success:#3fbf86; --success-bg:rgba(63,191,134,.10); --success-border:rgba(63,191,134,.30);
  --warn:#e3a13c; --warn-bg:rgba(227,161,60,.10); --warn-border:rgba(227,161,60,.30);
  --danger:#e5606b; --danger-bg:rgba(229,96,107,.10); --danger-border:rgba(229,96,107,.30);
  --accent-teal:#35c3ae; --accent-green:#5fcf8f; --accent-amber:#e8c06a; --accent-red:#e87373; --border-focus:#2fb9cc;
}
/* 10b. icons that replace emoji in buttons (set by portal-ui2.js) */
html.ui2 svg.ui2-emo{width:14px!important;height:14px!important;flex-shrink:0;vertical-align:-2px;margin-right:6px;stroke:currentColor;fill:none}
/* 10c. plain status words on Live View */
html.ui2 #page-live .state-badge[data-state="live"],html.ui2 #page-live .state-badge[data-state="connecting"],html.ui2 #page-live .state-badge[data-state="reconnecting"],
html.ui2 #page-live .state-badge[data-state="stale"],html.ui2 #page-live .state-badge[data-state="error"],html.ui2 #page-live .state-badge[data-state="offline"],
html.ui2 #page-live .state-badge[data-state="paused"]{text-transform:none!important;letter-spacing:0!important}
html.ui2 #page-live .state-badge[data-state="live"] .state-text,html.ui2 #page-live .state-badge[data-state="connecting"] .state-text,html.ui2 #page-live .state-badge[data-state="reconnecting"] .state-text,
html.ui2 #page-live .state-badge[data-state="stale"] .state-text,html.ui2 #page-live .state-badge[data-state="error"] .state-text,html.ui2 #page-live .state-badge[data-state="offline"] .state-text,
html.ui2 #page-live .state-badge[data-state="paused"] .state-text{font-size:0!important}
html.ui2 #page-live .state-badge .state-text::after{font-size:12px;font-weight:600;letter-spacing:0;font-family:var(--font-ui)}
html.ui2 #page-live .state-badge[data-state="live"] .state-text::after{content:"Live"}
html.ui2 #page-live .state-badge[data-state="connecting"] .state-text::after{content:"Connecting\2026"}
html.ui2 #page-live .state-badge[data-state="reconnecting"] .state-text::after{content:"Reconnecting\2026"}
html.ui2 #page-live .state-badge[data-state="stale"] .state-text::after{content:"Video stopped, retrying\2026"}
html.ui2 #page-live .state-badge[data-state="error"] .state-text::after{content:"Cannot play the video"}
html.ui2 #page-live .state-badge[data-state="offline"] .state-text::after{content:"Camera offline"}
html.ui2 #page-live .state-badge[data-state="paused"] .state-text::after{content:"Camera paused"}
html.ui2 #live-status-val,html.ui2 #live-stat-recording-val{text-transform:lowercase;display:block}
html.ui2 #live-status-val::first-letter,html.ui2 #live-stat-recording-val::first-letter{text-transform:uppercase}


/* ── 11. batch 5 (ui2-batch5, 2026-11-12): controls beside the video, one jump bar, menu folds to icons, camera picker with search,
      client camera pictures, row "More" menu. Everything is still scoped under html.ui2. ── */

/* 11a. Wide screens: the open Move / Presets panel sits to the right of the video instead of under it. The video keeps its size. */
@media (min-width:1500px){
  html.ui2 #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open){max-width:1296px;display:grid;grid-template-columns:minmax(0,960px) minmax(0,1fr)}
  html.ui2 #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > *{grid-column:1;min-width:0}
  html.ui2 #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > .cam-header{grid-column:1 / -1;grid-row:1}
  html.ui2 #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > #player-wrap{grid-row:2}
  html.ui2 #page-live .cam-card > #panel-ptz.open,html.ui2 #page-live .cam-card > #panel-presets.open{grid-column:2;grid-row:2;contain:size;overflow-y:auto;border-top:0;border-left:1px solid var(--border-1)}
}
@media (min-width:1326px) and (max-width:1499.98px){
  html.ui2 body.sidebar-collapsed #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open){max-width:1296px;display:grid;grid-template-columns:minmax(0,960px) minmax(0,1fr)}
  html.ui2 body.sidebar-collapsed #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > *{grid-column:1;min-width:0}
  html.ui2 body.sidebar-collapsed #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > .cam-header{grid-column:1 / -1;grid-row:1}
  html.ui2 body.sidebar-collapsed #page-live .cam-card:has(> #panel-ptz.open, > #panel-presets.open) > #player-wrap{grid-row:2}
  html.ui2 body.sidebar-collapsed #page-live .cam-card > #panel-ptz.open,html.ui2 body.sidebar-collapsed #page-live .cam-card > #panel-presets.open{grid-column:2;grid-row:2;contain:size;overflow-y:auto;border-top:0;border-left:1px solid var(--border-1)}
}

/* 11b. One jump bar in the Archive row (replaces the eight step buttons; they stay in the page, hidden, and are used again if the bar is missing). */
html.ui2 #live-archive-bar.ui2-jog-on button[onclick^="liveArchiveStep"]{display:none!important}
html.ui2 #live-archive-bar.ui2-jog-on .admin-only:has(> button[onclick^="liveArchiveStep"]){display:none!important}
html.ui2 #ui2-jog{display:flex;align-items:center;gap:8px;min-width:340px;flex:1 1 340px;max-width:460px}
html.ui2 #live-archive-bar.ui2-jog-on .ui2-jog-holder{flex:0 1 410px;min-width:0}
html.ui2 #ui2-jog .ui2-jog-end{font-size:11px;color:var(--text-muted);white-space:nowrap}
html.ui2 #ui2-jog .ui2-jog-mid{position:relative;flex:1 1 auto;min-width:150px;padding-bottom:20px}
html.ui2 #ui2-jog input[type=range]{display:block;width:100%;height:22px;margin:0;accent-color:var(--accent);cursor:grab;background:transparent}
html.ui2 #ui2-jog input[type=range]:active{cursor:grabbing}
html.ui2 #ui2-jog .ui2-jog-ticks{position:absolute;left:0;right:0;bottom:0;display:flex;justify-content:space-between}
html.ui2 #ui2-jog .ui2-jog-ticks button{all:unset;box-sizing:border-box;flex:0 0 auto;min-width:26px;padding:2px 3px;text-align:center;font-size:10.5px;line-height:14px;color:var(--text-muted);border-radius:5px;cursor:pointer;font-variant-numeric:tabular-nums}
html.ui2 #ui2-jog .ui2-jog-ticks button:hover{color:var(--accent);background:var(--accent-bg)}
html.ui2 #ui2-jog .ui2-jog-ticks button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
html.ui2 #ui2-jog .ui2-jog-ticks button.ui2-jog-zero{color:transparent;pointer-events:none}
html.ui2 #ui2-jog-say{position:absolute;left:50%;top:-18px;transform:translateX(-50%);font-size:11px;font-weight:600;color:var(--accent);white-space:nowrap;pointer-events:none}
@media (max-width:767px){
  html.ui2 #live-archive-bar.ui2-jog-on .ui2-jog-holder{flex:1 1 100%}
  html.ui2 #ui2-jog{flex:1 1 0;min-width:0;max-width:none}
  html.ui2 #ui2-jog .ui2-jog-mid{padding-bottom:30px}
  html.ui2 #ui2-jog input[type=range]{height:32px}
  html.ui2 #ui2-jog .ui2-jog-ticks button{min-width:30px;padding:6px 2px;font-size:11px}
}

/* 11c. Folded menu = a narrow strip of icons (desktop / tablet only). Resting the mouse on it, or tabbing into it, opens the full menu over the page. */
@media (min-width:768px){
  html.ui2 body.sidebar-collapsed #sidebar-expand-tab{display:none!important}
  html.ui2 body.sidebar-collapsed #quick-nav-bar{display:none!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav{display:flex!important;width:56px!important;min-width:56px!important;flex:0 0 56px!important;padding:46px 0 14px!important;overflow-x:hidden!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) > :not(.nav-item):not(#admin-nav):not(#sidebar-collapse-btn){display:none!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) #admin-nav > :not(.nav-item){display:none!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) .nav-item{font-size:0!important;gap:0!important;justify-content:center!important;padding:9px 0!important;margin:1px 8px!important;min-height:36px}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) .nav-item > :not(svg){display:none!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) .nav-item.navsec-collapsed-item:has(> .navpin-btn.pinned){display:flex!important}   /* pinned pages always stay on the strip */
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) .nav-item > svg{width:18px!important;height:18px!important;margin:0!important}
  html.ui2 body.sidebar-collapsed #sidebar-nav:not(.ui2-peek) .nav-item.ui2-noicon::before{content:attr(data-ui2-initial);font-size:11px;font-weight:700}
  html.ui2 body.sidebar-collapsed #sidebar-nav.ui2-peek{width:230px!important;min-width:230px!important;flex:0 0 230px!important;margin-right:-174px;z-index:70;padding:46px 10px 18px!important;box-shadow:10px 0 30px rgba(0,0,0,.45)}
  html.ui2 body.sidebar-collapsed #sidebar-collapse-btn{right:auto!important;left:15px!important;transform:scaleX(-1)}
}

/* 11d. Camera picker with search (used when a camera list has more than 8 entries; the original list stays in the page as the source). */
html.ui2 select.ui2-pick-src{position:absolute!important;width:1px!important;height:1px!important;min-width:0!important;padding:0!important;border:0!important;opacity:0!important;pointer-events:none!important;overflow:hidden!important}
html.ui2 .ui2-pick-btn{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;min-width:200px;max-width:340px;height:36px;padding:0 10px 0 12px;font:inherit;font-size:13px;color:var(--text-primary,#e6edf3);background:var(--surface-1,#101722);border:1px solid var(--border-1,rgba(255,255,255,.12));border-radius:8px;cursor:pointer;text-align:left}
html.ui2 .ui2-pick-btn:hover{border-color:var(--accent-border)}
html.ui2 .ui2-pick-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
html.ui2 .ui2-pick-btn .ui2-pick-txt{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html.ui2 .ui2-pick-btn .ui2-pick-chev{flex:0 0 auto;width:10px;height:10px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-3px);opacity:.6}
html.ui2 #ui2-pick-pop{position:fixed;z-index:10050;display:none;flex-direction:column;box-sizing:border-box;width:340px;max-width:calc(100vw - 16px);max-height:min(440px,calc(100vh - 24px));background:var(--surface-1,#101722);color:var(--text-primary,#e6edf3);border:1px solid var(--border-1,rgba(255,255,255,.14));border-radius:10px;box-shadow:0 18px 50px rgba(0,0,0,.55);overflow:hidden}
html.ui2 #ui2-pick-pop.open{display:flex}
html.ui2 #ui2-pick-pop input{box-sizing:border-box;margin:8px;height:36px;padding:0 10px;font:inherit;font-size:14px;color:inherit;background:var(--surface-0,#0b1016);border:1px solid var(--border-1,rgba(255,255,255,.14));border-radius:7px;outline:0}
html.ui2 #ui2-pick-pop input:focus{border-color:var(--accent)}
html.ui2 #ui2-pick-pop ul{list-style:none;margin:0;padding:0 6px 6px;overflow-y:auto;flex:1 1 auto}
html.ui2 #ui2-pick-pop li{display:flex;flex-direction:column;gap:1px;padding:7px 10px;border-radius:7px;cursor:pointer;font-size:13px;line-height:1.3}
html.ui2 #ui2-pick-pop li small{font-size:11px;color:var(--text-muted)}
html.ui2 #ui2-pick-pop li.act{background:var(--accent-bg)}
html.ui2 #ui2-pick-pop li[aria-selected="true"]{color:var(--accent);font-weight:600}
html.ui2 #ui2-pick-pop .ui2-pick-none{padding:14px 12px;font-size:13px;color:var(--text-muted)}
html.ui2 #ui2-pick-pop .ui2-pick-count{padding:0 12px 6px;font-size:11px;color:var(--text-muted)}
@media (max-width:767px){
  html.ui2 .ui2-pick-btn{min-width:0;max-width:100%;height:40px}
  html.ui2 #ui2-pick-pop li{padding:11px 10px;font-size:14px}
  html.ui2 #ui2-pick-pop input{height:42px;font-size:16px}
}

/* 11e. Client accounts with 2 to 8 cameras: the cameras as pictures under the video. */
html.ui2 #ui2-cam-strip{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;max-width:960px;margin:12px 0 4px}
html.ui2 #ui2-cam-strip button{all:unset;box-sizing:border-box;display:block;cursor:pointer;border:1px solid var(--border-1,rgba(255,255,255,.12));border-radius:10px;overflow:hidden;background:var(--surface-1,#101722)}
html.ui2 #ui2-cam-strip button:hover{border-color:var(--accent-border)}
html.ui2 #ui2-cam-strip button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
html.ui2 #ui2-cam-strip button[aria-current="true"]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
html.ui2 #ui2-cam-strip .ui2-cs-pic{display:block;position:relative;aspect-ratio:16/9;background:#0b1016}
html.ui2 #ui2-cam-strip .ui2-cs-pic img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
html.ui2 #ui2-cam-strip .ui2-cs-pic.noimg::after{content:"No picture yet";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--text-muted)}
html.ui2 #ui2-cam-strip .ui2-cs-name{display:block;padding:7px 9px 8px;font-size:12.5px;font-weight:600;line-height:1.25;color:var(--text-primary,#e6edf3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html.ui2 #ui2-cam-strip button[aria-current="true"] .ui2-cs-name{color:var(--accent)}
@media (max-width:767px){ html.ui2 #ui2-cam-strip{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0} }

/* 11f. Manage Cameras / Manage Users: the less-used row buttons sit in one "More" menu. */
html.ui2 .ui2-more{display:inline-block;position:relative;vertical-align:middle;margin-left:4px}
html.ui2 .ui2-more-btn{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 9px;font:inherit;font-size:11px;font-weight:600;color:var(--text-secondary,#b6c2cf);background:transparent;border:1px solid var(--border-1,rgba(255,255,255,.16));border-radius:6px;cursor:pointer;white-space:nowrap}
html.ui2 .ui2-more-btn:hover,html.ui2 .ui2-more-btn[aria-expanded="true"]{color:var(--accent);border-color:var(--accent-border)}
html.ui2 .ui2-more-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
html.ui2 .ui2-more-btn::after{content:"";width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg) translateY(-2px)}
html.ui2 .ui2-more-menu{position:fixed;z-index:10040;display:none;flex-direction:column;gap:2px;box-sizing:border-box;min-width:190px;max-width:280px;padding:6px;background:var(--surface-1,#101722);border:1px solid var(--border-1,rgba(255,255,255,.14));border-radius:10px;box-shadow:0 16px 44px rgba(0,0,0,.55);white-space:normal}
html.ui2 .ui2-more-menu.open{display:flex}
html.ui2 .ui2-more-menu > button{display:flex!important;align-items:center;justify-content:flex-start!important;gap:8px;box-sizing:border-box;width:100%!important;min-height:32px;margin:0!important;padding:6px 10px!important;font-size:12.5px!important;font-weight:500!important;text-align:left;white-space:nowrap;color:var(--text-primary,#e6edf3)!important;background:transparent!important;border:0!important;border-radius:6px!important;cursor:pointer}
html.ui2 .ui2-more-menu > button:hover{background:var(--accent-bg)!important}
html.ui2 .ui2-more-menu > button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
html.ui2 .ui2-more-menu > button.ui2-more-danger{color:var(--danger)!important}
html.ui2 .ui2-more-menu > button.ui2-more-danger:hover{background:rgba(229,96,107,.12)!important}
html.ui2 .ui2-more-menu > .ui2-more-sep{height:1px;margin:4px 6px;background:var(--border-1,rgba(255,255,255,.12))}
html.ui2 select.ui2-more-src{display:none!important}
html.ui2 .ui2-more-empty{display:none!important}
@media (max-width:767px){ html.ui2 .ui2-more-menu > button{min-height:42px;font-size:14px!important} html.ui2 .ui2-more-btn{height:34px;font-size:12.5px} }

/* 12. batch 6 (ui2-batch6): tighter Manage Cameras rows + Users table fits the page */
@media (min-width:769px){
  /* cameras: retention on one line, date on one line, site subtitle (repeats the Site column) hidden */
  html.ui2 body #page-cameras #cameras-table tr>td{padding-top:8px!important;padding-bottom:8px!important}
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(6),
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(6) label,
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(7){white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important}
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(6)>div{display:inline-flex!important;vertical-align:middle!important;margin-bottom:0!important;width:auto!important}
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(6)>div:first-child{margin-right:8px!important}
  html.ui2 body #page-cameras #cameras-table tr>td:nth-child(6) label{flex-shrink:0}
  html.ui2 body #page-cameras #cameras-table tr>td:first-child>div[style*="margin-top:2px"]{display:none!important}
  /* users: narrower gutters, Sites wraps, name and actions stay on one line */
  html.ui2 body #page-users #users-table tr>td{padding:8px 6px!important}
  html.ui2 body #page-users #users-table tr>td:first-child{padding-left:12px!important;white-space:nowrap!important}
  html.ui2 body #page-users #users-table tr>td:nth-child(5),
  html.ui2 body #page-users #users-table tr>td:nth-child(5) *{white-space:normal!important;overflow-wrap:anywhere!important}
  html.ui2 body #page-users #users-table tr>td:nth-child(5){min-width:80px}
  html.ui2 body #page-users #users-table tr>td:nth-child(8){white-space:nowrap!important}
  html.ui2 body #page-users table:has(>#users-table) th{padding-left:6px!important;padding-right:6px!important}
  html.ui2 body #page-users table:has(>#users-table) th:first-child{padding-left:12px!important}
}

/* 13. batch 7 (ui2-batch7): Manage Users on phones - fits the screen, per-user settings stay closed until opened */
@media (max-width:768px){
  html.ui2 body #page-users table:has(>#users-table){min-width:0!important;width:100%!important}
  html.ui2 body #page-users #users-table tr.admin-settings-tr.collapsed{display:none!important}
  html.ui2 body #page-users #users-table tr>td{max-width:100%!important;box-sizing:border-box}
}

/* 14. batch 8 (ui2-batch8): phone - field labels on user cards, wider jump-bar steps */
@media (max-width:768px){
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(-n+7){display:flex!important;align-items:center;flex-wrap:wrap;gap:4px 8px;padding:5px 12px!important;min-height:0!important}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(-n+7)::before{flex:0 0 78px;font:600 10px/1.4 var(--font-ui,sans-serif);letter-spacing:.06em;text-transform:uppercase;color:var(--text-secondary)}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:first-child{padding-top:12px!important}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(8){padding:8px 12px 12px!important}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(1)::before{content:"Name"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(2)::before{content:"Username"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(3)::before{content:"Email"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(4)::before{content:"Role"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(5)::before{content:"Sites"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(6)::before{content:"Brand"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(7)::before{content:"Access"}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(6){flex-wrap:nowrap!important}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(6)>div{flex:1 1 0;min-width:0}
  html.ui2 body #page-users #users-table tr:not(.admin-settings-tr)>td:nth-child(6) select{min-width:0!important;width:100%!important;max-width:100%!important}
  html.ui2 #ui2-jog .ui2-jog-end{display:none}
  html.ui2 #ui2-jog .ui2-jog-mid{padding-bottom:46px}
  html.ui2 #ui2-jog .ui2-jog-ticks{justify-content:stretch}
  html.ui2 #ui2-jog .ui2-jog-ticks button{flex:1 1 0;min-width:0;height:44px;padding:0 1px;font-size:12px;display:flex;align-items:center;justify-content:center}
  html.ui2 #ui2-jog .ui2-jog-ticks button:first-child::before{content:"\25C2\00A0"}
  html.ui2 #ui2-jog .ui2-jog-ticks button:last-child::after{content:"\00A0\25B8"}
}

/* 15. batch 8b: phone - archive status line gets its own row instead of a one-letter-wide column */
@media (max-width:768px){
  html.ui2 #live-archive-bar>div[style*="justify-content:flex-end"]{flex:1 1 100%!important;flex-wrap:wrap!important;justify-content:flex-start!important;min-width:0}
  html.ui2 #live-archive-bar>div[style*="justify-content:flex-end"]>*{flex-shrink:0;max-width:100%;overflow-wrap:normal!important;word-break:normal!important}
}

/* 16. batch 9: phone - client camera pictures get a side gutter (they ran edge to edge and clipped the names) */
@media (max-width:768px){
  html.ui2 #ui2-cam-strip{padding:0 12px;box-sizing:border-box}
}

/* 17. batch 10: clients - no Debug button; on phones the toolbar wraps into rows of three instead of a hidden swipe row */
html.ui2 body.is-client #btn-debug{display:none!important}
@media (max-width:768px){
  html.ui2 body.is-client #page-live #player-bar{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;overflow:visible!important;gap:8px!important}
  html.ui2 body.is-client #page-live #player-bar>[role="group"]{display:contents!important}
  html.ui2 body.is-client #page-live #player-bar>:not(button):not([role="group"]){display:none!important}
  html.ui2 body.is-client #page-live #player-bar .btn{width:100%!important;min-width:0!important;min-height:44px!important;justify-content:center!important;margin:0!important}
  html.ui2 body.is-client #page-live #player-bar [role="group"]::before{display:none!important}
  html.ui2 body.is-client #player-bar:not(.ui2-grid6) .btn{grid-column:span 2}
}
