:root {
    --navy: #07111e;
    --navy-2: #0c182b;
    --navy-3: #15263f;
    --bg: #eef2f8;
    --panel: #ffffff;
    --text: #122033;
    --muted: #6b7790;
    --border: #e1e7f2;
    --blue: #2563eb;
    --cyan: #22d3ee;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #f43f5e;
    --shadow: 0 10px 30px rgba(12, 28, 62, 0.07);
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.material-icons-round { font-size: 20px; line-height: 1; }

/* ===================== LOGIN ===================== */
.login-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 600px at 70% 10%, #1c3a6e 0%, var(--navy) 55%);
    overflow: hidden;
}
.login-bg-grid {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(700px 400px at 50% 40%, #000 30%, transparent 80%);
}
.login-card {
    position: relative; z-index: 2;
    width: 400px; max-width: 92vw;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 22px; padding: 36px 32px;
    box-shadow: 0 40px 90px rgba(0,0,0,.42);
    backdrop-filter: blur(18px);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-brand .brand-icon { font-size: 40px; color: var(--blue); }
.login-brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.login-brand p { font-size: 12px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #46506a; }
.login-form input {
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit; outline: none; transition: border .15s;
}
.login-form input:focus { border-color: var(--blue); }
.login-error { color: var(--red); font-size: 13px; font-weight: 600; }
.login-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===================== BUTTONS ===================== */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(180deg, #3b82f6 0%, var(--blue) 100%);
    color: #fff; border: none; border-radius: 11px;
    padding: 12px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: transform .15s, filter .15s, box-shadow .15s;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary.sm, .btn-ghost.sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    background: #eef1f6; color: #46506a; border: 1px solid var(--border);
    border-radius: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-ghost:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: none; color: var(--blue); font-weight: 600; cursor: pointer; font-size: 13px; font-family: inherit; }

/* ===================== SHELL ===================== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: 236px; flex-shrink: 0;
    background: linear-gradient(180deg, #0a1628 0%, var(--navy) 42%, #060d18 100%);
    color: #cdd6e6; display: flex; flex-direction: column;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 22px;
    font-size: 18px; font-weight: 800; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand .material-icons-round { color: var(--cyan); font-size: 26px; filter: drop-shadow(0 0 10px rgba(34,211,238,.45)); }
.side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 11px; border: none; background: none;
    color: #9fabc4; font-size: 14px; font-weight: 500; cursor: pointer;
    font-family: inherit; text-align: left; transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(37,99,235,.95), rgba(14,165,233,.85));
    color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.28);
}
.nav-item .material-icons-round { font-size: 20px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.backend-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9fabc4; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-offline { background: var(--muted); }
.dot-lite { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 26px; background: rgba(255,255,255,.86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}
.topbar-title h2 { font-size: 20px; font-weight: 700; }
.topbar-title p { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.search-box input { border: none; background: none; outline: none; font-family: inherit; font-size: 13px; width: 180px; }
.search-box .material-icons-round { color: var(--muted); font-size: 18px; }
.icon-btn { position: relative; background: none; border: none; color: #56617b; cursor: pointer; display: inline-flex; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg); }
.badge { position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #46506a; }
.user-chip > .material-icons-round { font-size: 26px; color: var(--muted); }

.view-wrap { flex: 1; overflow-y: auto; padding: 22px 26px; }
.view-wrap:has(#view-live.active) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.view { display: none; }
.view.active { display: block; }

/* ===================== PANELS / GRID ===================== */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; font-weight: 700; }
.panel-head h3 small { font-weight: 500; color: var(--muted); font-size: 11px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(12, 28, 62, 0.1); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.stat-icon .material-icons-round { font-size: 24px; }
.si-blue { background: var(--blue); } .si-amber { background: var(--amber); } .si-green { background: var(--green); } .si-red { background: var(--red); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; }
.analytics-grid { grid-template-columns: 1fr 1fr; }

/* Chart.js needs a sized parent when maintainAspectRatio=false;
   otherwise charts collapse to ~0px (especially when the view was hidden). */
.chart-box {
    position: relative;
    width: 100%;
    height: 220px;
    min-height: 220px;
}
.chart-box.tall { height: 320px; min-height: 320px; }
.chart-box.donut { height: 300px; min-height: 300px; }
.chart-box canvas { width: 100% !important; height: 100% !important; display: block; }

.event-type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.event-type-legend .etl-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.event-type-legend .etl-swatch {
    width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0;
}
.event-type-legend .etl-count {
    color: var(--muted); font-weight: 500;
}

/* Camera grid — 4 independent tiles (Camera | Upload | Stop) */
.camera-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cam-tile { position: relative; aspect-ratio: 16/10; background: radial-gradient(120% 90% at 50% 20%, #163056 0%, #070d16 70%); border-radius: 12px; overflow: hidden; }
.cam-tile img, .cam-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-tile .cam-video { position: absolute; inset: 0; z-index: 1; background: #070d16; display: none; }
.cam-tile .cam-video.on { display: block; }
.cam-tile .cam-overlay { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; display: none; }
.cam-tile .cam-label, .cam-tile .cam-live { z-index: 4; }
.cam-tile .cam-placeholder { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; place-content: center; color: #8b9bb4; text-align: center; gap: 6px; padding: 28px 12px 12px; }
.cam-tile .cam-placeholder.hidden { display: none; }
.cam-tile .cam-placeholder .material-icons-round { font-size: 32px; color: #4b6284; }
.cam-tile .cam-placeholder p { margin: 0; font-size: 12px; font-weight: 600; }
.cam-toolbar {
    position: absolute; left: 6px; right: 6px; top: 6px; z-index: 5;
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.cam-btn {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10px; font-weight: 700; font-family: inherit;
    padding: 4px 7px; border: 0; border-radius: 6px;
    background: rgba(8, 14, 24, .78); color: #e8eef8; cursor: pointer;
}
.cam-btn .material-icons-round { font-size: 13px; }
.cam-btn:hover { background: rgba(37, 99, 235, .9); }
.cam-btn:disabled { opacity: .38; cursor: not-allowed; }
.cam-btn-live { margin-left: auto; padding: 4px 6px; }
.cam-label { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.cam-live { position: absolute; right: 8px; bottom: 8px; top: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; display: flex; align-items: center; gap: 4px; }
.cam-live::before { content: ""; width: 6px; height: 6px; background: #fff; border-radius: 50%; }
.cam-live[hidden] { display: none !important; }

/* Alerts */
.alert-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.alert-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.alert-main { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 700; }
.alert-meta { font-size: 11px; color: var(--muted); }
.alert-sev { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.sev-high { background: #fde8e8; color: var(--red); } .sev-med { background: #fef3d7; color: #b6790a; } .sev-low { background: #e6f6ee; color: var(--green); }

/* Locations */
.loc-list { display: flex; flex-direction: column; gap: 10px; }
.loc-item { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.loc-item:last-child { border-bottom: none; }
.loc-bar { flex: 1; height: 6px; background: var(--bg); border-radius: 4px; margin: 0 12px; overflow: hidden; }
.loc-bar span { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

.pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: var(--bg); color: #56617b; }
.pill-red { background: #fde8e8; color: var(--red); }
.pill-green { background: #e6f6ee; color: var(--green); }
.pill-amber { background: #fef3d7; color: #b6790a; }

/* ===================== LIVE VIEW ===================== */
#view-live.view.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 132px);
}
#view-live.view.active .grid-live { flex: 1; min-height: 0; }
#view-live.view.active .grid-live > .live-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    height: 100%;
    max-height: calc(100vh - 148px);
}
.live-panel > .panel-head,
.live-panel > .capture-strip-wrap,
.live-panel > .live-file-meta { flex-shrink: 0; }
.grid-live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 460px); gap: 16px; align-items: stretch; }
.live-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-file-meta {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px; font-size: 13px; color: var(--muted);
}
.live-file-meta .material-icons-round { font-size: 18px; }
.live-file-meta[hidden] { display: none !important; }
#live-file-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

#btn-pose.pose-on {
    border-color: #22d3ee;
    color: #0e7490;
    background: #ecfeff;
}
#btn-faces.pose-on {
    border-color: #e879f9;
    color: #a21caf;
    background: #fdf4ff;
}
#btn-hands.pose-on {
    border-color: #fbbf24;
    color: #b45309;
    background: #fffbeb;
}
#btn-pose.pose-wait, #btn-faces.pose-wait, #btn-hands.pose-wait { opacity: .78; }
#btn-pose.pose-err, #btn-faces.pose-err, #btn-hands.pose-err { border-color: #f59e0b; color: #b6790a; background: #fff7ed; }
#live-hud-pose, #live-hud-face, #live-hud-hands {
    background: rgba(8,14,24,.55); padding: 4px 8px; border-radius: 8px;
    letter-spacing: .08em;
}
#live-hud-pose {
    border: 1px solid rgba(34,211,238,.45); color: #a5f3fc;
}
#live-hud-face {
    border: 1px solid rgba(232,121,249,.45); color: #f5d0fe;
}
#live-hud-hands {
    border: 1px solid rgba(251,191,36,.45); color: #fde68a;
}
#live-hud-pose.err, #live-hud-face.err, #live-hud-hands.err { border-color: rgba(245,158,11,.55); color: #fcd34d; }
#live-hud-pose[hidden], #live-hud-face[hidden], #live-hud-hands[hidden] { display: none !important; }
.live-mp-hint {
    flex: 1 0 100%;
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 500;
    color: #6b7790;
}

.live-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.82fr);
    gap: 12px;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 280px;
}
.live-stage {
    position: relative;
    height: 100%;
    min-height: 220px;
    background: radial-gradient(120% 90% at 50% 0%, #163056 0%, #070d16 62%);
    border-radius: 14px; overflow: hidden;
    border: 1px solid #1c2c44;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.live-stage video, .live-stage img, .live-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.live-stage video, .live-stage img { object-fit: contain; }
.live-stage canvas { z-index: 2; pointer-events: auto; cursor: crosshair; }
#backend-stream { display: none; }
.live-hud {
    position: absolute; left: 10px; right: 10px; top: 10px; z-index: 4;
    display: flex; align-items: center; gap: 10px;
    pointer-events: none;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; font-weight: 600; color: #e8eef8;
    text-shadow: 0 1px 8px rgba(0,0,0,.55);
}
.hud-rec {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(8,14,24,.62); border: 1px solid rgba(255,255,255,.12);
    padding: 4px 8px; border-radius: 999px; letter-spacing: .08em;
}
.hud-rec.live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red);
    box-shadow: 0 0 8px var(--red); animation: recPulse 1.1s ease-in-out infinite;
}
.hud-rec.live { color: #fecaca; border-color: rgba(244,63,94,.45); }
@keyframes recPulse { 50% { opacity: .35; } }
#live-hud-clock, #live-hud-count {
    background: rgba(8,14,24,.55); padding: 4px 8px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,.08); margin-left: auto;
}
#live-hud-clock { margin-left: auto; }
#live-hud-count { margin-left: 0; }
.person-tooltip {
    position: absolute; z-index: 5; max-width: 250px; padding: 8px 10px;
    font-size: 12px; line-height: 1.4; color: #eaf0f8;
    background: rgba(10,18,32,.94); border: 1px solid #3b82f6;
    border-left-width: 4px; border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0,0,0,.35); pointer-events: none;
}
.det-list .det-item { cursor: pointer; }
.live-placeholder .material-icons-round { font-size: 48px; color: #4f6586; }
.live-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - 148px);
    position: sticky;
    top: 0;
}
.live-detect-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 2px;
}

.zoom-pane {
    display: flex; flex-direction: column; gap: 10px;
    background: linear-gradient(180deg, #101929 0%, #0b1220 100%);
    border: 1px solid #1e2c44; border-radius: 14px; padding: 12px;
    color: #d7e0ef; min-height: 0;
}
.zoom-pane.danger { box-shadow: 0 0 0 1px rgba(244,63,94,.45), 0 12px 30px rgba(244,63,94,.12); }
.zoom-pane-head, .capture-strip-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.zoom-pane-title { display: flex; align-items: center; gap: 8px; }
.zoom-pane-title h4 { font-size: 13px; font-weight: 700; color: #fff; }
.zoom-pane-title .material-icons-round { color: var(--cyan); font-size: 18px; }
.zoom-pane-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.zoom-pane .btn-primary.sm { padding: 6px 10px; font-size: 12px; box-shadow: none; }
#zoom-lock-pill { cursor: pointer; border: none; font-family: inherit; }
.zoom-stage {
    position: relative; flex: 1; min-height: 210px; aspect-ratio: 4/3;
    background: #050a12; border-radius: 10px; overflow: hidden;
    border: 1px solid #1a2740;
}
.zoom-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.zoom-empty {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    color: #6d7d97; text-align: center; padding: 16px; z-index: 2;
    background: #050a12;
}
.zoom-empty .material-icons-round { font-size: 36px; color: #3d516e; }
.zoom-empty p { font-size: 12px; line-height: 1.4; max-width: 180px; }
.zoom-empty.hidden { display: none !important; }
.zoom-reticle {
    position: absolute; inset: 14%; pointer-events: none; z-index: 3;
    border: 1px solid rgba(34,211,238,.18); border-radius: 8px;
}
.zoom-reticle::before, .zoom-reticle::after {
    content: ""; position: absolute; background: rgba(34,211,238,.35);
}
.zoom-reticle::before { left: 50%; top: 8%; bottom: 8%; width: 1px; transform: translateX(-50%); }
.zoom-reticle::after { top: 50%; left: 8%; right: 8%; height: 1px; transform: translateY(-50%); }
.zoom-meta { min-height: 42px; }
#zoom-label { font-size: 14px; font-weight: 700; color: #fff; text-transform: capitalize; }
#zoom-conf { font-size: 12px; color: #8b9bb5; margin-top: 2px; }
#zoom-face { font-size: 12px; color: #c7d2e5; margin-top: 4px; line-height: 1.4; }

.capture-strip-wrap { margin-top: 14px; }
.capture-strip-wrap h4 { font-size: 13px; font-weight: 700; }
.capture-strip-title, .capture-strip-head .zoom-pane-title { color: var(--text); }
.capture-strip-head .material-icons-round { color: var(--blue); }
.capture-strip-actions { display: flex; align-items: center; gap: 12px; }
.capture-strip {
    display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px;
    scrollbar-width: thin;
}
.capture-strip .empty { flex: 1; }
.capture-thumb {
    flex: 0 0 132px; width: 132px; border: none; padding: 0; cursor: pointer;
    background: #0c1522; border-radius: 10px; overflow: hidden;
    text-align: left; font-family: inherit; color: #fff;
    box-shadow: 0 8px 18px rgba(12, 28, 62, 0.12);
    transition: transform .15s;
}
.capture-thumb:hover { transform: translateY(-2px); }
.capture-thumb img { width: 100%; height: 84px; object-fit: cover; display: block; background: #070d16; }
.capture-thumb span {
    display: block; padding: 7px 8px 8px; font-size: 11px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: #122033;
}
.capture-thumb.danger span { background: #3f1220; color: #fecaca; }
.capture-thumb.face span { background: #2a1533; color: #f5d0fe; }

.inspect-modal {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; background: rgba(6, 10, 18, .72);
    backdrop-filter: blur(10px);
}
.inspect-card {
    position: relative; width: min(760px, 94vw);
    background: #0c1522; border: 1px solid #24344f; border-radius: 18px;
    overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.inspect-close {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 36px; height: 36px; border: none; border-radius: 10px;
    background: rgba(8,14,24,.7); color: #fff; cursor: pointer;
    display: grid; place-items: center;
}
.inspect-card img { width: 100%; max-height: 68vh; object-fit: contain; display: block; background: #05080f; }
.inspect-meta { padding: 14px 16px 16px; color: #d7e0ef; }
.inspect-meta h3 { font-size: 16px; text-transform: capitalize; }
.inspect-meta p { font-size: 13px; color: #8b9bb5; margin-top: 4px; }

.threat-panel { text-align: center; }
.gauge { margin: 6px 0 12px; }
.gauge-value { font-size: 44px; font-weight: 800; line-height: 1; }
.gauge-label { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--green); }
.gauge-bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.gauge-bar-fill { height: 100%; width: 0%; background: var(--green); border-radius: 6px; transition: width .4s, background .4s; }

.det-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.det-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--bg);
    cursor: pointer; border: 1px solid transparent; transition: border-color .15s, transform .12s;
}
.det-item:hover { border-color: #c9d6ee; }
.det-item.focused { border-color: var(--blue); background: #e8efff; }
.det-item .conf { font-weight: 700; color: var(--blue); font-size: 12px; }
.det-item.danger { background: #fde8e8; }
.det-item.danger .conf { color: var(--red); }
.det-item.danger.focused { border-color: var(--red); }
.action-box { font-size: 15px; font-weight: 700; padding: 12px; border-radius: 8px; background: var(--bg); text-align: center; }
.action-box.danger { background: #fde8e8; color: var(--red); }
.assess-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.assess-item { padding: 8px 10px; border-radius: 8px; background: var(--bg); border-left: 4px solid #16b364; }
.assess-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.assess-level { font-weight: 800; font-size: 12px; letter-spacing: .03em; }
.assess-pct { font-weight: 700; font-size: 12px; color: var(--muted); }
.assess-text { font-size: 12.5px; line-height: 1.45; color: #26324a; overflow-wrap: anywhere; white-space: normal; }
.assess-face { font-size: 12px; line-height: 1.4; color: #3b4a66; margin-top: 6px; }
.scene-box { font-size: 13px; line-height: 1.5; color: #26324a; padding: 4px 2px; min-height: 44px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }

.chat-panel {
    flex: 0 0 280px;
    height: 280px;
    min-height: 240px;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    margin-top: 12px;
}
.chat-panel.is-collapsed {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    max-height: none;
}
.chat-panel.is-collapsed .chat-history { display: none; }
.chat-panel.is-collapsed #chat-collapse .material-icons-round { transform: rotate(180deg); }
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#chat-collapse { flex-shrink: 0; }
.chat-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.chat-title h3 { margin: 0; font-size: 15px; }
.chat-title-text { min-width: 0; }
.chat-title-sub {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-title-icon,
.chat-avatar,
.chat-empty-mascot {
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    background: #0a1628;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, .22);
}
.chat-title-icon {
    width: 32px; height: 32px; border-radius: 50%; padding: 3px;
}
.chat-avatar {
    width: 28px; height: 28px; border-radius: 50%; padding: 3px; margin-top: 2px;
}
.chat-history {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 14px 12px;
    background: #f6f8fc;
    max-height: none;
}
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin: 0;
    padding: 8px 8px 4px;
    text-align: center;
    max-width: none;
}
.chat-empty-mascot {
    width: 40px; height: 40px; border-radius: 12px; padding: 4px;
}
.chat-empty-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.chat-empty-text {
    font-size: 12px; line-height: 1.4; color: var(--muted);
    max-width: 420px; margin: 0;
}
.chat-row.user { display: flex; justify-content: flex-end; width: 100%; }
.chat-row.bot {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}
.chat-row.bot .chat-msg.bot { max-width: none; flex: 1; min-width: 0; }
.chat-msg {
    font-size: 14px; line-height: 1.6;
    padding: 10px 14px; border-radius: 16px;
    overflow-wrap: anywhere; word-break: normal;
    white-space: pre-wrap;
}
.chat-msg.bot {
    background: transparent;
    color: #1b2436;
    border: none;
    padding: 2px 0 0;
    border-radius: 0;
}
.chat-msg.bot p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.bot p:last-child { margin-bottom: 0; }
.chat-msg.user {
    max-width: 86%;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 18px 18px 6px 18px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .18);
}
.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 8px 12px 10px;
    border-top: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}
.chat-form textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 160px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: none;
    overflow-y: auto;
}
.chat-form textarea:focus { outline: 2px solid rgba(59, 130, 246, .35); border-color: #3b82f6; }
#chat-send { flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 10px; border-radius: 12px; }
#chat-send .material-icons-round { font-size: 18px; }
.chat-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}
.chat-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: #46506a;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(12, 28, 62, .04);
}
.chat-chip:hover { border-color: #c9d6ee; background: #e8efff; color: #1d4ed8; }

/* Tables / misc */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.placeholder-panel { text-align: center; padding: 60px 20px; color: var(--muted); }
.placeholder-panel .material-icons-round { font-size: 54px; color: var(--border); }
.placeholder-panel h3 { margin: 12px 0 6px; color: var(--text); }

.twin-layout {
    display: grid; grid-template-columns: minmax(0, 1.7fr) 280px; gap: 16px; align-items: stretch;
    min-height: calc(100vh - 140px);
}
.twin-stage { display: flex; flex-direction: column; overflow: hidden; padding: 12px; }
.twin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.twin-hint { color: var(--muted); font-size: 12px; }
.twin-toolbar #twin-reset { margin-left: auto; }
.twin-cover-meta { color: var(--text) !important; font-size: 13px !important; margin: 8px 0 0 !important; }
.twin-canvas {
    flex: 1; min-height: 420px; border-radius: 12px; overflow: hidden;
    background: #070d16; border: 1px solid #1c2c44; position: relative;
}
.twin-canvas canvas { display: block; width: 100%; height: 100%; }
.twin-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.twin-side { display: flex; flex-direction: column; gap: 12px; }
.twin-detail h4 { margin: 4px 0 6px; }
.twin-detail p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.twin-detail-id { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 700; color: var(--blue); }
.twin-detail-note { margin: 10px 0 12px !important; font-size: 12px !important; }
.twin-detail .btn-primary { margin-top: 4px; }
/* Reports */
.report-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13px; background: #fff; color: var(--text); }
.report-meta { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
.report-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.report-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.report-card .rc-value { font-size: 26px; font-weight: 800; color: var(--text); }
.report-card .rc-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.report-card.rc-high { border-left: 3px solid #ef4444; }
.report-card.rc-med { border-left: 3px solid #f59e0b; }
.report-card.rc-low { border-left: 3px solid #16b364; }

.settings-form { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.settings-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.settings-form input[type=text], .settings-form input[type=password] { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }
.settings-form input[type=file] { font-size: 13px; }
.watch-form { max-width: 560px; }
.watch-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0 20px 16px; }
.watch-list { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 20px; }
.watch-card {
    display: flex; align-items: center; gap: 12px;
    border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg);
}
.watch-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #dbe3f0; }
.watch-thumb-empty { width: 56px; height: 56px; border-radius: 8px; background: #dbe3f0; }
.watch-meta { flex: 1; min-width: 0; }
.watch-name { font-size: 14px; font-weight: 700; }
.watch-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===================== ONBOARDING ===================== */
.onboard-overlay {
    position: fixed; inset: 0; z-index: 120;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; background: rgba(6, 10, 18, .78);
    backdrop-filter: blur(12px);
}
.onboard-card {
    position: relative; width: min(460px, 94vw);
    background: linear-gradient(180deg, #122033 0%, #0c1522 100%);
    border: 1px solid #24344f; border-radius: 20px;
    padding: 28px 28px 22px;
    box-shadow: 0 36px 90px rgba(0, 0, 0, .55);
    color: #d7e0ef;
}
.onboard-mascot {
    width: 64px; height: 64px; border-radius: 16px; padding: 6px;
    object-fit: contain; background: #0a1628;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, .28), 0 8px 22px rgba(34, 211, 238, .12);
    display: block; margin-bottom: 16px;
}
.onboard-kicker {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #67e8f9; margin-bottom: 8px;
}
.onboard-kicker .material-icons-round { font-size: 16px; }
.onboard-card h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
.onboard-card p.onboard-body {
    margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: #9fb0c9;
}
.onboard-dots { display: flex; gap: 7px; margin: 22px 0 16px; }
.onboard-dot {
    width: 8px; height: 8px; border-radius: 99px; border: none;
    background: #2a3b55; padding: 0; cursor: pointer;
    transition: width .15s, background .15s;
}
.onboard-dot.active { width: 22px; background: #22d3ee; }
.onboard-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; color: #8b9bb5;
    cursor: pointer; user-select: none; margin-bottom: 16px;
}
.onboard-check input { accent-color: #22d3ee; }
.onboard-actions { display: flex; justify-content: space-between; gap: 10px; }
.onboard-actions .btn-ghost {
    background: #15263f; color: #cdd6e6; border-color: #24344f;
}
.login-hint a { color: #9db4e8; font-weight: 600; text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }

/* ===================== LANDING ===================== */
html.lp-html,
html.lp-html body.lp-body {
    background:
        radial-gradient(980px 520px at 78% 6%, rgba(124, 58, 237, .42), transparent 58%),
        radial-gradient(780px 460px at 6% 16%, rgba(37, 99, 235, .32), transparent 55%),
        #070b16;
    color: #eef2ff;
}
.lp-body {
    min-height: 100%;
    position: relative;
    overflow-x: hidden;
}
.lp-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(7, 11, 22, .35) 0%, rgba(7, 11, 22, .82) 70%, #070b16 100%),
        url("img/landing-cctv.jpg?v=3") center 28% / cover no-repeat;
    opacity: .28;
    filter: blur(18px) saturate(1.15);
}
.lp-glow {
    position: fixed; pointer-events: none; border-radius: 50%;
    filter: blur(80px); z-index: 0;
}
.lp-glow-a { width: 560px; height: 560px; background: rgba(124, 58, 237, .38); top: -140px; right: 4%; }
.lp-glow-b { width: 460px; height: 460px; background: rgba(37, 99, 235, .3); top: 60px; left: -100px; }
.lp-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 6vw; position: sticky; top: 0; z-index: 8; gap: 16px;
    background: rgba(7, 11, 22, .72); backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.lp-brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 18px; color: #fff; text-decoration: none;
}
.lp-brand .material-icons-round { color: #7dd3fc; font-size: 26px; }
.lp-menu { display: flex; align-items: center; gap: 22px; }
.lp-menu a { color: #b7c3d9; text-decoration: none; font-weight: 500; font-size: 14px; }
.lp-menu a:hover { color: #fff; }
.lp-nav-actions { display: flex; align-items: center; gap: 14px; }
.lp-text-link { color: #dbe4f5; text-decoration: none; font-weight: 600; font-size: 14px; }
.lp-btn {
    display: inline-flex; align-items: center; gap: 8px;
    border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 14px;
    text-decoration: none; font-family: inherit; border: none; cursor: pointer;
}
.lp-btn-grad {
    color: #fff;
    background: linear-gradient(90deg, #7c3aed 0%, #2563eb 100%);
    box-shadow: 0 10px 28px rgba(91, 33, 182, .35);
}
.lp-btn-lg { padding: 14px 20px; font-size: 15px; }
.lp-btn-ghost {
    color: #e8eefc; background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.14);
}
.lp-btn .material-icons-round { font-size: 18px; }
.lp-hero {
    display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
    gap: 40px; padding: 56px 6vw 36px; align-items: center; position: relative; z-index: 1;
}
.lp-pill {
    display: inline-flex; padding: 6px 12px; border-radius: 999px;
    background: rgba(124, 58, 237, .12); border: 1px solid rgba(167, 139, 250, .35);
    color: #c4b5fd; font-size: 11px; font-weight: 700; letter-spacing: .08em;
}
.lp-hero h1 {
    font-size: clamp(34px, 4.2vw, 56px); line-height: 1.08;
    letter-spacing: -.04em; margin: 16px 0 16px; font-weight: 800;
}
.lp-hero h1 em {
    font-style: normal;
    background: linear-gradient(90deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-lead { color: #9aa8c2; font-size: 16px; line-height: 1.65; max-width: 540px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.lp-trust { margin-top: 34px; }
.lp-trust p { color: #7d8ba6; font-size: 12px; margin-bottom: 12px; }
.lp-logos { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; color: #6b7a94; font-weight: 800; letter-spacing: .08em; font-size: 13px; }
.lp-logo-mark { font-style: italic; font-weight: 600; letter-spacing: 0; text-transform: lowercase; }

.lp-preview {
    background: rgba(12, 18, 34, .78);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 22px; padding: 14px;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
    backdrop-filter: blur(16px);
}
.lp-preview-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 6px 12px; color: #fff;
}
.lp-preview-head strong { font-size: 14px; margin-right: 10px; }
.lp-live-dot {
    display: inline-flex; align-items: center; gap: 6px;
    color: #fb7185; font-size: 12px; font-weight: 700;
}
.lp-live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.lp-cam-select {
    background: rgba(255,255,255,.05); color: #cdd6ea; border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 4px;
    font-family: inherit; font-size: 12px; font-weight: 600;
}
.lp-cam-select .material-icons-round { font-size: 16px; }
.lp-preview-body { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 12px; }
.lp-metrics { display: flex; flex-direction: column; gap: 10px; }
.lp-metric {
    display: flex; gap: 8px; align-items: flex-start;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
    border-radius: 14px; padding: 10px;
}
.lp-metric-ico {
    width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.lp-metric-ico .material-icons-round { font-size: 16px; }
.mi-red { background: #e11d48; } .mi-green { background: #10b981; } .mi-blue { background: #2563eb; }
.lp-metric small { display: block; color: #8b98b3; font-size: 10px; }
.lp-metric b { display: block; font-size: 18px; line-height: 1.2; }
.lp-metric b span { color: #7d8ba6; font-size: 12px; font-weight: 600; }
.lp-metric em { display: block; font-style: normal; color: #64748b; font-size: 10px; }
.lp-feed { min-width: 0; }
.lp-scene {
    position: relative; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden;
    background: #0b1020;
}
.lp-scene-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: fill; display: block;
}
.lp-scene::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(7,11,22,.08) 0%, transparent 40%, rgba(7,11,22,.22) 100%);
}
.lp-timeline { padding: 10px 4px 2px; }
.lp-tl-track { position: relative; height: 10px; background: #1b2438; border-radius: 99px; }
.lp-tl-track i { position: absolute; top: 1px; width: 8px; height: 8px; border-radius: 50%; }
.lp-tl-track i.t-high, .lp-tl-legend span.t-high { background: #ef4444; }
.lp-tl-track i.t-med, .lp-tl-legend span.t-med { background: #f59e0b; }
.lp-tl-track i.t-low, .lp-tl-legend span.t-low { background: #22c55e; }
.lp-tl-track i.t-info, .lp-tl-legend span.t-info { background: #3b82f6; }
.lp-tl-times { display: flex; justify-content: space-between; color: #7d8ba6; font-size: 10px; margin-top: 6px; }
.lp-tl-legend { display: flex; align-items: center; gap: 10px; color: #8b98b3; font-size: 11px; margin-top: 8px; }
.lp-tl-legend span { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lp-tl-legend a { margin-left: auto; color: #93c5fd; text-decoration: none; font-weight: 600; }

.lp-section { padding: 48px 6vw 56px; position: relative; z-index: 1; }
.lp-section h2 { font-size: 32px; margin-bottom: 22px; }
.lp-section h2 em {
    font-style: normal;
    background: linear-gradient(90deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-section-alt { background: rgba(10, 16, 32, .65); }
.lp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.lp-feat {
    background: rgba(16, 22, 40, .8); border: 1px solid rgba(255,255,255,.07);
    border-radius: 18px; padding: 22px; min-height: 210px;
    display: flex; flex-direction: column;
}
.lp-feat-ico {
    width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
    display: grid; place-items: center; color: #c4b5fd;
    background: rgba(124, 58, 237, .15); border: 1px solid rgba(167, 139, 250, .2);
}
.lp-feat h3 { margin-bottom: 8px; font-size: 18px; }
.lp-feat p { color: #9aa8c2; font-size: 14px; line-height: 1.5; flex: 1; }
.lp-feat a {
    margin-top: 14px; color: #93c5fd; text-decoration: none; font-weight: 700; font-size: 13px;
    display: inline-flex; align-items: center; gap: 4px;
}
.lp-feat a .material-icons-round { font-size: 16px; }
.lp-steps { margin: 0 0 24px; padding-left: 18px; color: #c5d0e2; line-height: 1.9; }
.lp-foot {
    padding: 22px 6vw; border-top: 1px solid rgba(255,255,255,.06);
    display: flex; justify-content: space-between; color: #8b9bb5;
}
.lp-foot a { color: #93c5fd; text-decoration: none; font-weight: 600; }

@media (max-width: 1100px) {
    .grid-2, .grid-3, .grid-live, .live-workspace, .lp-hero, .lp-grid, .lp-preview-body, .twin-layout { grid-template-columns: 1fr; }
    .lp-menu { display: none; }
    .chart-box.tall { height: 280px; }
    .stat-row, .report-cards { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 68px; }
    .brand-text, .nav-item span:not(.material-icons-round), .backend-status span:last-child { display: none; }
    .zoom-stage { min-height: 240px; }
    .view-wrap:has(#view-live.active) { overflow-y: auto; }
    #view-live.view.active { min-height: 0; }
    #view-live.view.active .grid-live { flex: none; }
    #view-live.view.active .grid-live > .live-panel {
        height: auto;
        max-height: none;
        overflow: visible;
    }
    .live-side { height: auto; max-height: none; position: static; }
    .live-workspace { flex: 0 0 auto; min-height: 0; }
    .live-stage { height: auto; aspect-ratio: 16 / 9; }
    .chat-panel {
        flex: 0 0 240px;
        height: 240px;
        min-height: 240px;
        max-height: 280px;
    }
    .live-detect-pane { max-height: none; }
}

.corr-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 160px; color: var(--muted); text-align: center; padding: 18px;
    border: 1px dashed var(--border); border-radius: 12px; margin-bottom: 14px;
}
.corr-empty .material-icons-round { font-size: 36px; color: #93a4c0; }
.corr-empty p { max-width: 360px; font-size: 13px; line-height: 1.5; }
.corr-drop {
    display: inline-flex; align-items: center; gap: 8px;
    background: #eef1f6; color: #46506a; border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.corr-drop input { display: none; }
.corr-img { width: 100%; margin-top: 14px; border-radius: 12px; background: #0c182b; }
.corr-error {
    margin-top: 12px; color: var(--red); font-size: 13px; font-weight: 600;
}
.corr-actions { display: flex; gap: 8px; }
.corr-report {
    white-space: pre-wrap; font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px; line-height: 1.55; color: #24324a; background: #f6f8fc;
    border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-height: 120px;
}
.corr-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.corr-fields label, .corr-asset label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #46506a; }
.corr-fields input, .corr-note input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-weight: 500; }
.corr-note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.corr-asset { margin-bottom: 16px; }
#corr-ai-line { margin-top: 0; margin-bottom: 10px; color: var(--text); font-weight: 600; }
#corr-trend { white-space: pre-wrap; }
@media (max-width: 1100px) { .corr-fields { grid-template-columns: 1fr; } }
