:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  color: #e9f2f5;
  background: #080d11;
  letter-spacing: 0;
  --bg: #080d11;
  --panel: #0e161c;
  --panel-2: #121e25;
  --line: #263741;
  --muted: #8296a1;
  --cyan: #2bc9df;
  --green: #2cca8b;
  --amber: #eead4e;
  --red: #f35f6c;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1080px; overflow: hidden; background: var(--bg); }
button, input, a { font: inherit; letter-spacing: 0; }
button, a { color: inherit; }

.topbar { height: 52px; display: grid; grid-template-columns: 210px 1fr 190px; align-items: center; border-bottom: 1px solid var(--line); background: #0b1217; }
.brand { padding-left: 16px; }
.brand b { display: block; color: var(--cyan); font-size: 17px; }
.brand span { display: block; color: var(--muted); font-size: 10px; }
.workspaces { align-self: stretch; display: flex; align-items: stretch; }
.workspaces button, .workspaces a { min-width: 94px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-left: 1px solid #1d2b33; background: transparent; color: #9db0b9; font-size: 12px; font-weight: 650; text-decoration: none; cursor: pointer; }
.workspaces button.active, .workspaces button:hover, .workspaces a:hover { color: #061318; background: var(--cyan); }
.system-state { padding-right: 16px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; color: #a4b5bd; font-size: 11px; }
.system-state i, .camera-status { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #647781; }
.system-state.online i, .camera-status.online { background: var(--green); }
.system-state.offline i { background: var(--red); }

.vms-shell { height: calc(100vh - 52px); display: grid; grid-template-columns: 230px minmax(0, 1fr) 276px; }
.resource-panel, .context-panel { min-width: 0; background: var(--panel); }
.resource-panel { border-right: 1px solid var(--line); }
.context-panel { border-left: 1px solid var(--line); }
.panel-section { border-bottom: 1px solid var(--line); }
.section-title, .context-heading { min-height: 40px; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title b, .context-heading b { font-size: 12px; }
.section-title button, .context-heading button, .icon-button { width: 30px; height: 30px; min-height: 0; padding: 0; border: 1px solid #344a56; border-radius: 3px; background: #15252e; cursor: pointer; }
.saved-layout { width: calc(100% - 16px); min-height: 40px; margin: 0 8px 8px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 1px solid #2c414c; border-radius: 3px; background: #101c23; color: #dce8ec; cursor: pointer; }
.saved-layout.active { border-color: #308498; background: #12313c; }
.saved-layout small { color: var(--muted); }
.cameras-section { height: calc(100% - 89px); }
.filter-row { padding: 0 8px 8px; }
.filter-row input { width: 100%; height: 32px; padding: 0 9px; border: 1px solid #2d414c; border-radius: 3px; outline: 0; color: #e6f0f3; background: #091116; font-size: 11px; }
.filter-row input:focus { border-color: var(--cyan); }
.camera-tree { height: calc(100% - 80px); overflow-y: auto; }
.site-group h2 { height: 30px; margin: 0; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; color: #90a5af; background: #0a1217; font-size: 10px; }
.site-group h2 small { color: #637983; }
.camera-resource { width: 100%; min-height: 48px; padding: 6px 9px; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 0; border-bottom: 1px solid #1d2d35; background: transparent; text-align: left; cursor: pointer; }
.camera-resource:hover, .camera-resource.selected { background: #12303a; }
.camera-resource span { min-width: 0; }
.camera-resource b, .camera-resource small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-resource b { font-size: 11px; }
.camera-resource small { margin-top: 3px; color: #778d98; font-size: 9px; }
.camera-resource em { color: #6f8994; font-size: 9px; font-style: normal; }
.panel-empty { padding: 22px 12px; color: var(--muted); font-size: 11px; text-align: center; }

.monitor-area { min-width: 0; display: grid; grid-template-rows: 46px minmax(0, 1fr) 54px; background: #060a0d; }
.monitor-toolbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #10191f; }
.layout-switcher { display: flex; }
.layout-switcher button { width: 34px; height: 28px; border: 1px solid #344853; border-right: 0; color: #9eb0b8; background: #131f26; cursor: pointer; }
.layout-switcher button:first-child { border-radius: 3px 0 0 3px; }
.layout-switcher button:last-child { border-right: 1px solid #344853; border-radius: 0 3px 3px 0; }
.layout-switcher button.active { color: #061318; background: var(--cyan); }
.toolbar-status { color: var(--muted); font-size: 10px; }
.toolbar-actions { display: flex; gap: 5px; }
.toolbar-actions button { min-height: 30px; padding: 0 11px; border: 1px solid #344953; border-radius: 3px; color: #c9d7dc; background: #14232b; font-size: 10px; cursor: pointer; }
.toolbar-actions .icon-button { width: 30px; padding: 0; font-size: 16px; }
.workspace-view { min-height: 0; display: none; }
.workspace-view.active { display: block; }

.video-grid { width: 100%; height: 100%; padding: 3px; display: grid; gap: 3px; }
.video-grid.layout-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.video-grid.layout-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.video-grid.layout-16 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); }
.video-tile { min-width: 0; min-height: 0; display: grid; grid-template-rows: 26px minmax(0, 1fr) 23px; overflow: hidden; outline: 1px solid #263740; background: #030608; }
.video-tile.selected { outline: 2px solid var(--cyan); }
.video-tile.drop-target { outline: 2px solid var(--amber); }
.video-tile header, .video-tile footer { min-width: 0; padding: 0 7px; display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #93a8b2; background: #111b20; font-size: 9px; }
.video-tile header span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-tile header i { margin-right: 5px; }
.video-tile header b { color: var(--green); font-size: 8px; }
.video-tile footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-tile footer button { width: 22px; height: 20px; padding: 0; border: 0; color: #8fa4ae; background: transparent; cursor: pointer; }
.tile-stage { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.tile-stage iframe { width: 100%; height: 100%; border: 0; background: #000; }
.tile-start { min-height: 30px; padding: 0 12px; border: 1px solid #2d4652; border-radius: 3px; color: #91a9b4; background: #0c171d; font-size: 10px; cursor: pointer; }
.tile-start span { color: var(--cyan); }
.video-tile.empty { display: flex; align-items: center; justify-content: center; outline-style: dashed; background: #070d11; }
.tile-placeholder { display: grid; justify-items: center; gap: 7px; color: #566b75; font-size: 9px; }
.tile-placeholder b { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #283b44; border-radius: 50%; }

.timeline { display: grid; grid-template-columns: 42px 46px minmax(0, 1fr) 46px 30px; align-items: center; gap: 8px; padding: 0 10px; border-top: 1px solid var(--line); background: #10191f; color: #7f949e; font-size: 9px; }
.timeline button { height: 28px; min-height: 0; border: 1px solid #344a55; border-radius: 3px; background: #14242c; cursor: pointer; }
.timeline-live { padding: 0; color: var(--green); font-size: 9px; font-weight: 700; }
.timeline-track { position: relative; height: 18px; }
.timeline-track > i { position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: #31454e; }
.timeline-track > b { position: absolute; right: 0; top: 4px; width: 2px; height: 10px; background: var(--cyan); }
.timeline-track em i { position: absolute; top: 5px; width: 3px; height: 8px; background: var(--amber); }

.context-tabs { height: 40px; display: flex; border-bottom: 1px solid var(--line); }
.context-tabs button { flex: 1; border: 0; border-right: 1px solid #1d3039; color: #8297a1; background: #0c151a; font-size: 10px; cursor: pointer; }
.context-tabs button.active { color: #061318; background: var(--cyan); }
.context-view { height: calc(100% - 40px); display: none; overflow-y: auto; }
.context-view.active { display: block; }
.context-heading { border-bottom: 1px solid var(--line); }
.context-heading span { color: var(--muted); font-size: 10px; }
.context-heading button { width: auto; padding: 0 8px; color: #a9bbc3; font-size: 9px; }
.context-heading button.active { color: #061318; background: var(--cyan); }
.alert-row { width: 100%; min-height: 54px; padding: 7px 10px; display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 8px; border: 0; border-bottom: 1px solid #1e2e36; background: transparent; text-align: left; cursor: pointer; }
.alert-row:hover { background: #142932; }
.alert-row > i { height: 100%; background: var(--amber); }
.alert-row .event-roi_intrusion, .alert-row .event-device_health { background: var(--red); }
.alert-row .event-people_count, .alert-row .event-occupancy { background: var(--cyan); }
.alert-row b, .alert-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row b { font-size: 10px; }
.alert-row small { margin-top: 5px; color: #778d98; font-size: 8px; }

.site-map { position: relative; overflow: hidden; border: 1px solid #344953; background: #0b151a; }
.mini-map { height: 300px; margin: 10px; }
.map-room { position: absolute; display: grid; place-items: center; border: 1px solid #273b44; color: #435a65; background: #111f25; font-size: 8px; }
.room-entry { left: 4%; top: 57%; width: 28%; height: 38%; }
.room-hall { left: 32%; top: 8%; width: 42%; height: 87%; }
.room-office { left: 74%; top: 8%; width: 22%; height: 43%; }
.room-store { left: 74%; top: 51%; width: 22%; height: 44%; }
.map-pins { position: absolute; inset: 0; }
.map-pin { position: absolute; z-index: 2; width: 24px; height: 24px; padding: 0; transform: translate(-50%, -50%); border: 2px solid #526a75; border-radius: 50%; color: #dce9ed; background: #1c2b32; cursor: pointer; touch-action: none; }
.map-pin.online { border-color: var(--green); }
.map-pin.selected { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(43,201,223,.18); }
.map-pin span { font-size: 8px; }
.map-pin b { position: absolute; left: 28px; top: 4px; width: 86px; overflow: hidden; color: #a5b8c0; font-size: 8px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.map-help { padding: 0 11px 12px; color: #718791; font-size: 9px; line-height: 1.5; }

.camera-detail { margin: 0; }
.camera-detail div { min-height: 48px; padding: 8px 11px; border-bottom: 1px solid #1e3038; }
.camera-detail dt { color: #728893; font-size: 8px; }
.camera-detail dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 10px; }
.online-text { color: var(--green) !important; }
.camera-actions { padding: 10px; }
.camera-actions button { width: 100%; min-height: 34px; border: 1px solid #35505c; border-radius: 3px; background: #142630; font-size: 10px; cursor: pointer; }
.camera-actions button:disabled { opacity: .4; cursor: default; }
.feature-control-vms { padding: 11px; border-top: 1px solid #1e3038; border-bottom: 1px solid #1e3038; }
.feature-control-vms > span { display: block; color: var(--cyan); font-size: 8px; font-weight: 800; }
.feature-control-vms > b { display: block; min-height: 30px; margin: 6px 0 9px; color: #c4d6dc; font-size: 10px; line-height: 1.4; }
.feature-control-vms label { display: block; margin-bottom: 5px; color: #718792; font-size: 8px; }
.feature-control-vms select { width: 100%; min-height: 32px; border: 1px solid #35505c; background: #0c181e; padding: 0 7px; color: #e3f0f3; font-size: 10px; }
.feature-control-vms > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.feature-control-vms button { min-height: 31px; border: 1px solid #35505c; background: #142630; color: #e4f4f7; font-size: 9px; font-weight: 800; cursor: pointer; }
.feature-control-vms button:last-child { border-color: #187e92; background: #116174; }
.feature-control-vms button:disabled, .feature-control-vms select:disabled { opacity: .4; cursor: default; }
.feature-control-vms small { display: block; margin-top: 8px; color: #6e858f; font-size: 8px; line-height: 1.45; }

.map-workspace-grid { height: 100%; padding: 8px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .7fr); gap: 8px; }
.large-map { min-height: 0; }
.map-caption { position: absolute; left: 14px; bottom: 12px; color: #70858e; font-size: 10px; }
.map-preview { min-width: 0; display: grid; grid-template-rows: 52px minmax(0, 1fr); border: 1px solid #344953; background: #070d10; }
.preview-heading { padding: 10px 12px; border-bottom: 1px solid #283a43; }
.preview-heading span, .preview-heading b { display: block; }
.preview-heading span { color: var(--cyan); font-size: 8px; }
.preview-heading b { margin-top: 5px; font-size: 12px; }
.preview-stage { min-height: 0; display: grid; place-items: center; padding: 12px; color: var(--muted); font-size: 10px; text-align: center; }
.preview-stage iframe { width: 100%; height: 100%; border: 0; background: #000; }

.events-heading { min-height: 70px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.events-heading span { color: var(--cyan); font-size: 8px; }
.events-heading h1 { margin: 4px 0 0; font-size: 17px; }
.events-heading > b { color: var(--muted); font-size: 10px; }
.event-table { height: calc(100% - 70px); overflow-y: auto; }
.event-item { min-height: 86px; display: grid; grid-template-columns: 130px minmax(0, 1fr) 90px; align-items: center; border-bottom: 1px solid #203039; cursor: pointer; }
.event-item:hover { background: #111e24; }
.event-image { align-self: stretch; display: grid; place-items: center; overflow: hidden; color: #526973; background: #020608; font-size: 8px; }
.event-image img { width: 100%; height: 100%; object-fit: cover; }
.event-item > div:nth-child(2) { padding: 10px 14px; }
.event-item b { font-size: 11px; }
.event-item p { margin: 5px 0; color: #99adb6; font-size: 10px; }
.event-item small { color: #6f858f; font-size: 8px; }
.event-item em { color: #728892; font-size: 8px; font-style: normal; }
.workspace-empty { padding: 50px; color: var(--muted); font-size: 11px; text-align: center; }

.toast { position: fixed; right: 16px; bottom: 64px; z-index: 20; max-width: 420px; padding: 11px 14px; border: 1px solid #367387; border-radius: 3px; color: #e5f5f8; background: #11313d; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .16s ease; font-size: 10px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #9a4650; background: #3a1c22; }

@media (max-width: 1250px) {
  .vms-shell { grid-template-columns: 200px minmax(0, 1fr) 240px; }
  .video-grid.layout-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-workspace-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
/* Viewer-provisioned temporary portal login. */
#ccamPortalLogin { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 24px; background: rgba(4, 13, 19, .94); }
#ccamPortalLogin form { width: min(100%, 380px); display: grid; gap: 14px; padding: 30px; border: 1px solid #285166; border-radius: 8px; background: #0d202b; box-shadow: 0 18px 60px #0008; }
#ccamPortalLogin span { color: #27c7e4; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; }
#ccamPortalLogin h1 { margin: 0; font-size: 25px; color: #f1f8fb; }
#ccamPortalLogin p { margin: 0; color: #9eb3c1; line-height: 1.55; }
#ccamPortalLogin label { display: grid; gap: 7px; color: #bdd0dc; font-size: 14px; }
#ccamPortalLogin input { height: 42px; box-sizing: border-box; border: 1px solid #31586b; border-radius: 4px; background: #08151d; color: #f4fbff; padding: 0 11px; font: inherit; }
#ccamPortalLogin small { min-height: 18px; color: #ff8d98; }
#ccamPortalLogin button { height: 44px; border: 0; border-radius: 4px; background: #24b9d4; color: #04232b; font-weight: 800; font-size: 15px; cursor: pointer; }
