@import url('cctv-data.css');
/* 3D twin + CCTV (prefixes: tw-, cam-, net-, wall-, clip-) */

/* ── shared */
.dot.live { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: tw-pulse 1.8s infinite; display: inline-block; }
@keyframes tw-pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }
.select.sm { height: 32px; padding: 0 8px; font-size: var(--fs-sm); }

/* ── twin */
.tw-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tw-views { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tw-views .btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tw-views select { max-width: 240px; }
.tw-overlays { flex-wrap: wrap; }
.tw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: stretch; }
.tw-stage { position: relative; height: calc(100vh - var(--topbar-h) - 190px); min-height: 420px; border-radius: var(--radius); overflow: hidden; background: #0d1512; border: 1px solid var(--border); box-shadow: var(--shadow-2); touch-action: none; }
.tw-canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; touch-action: none; }
.tw-canvas:active { cursor: grabbing; }
.tw-hud { position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; max-width: calc(100% - 24px); }
.tw-hud-counters { display: contents; }
.tw-hud-card { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(10, 18, 15, 0.72); color: #e8f0ec; font-size: 12px; border: 1px solid rgba(255, 255, 255, 0.08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap; }
.tw-hud-card .sep { width: 1px; height: 12px; background: rgba(255, 255, 255, 0.2); }
.tw-hud-card.warn { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.tw-hud-card.muted { opacity: 0.8; }
.tw-hud-card .subtle { color: #a7b6b0; font-size: 11.5px; }
.tw-tags { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; display: block; }
.tw-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap-reverse; gap: 8px; align-items: flex-end; justify-content: space-between; pointer-events: none; }
.tw-legend { display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-radius: 10px; background: rgba(10, 18, 15, 0.74); color: #d5e1dc; font-size: 11.5px; pointer-events: none; max-width: calc(100% - 24px); border: 1px solid rgba(255, 255, 255, 0.07); }
.tw-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tw-legend svg { opacity: 0.85; }
.tw-ring { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2.5px solid #94a3b8; box-sizing: border-box; flex: none; }
.tw-ring.dashed { border-style: dashed; border-width: 2px; }
.tw-legend-note { color: #a7b6b0; }
/* HUD strip: live tracking figures */
.tw-strip { display: flex; margin-left: auto; gap: 0; border-radius: 12px; background: rgba(8, 14, 12, 0.8); border: 1px solid rgba(255, 255, 255, 0.09); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #e8f0ec; pointer-events: none; overflow: hidden; max-width: calc(100% - 24px); }
.tw-stat { display: flex; flex-direction: column; gap: 1px; padding: 6px 12px 7px; border-left: 1px solid rgba(255, 255, 255, 0.08); min-width: 58px; }
.tw-stat:first-child { border-left: 0; }
.tw-stat span { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: #94a69f; white-space: nowrap; }
.tw-stat b { font-size: 15px; font-weight: 650; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tw-stat.in b { color: #6ee7b7; }
.tw-stat.out b { color: #67e8f9; }
.tw-stat.warn b { color: #fca5a5; }
.tw-strip.off .tw-stat:first-child b { color: #94a69f; }
/* follow banner */
.tw-follow { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 999px; background: rgba(6, 24, 20, 0.9); border: 1px solid rgba(34, 211, 238, 0.55); color: #e8f0ec; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); max-width: calc(100% - 24px); }
.tw-follow[hidden] { display: none; }
.tw-follow .subtle { color: #a7b6b0; overflow: hidden; text-overflow: ellipsis; }
.tw-follow .btn { color: #e8f0ec; height: 26px; border-radius: 999px; }
.tw-stage.following { border-color: rgba(34, 211, 238, 0.55); }
/* live tracks list */
.tw-tracks-h, .tw-track { display: grid; grid-template-columns: minmax(0, 1fr) 84px 46px 30px; gap: 8px; align-items: center; }
.tw-tracks-h { padding: 0 10px 2px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.tw-tracks-h span:nth-child(n + 3), .tw-track > span:nth-child(n + 3) { text-align: right; }
.tw-tracks { display: flex; flex-direction: column; gap: 3px; }
.tw-track { width: 100%; text-align: left; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 12px; min-height: 40px; }
.tw-track:hover { border-color: var(--brand); background: var(--surface-2); }
.tw-track.active { border-color: #22d3ee; box-shadow: inset 0 0 0 1px #22d3ee; background: var(--surface-2); }
.tw-track.coast { opacity: 0.66; }
.tw-track.coast .tw-ring { border-style: dashed; }
.tw-tr-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tw-tr-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.tw-tr-id b { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }
.tw-tr-name { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-tr-zone { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-track .num { font-variant-numeric: tabular-nums; font-size: 11.5px; }
.tw-tracks-empty { padding: 14px 6px; text-align: center; }
.tw-tracks-empty[hidden] { display: none; }
.tw-hint { font-size: 11.5px; padding: 4px 2px; }
.tw-walkpad { position: absolute; right: 14px; bottom: 116px; display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 6px; }
.tw-walkpad[hidden] { display: none; }
.tw-pad-btn { width: 44px; height: 44px; border-radius: 12px; background: rgba(10, 18, 15, 0.75); color: #fff; border: 1px solid rgba(255, 255, 255, 0.15); touch-action: none; }
.tw-walkpad [data-k='f'] { grid-column: 2; grid-row: 1; }
.tw-walkpad [data-k='l'] { grid-column: 1; grid-row: 2; }
.tw-walkpad [data-k='b'] { grid-column: 2; grid-row: 2; }
.tw-walkpad [data-k='r'] { grid-column: 3; grid-row: 2; }
.tw-panel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); min-height: 0; max-height: calc(100vh - var(--topbar-h) - 190px); overflow: hidden; }
.tw-grip { display: none; border: 0; padding: 0; cursor: pointer; }
.tw-panel-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tw-panel-h h3 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-panel-b { padding: 12px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.tw-hint .empty { padding: 18px 6px; }
.tw-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.tw-shelf-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tw-shelf-sum > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.tw-shelf-sum b { font-size: 18px; color: var(--text); }
.tw-cats { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tw-sku-list { display: flex; flex-direction: column; gap: 4px; }
.tw-sku { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.tw-sku:hover { border-color: var(--brand); background: var(--surface-2); }
.tw-sku-main { display: flex; flex-direction: column; min-width: 0; }
.tw-sku-main b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-sku-main .subtle { font-size: 11.5px; }
.tw-sku-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; flex: none; }
.tw-panel .cam-tile { width: 100%; }
.tw-mini-canvas { display: block; width: 100%; height: 100%; }

@media (max-width: 1100px) {
  .tw-layout { grid-template-columns: minmax(0, 1fr); }
  .tw-stage { height: min(68vh, 640px); min-height: 360px; }
  .tw-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 62vh; border-radius: 18px 18px 0 0; transform: translateY(calc(100% - 52px)); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-3); }
  .tw-layout.panel-open .tw-panel { transform: none; }
  .tw-grip { display: block; width: 100%; height: 20px; background: transparent; flex: none; position: relative; }
  .tw-grip::after { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--border-strong); }
  .tw-panel-h { padding-top: 4px; }
  .tw-layout { padding-bottom: 56px; }
}
@media (max-width: 600px) {
  .tw-stage { height: calc(100dvh - 410px); min-height: 330px; max-height: 62vh; border-radius: 12px; }
  .tw-toolbar { gap: 8px; margin-bottom: 8px; }
  .tw-overlays { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding-bottom: 2px; }
  .tw-overlays::-webkit-scrollbar { display: none; }
  .tw-overlays .chip { flex: none; }
  .tw-hud-counters .tw-hud-card:not(.warn) { display: none; }
  .tw-hud-card { font-size: 11px; padding: 4px 8px; }
  .tw-bottom { left: 8px; right: 8px; bottom: 8px; gap: 6px; }
  .tw-legend { font-size: 10px; gap: 4px 8px; padding: 5px 8px; max-width: 100%; }
  .tw-legend-note { display: none !important; }
  .tw-strip { width: 100%; max-width: none; margin-left: 0; overflow-x: auto; pointer-events: auto; scrollbar-width: none; }
  .tw-strip::-webkit-scrollbar { display: none; }
  .tw-stat { padding: 5px 9px 6px; min-width: 52px; flex: 1 0 auto; }
  .tw-stat b { font-size: 13.5px; }
  .tw-hud { left: 8px; top: 8px; gap: 4px; max-width: calc(100% - 16px); }
  .tw-follow { top: auto; bottom: 112px; font-size: 11px; }
  .tw-follow .subtle { display: none; }
  .tw-walkpad { bottom: 112px; }
  .tw-tracks-h, .tw-track { grid-template-columns: minmax(0, 1fr) 76px 44px 28px; }
  .tw-views select { max-width: 160px; }
  .tw-shelf-sum { grid-template-columns: repeat(2, 1fr); }
}

/* ── camera tile */
.cam-tile { position: relative; aspect-ratio: 16 / 9; background: #05070a; border-radius: 10px; overflow: hidden; width: 100%; }
.cam-tile.clickable { cursor: pointer; }
.cam-tile.clickable:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.cam-video, .cam-ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cam-ov { pointer-events: none; }
.cam-status { position: absolute; right: 8px; bottom: 8px; }
.cam-caption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; align-items: baseline; padding: 14px 8px 5px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #e5e7eb; font-size: 11.5px; pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cam-caption b { color: #fff; }

/* ── network */
.net-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
.net-map { position: sticky; top: calc(var(--topbar-h) + 12px); }
.net-map-wrap { padding: 0 12px 12px; }
.net-map-svg { width: 100%; height: auto; display: block; color: var(--text); }
.net-map-bg { fill: #0f1a16; }
[data-theme='light'] .net-map-bg { fill: #eef3f0; }
.net-sea { fill: #0e2a3a; opacity: 0.9; }
[data-theme='light'] .net-sea { fill: #cfe5f2; }
.net-sea-label { font-size: 10px; letter-spacing: 0.3em; fill: #5b8aa6; font-weight: 600; }
.net-river { fill: none; stroke: #2563eb; stroke-opacity: 0.35; stroke-width: 3; }
.net-road { fill: none; stroke: #94a3b8; stroke-opacity: 0.35; stroke-width: 2; stroke-dasharray: 6 5; }
.net-pin { cursor: pointer; outline: none; }
.net-pin-dot { fill: #006B43; stroke: #fff; stroke-width: 2.5; transition: r var(--dur) var(--ease); }
.net-pin:hover .net-pin-dot, .net-pin:focus .net-pin-dot { fill: #0a8a59; r: 18; }
.net-pin-glow { transition: r 600ms var(--ease); }
.net-pin-count { font-size: 12px; font-weight: 700; fill: #fff; pointer-events: none; font-variant-numeric: tabular-nums; }
.net-pin-name { font-size: 12px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; pointer-events: none; }
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.net-tile { overflow: hidden; cursor: pointer; position: relative; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.net-tile:hover, .net-tile:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.net-tile-stage { aspect-ratio: 16 / 10; background: radial-gradient(circle at 50% 40%, #16231e, #0b1210); position: relative; }
.net-tile-occ { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 18, 15, 0.75); color: #fff; font-size: 12px; }
.net-tile-occ b { font-size: 14px; }
.net-tile-b { padding: 10px 14px 12px; }
.net-tile-t { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.net-tile-stats { display: flex; gap: 12px; align-items: center; margin-top: 8px; color: var(--text-2); font-size: 12.5px; flex-wrap: wrap; }
.net-tile-stats > span { display: inline-flex; align-items: center; gap: 4px; }
.net-enter { margin-left: auto; color: var(--brand); font-weight: 600; }
[data-theme='dark'] .net-enter { color: #34d399; }
@media (max-width: 1100px) { .net-layout { grid-template-columns: minmax(0, 1fr); } .net-map { position: static; } }
@media (max-width: 600px) { .net-grid { grid-template-columns: minmax(0, 1fr); } }

/* ── video wall */
.wall-health { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.wall-health-main { display: inline-flex; align-items: center; gap: 8px; }
.wall-health-main b { font-size: 20px; }
.wall-health-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.wall-attn { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.wall-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.wall-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wall-tools .chip-row { flex-wrap: wrap; }
.wall-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wall-grid.c1 { grid-template-columns: minmax(0, 1fr); max-width: 1280px; }
.wall-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wall-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.wall-grid .empty { grid-column: 1 / -1; }
.wall-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
@media (max-width: 1000px) { .wall-grid.c4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .wall-grid.c3, .wall-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wall-attn { margin-left: 0; } }
@media (max-width: 480px) { .wall-grid.c2, .wall-grid.c3, .wall-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; } .wall-grid .cam-caption span { display: none; } }

.wall-single { position: fixed; inset: 0; z-index: 60; background: rgba(3, 7, 6, 0.94); color: #e8f0ec; display: flex; flex-direction: column; padding: 16px; gap: 12px; overflow-y: auto; }
.wall-single-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.wall-single-h h2 { font-size: 18px; }
.wall-single-h .subtle { color: #a7b6b0; }
.wall-single-h .btn { color: #e8f0ec; border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); }
.wall-single-b { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; min-height: 0; flex: 1; }
.wall-single-video { min-width: 0; }
.wall-single-video .cam-tile { border-radius: 12px; }
.wall-single-video .cam-tile:fullscreen { border-radius: 0; aspect-ratio: auto; }
.wall-single-side { background: #121b18; border: 1px solid #22312c; border-radius: 14px; padding: 12px 14px; overflow-y: auto; max-height: calc(100vh - 110px); }
.wall-single-side h4 { margin: 12px 0 6px; font-size: 13px; color: #a7b6b0; }
.wall-single-side .kv dt { color: #8a9a94; }
.wall-events { display: flex; flex-direction: column; gap: 6px; }
.wall-ev { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 10px; background: #17221e; font-size: 12.5px; }
.wall-ev .subtle { color: #8a9a94; font-size: 11.5px; }
.wall-ev .btn { color: #e8f0ec; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.15); }
@media (max-width: 900px) { .wall-single { padding: 10px; } .wall-single-b { grid-template-columns: minmax(0, 1fr); } .wall-single-side { max-height: none; } }

/* ── clip player */
.clip-modal { max-width: calc(100vw - 24px); }
.clip-wrap { display: flex; flex-direction: column; gap: 10px; }
.clip-tile { width: 100%; }
.clip-controls { display: flex; align-items: center; gap: 10px; }
.clip-scrub { flex: 1; accent-color: var(--brand); min-width: 0; height: 28px; }
.clip-time { min-width: 60px; text-align: right; font-weight: 600; }
.clip-jumps { display: flex; gap: 6px; flex-wrap: wrap; }
.clip-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.clip-notes { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) { .clip-meta { grid-template-columns: minmax(0, 1fr); } }
