/* AI analytics pages - same restrained system as the core app (see app.blade.php :root). */
.nav-group { font-size: 11px; font-weight: 600; color: #57534e; padding: 16px 10px 5px; letter-spacing: .02em; }
.nav-item .nav-badge { margin-left: auto; background: #b91c1c; color: #fff; border-radius: 3px; font-size: 11px; font-weight: 600; padding: 0 5px; line-height: 17px; }
.nav-item .nav-badge:empty { display: none; }

.an-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.an-filters select, .an-filters input { padding: 6px 9px; border: 1px solid #d6d3d1; border-radius: 5px; background: #fff; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid #d6d3d1; border-radius: 5px; overflow: hidden; background: #fff; }
.seg button { background: none; padding: 5px 11px; font-size: 12.5px; font-weight: 500; color: var(--text-2); border-right: 1px solid #e7e5e4; }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--text); color: #fff; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi { padding: 13px 16px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 0 -1px -1px 0; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .label::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--kc, #a8a29e); flex: none; }
.kpi .value { font-size: 22px; font-weight: 600; margin-top: 3px; letter-spacing: -.02em; }
.kpi .value small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 1px; }

.an-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; margin-bottom: 12px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
@media (max-width: 1100px) { .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; } }
.card .card-body { padding: 12px 16px; }
.card .card-body > div[style*="overflow-x"] { margin: -12px -16px; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

/* charts */
.chart { width: 100%; display: block; }
.chart text { font-size: 10.5px; fill: #78716c; font-family: inherit; }
.chart .grid { stroke: #f0efee; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 1px; margin-right: 6px; vertical-align: 0; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 44px; gap: 10px; align-items: center; font-size: 12.5px; margin: 5px 0; }
.hbar .track { background: #f5f5f4; border-radius: 1px; height: 8px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 1px; }
.hbar .num { text-align: right; color: var(--text); font-weight: 500; }
.hbar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap .legend { flex-direction: column; margin: 0; gap: 5px; }

.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 10px; color: #78716c; }
.heat .c { aspect-ratio: 1.4; border-radius: 1px; background: #f5f5f4; }
.heat .rl { display: flex; align-items: center; }
.heat .hl { text-align: center; }
.matrix td, .matrix th { text-align: center; padding: 7px 10px; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .cell { display: inline-block; min-width: 38px; padding: 2px 6px; border-radius: 2px; font-weight: 500; }

/* severity / status: marker + text, no candy pills */
.sev, .st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; text-transform: capitalize; color: var(--text-2); white-space: nowrap; }
.sev::before, .st::before { content: ""; width: 7px; height: 7px; flex: none; }
.sev::before { border-radius: 1px; }
.st::before { border-radius: 50%; }
.sev.low::before { background: #a8a29e; } .sev.medium::before { background: #d39b2c; }
.sev.high::before { background: #c2571a; } .sev.critical::before { background: #b91c1c; }
.sev.critical, .sev.high { color: var(--text); font-weight: 600; }
.st.open::before { background: #b91c1c; } .st.acknowledged::before, .st.in_progress::before { background: #d39b2c; }
.st.resolved::before, .st.closed::before { background: #3f8f5a; } .st.false_positive::before { background: #d6d3d1; }
.hs { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 12.5px; text-transform: capitalize; }
.hs::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d6d3d1; }
.hs.ok::before { background: #3f8f5a; } .hs.degraded::before { background: #d39b2c; } .hs.offline::before { background: #b91c1c; }
.tag-demo { font-size: 10.5px; font-weight: 500; color: #78716c; border: 1px solid #d6d3d1; padding: 0 4px; border-radius: 3px; margin-left: 6px; vertical-align: 1px; letter-spacing: .02em; }
.plate { font-family: var(--mono); font-weight: 600; letter-spacing: .05em; background: #fff; border: 1px solid #a8a29e; color: var(--text); padding: 0 6px; border-radius: 2px; font-size: 12px; }
.wl { font-size: 11.5px; font-weight: 500; padding: 0 5px; border-radius: 2px; margin-left: 4px; border: 1px solid; white-space: nowrap; }
.wl.blacklist { color: #991b1b; border-color: #fecaca; background: #fef2f2; } .wl.vip { color: #44403c; border-color: #d6d3d1; } .wl.whitelist { color: #166534; border-color: #bbf7d0; }
.ev-row { cursor: pointer; }
.muted-sm { font-size: 12px; color: var(--muted); }
.notice { padding: 9px 12px; border-radius: 5px; font-size: 13px; background: var(--panel); color: var(--text-2); border: 1px solid var(--line); border-left: 3px solid #a8a29e; margin-bottom: 12px; }
.notice.warn { border-left-color: #d39b2c; background: #fffdf7; }
.notice code { font-family: var(--mono); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 1px 7px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); }
.chip.off { color: #a8a29e; text-decoration: line-through; }

/* site scores */
.score-list { display: grid; gap: 0; }
.score-row { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.score-row:last-child { border-bottom: none; }
.score-ring { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px;
    background: conic-gradient(var(--sc) calc(var(--pct) * 1%), #f0efee 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 4px; background: #fff; border-radius: 50%; }
.score-ring span { position: relative; z-index: 1; }

/* event modal */
.ev-snap { width: 100%; border-radius: 4px; background: #0c0a09; min-height: 160px; object-fit: contain; max-height: 52vh; display: block; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13px; margin-top: 14px; }
.kv dt { color: var(--muted); } .kv dd { color: var(--text); }

/* bays */
.bays { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.bay { border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; border-top: 3px solid #3f8f5a; }
.bay.on { border-top-color: #d39b2c; }
.bay.over { border-top-color: #b91c1c; }
.bay b { display: block; font-size: 13px; font-weight: 600; } .bay .muted-sm { margin-top: 2px; }

/* video wall */
.wall { display: grid; gap: 3px; background: #000; padding: 3px; border-radius: 4px; }
.wall.full { position: fixed; inset: 0; z-index: 60; border-radius: 0; padding: 2px; gap: 2px; }
.wall-tile { position: relative; background: #0c0a09; overflow: hidden; aspect-ratio: 16/9; }
.wall.full .wall-tile { aspect-ratio: auto; }
.wall-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 11.5px; color: #e7e5e4; background: rgba(12,10,9,.75); display: flex; justify-content: space-between; gap: 8px; }
.wall-tile .nosrc { position: absolute; inset: 0; display: grid; place-items: center; color: #57534e; font-size: 12px; text-align: center; padding: 10px; }
.wall-tile.alert { outline: 2px solid #dc2626; outline-offset: -2px; }
.wall-tile .alert-cap { position: absolute; top: 0; left: 0; right: 0; background: #b91c1c; color: #fff; font-size: 12px; font-weight: 600; padding: 4px 8px; }
.wall-exit { position: fixed; top: 10px; right: 12px; z-index: 61; }

/* rule editor */
.zone-editor { position: relative; background: #0c0a09; border-radius: 4px; overflow: hidden; aspect-ratio: 16/9; user-select: none; }
.zone-editor img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.zone-editor canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.zone-editor .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #78716c; font-size: 12.5px;
    background-image: linear-gradient(#1c1917 1px, transparent 1px), linear-gradient(90deg, #1c1917 1px, transparent 1px); background-size: 10% 10%; }
.rule-card { border-bottom: 1px solid var(--line-2); padding: 11px 0; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.rule-card:last-child { border-bottom: none; }
.rule-card.off { opacity: .5; }
.switch { position: relative; width: 32px; height: 18px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d6d3d1; border-radius: 999px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--text); }
.switch input:checked + span::before { transform: translateX(14px); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.search-grid label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.search-grid input, .search-grid select { width: 100%; padding: 6px 8px; border: 1px solid #d6d3d1; border-radius: 5px; font-size: 13px; background: #fff; }
.thumb { width: 64px; height: 36px; object-fit: cover; border-radius: 2px; background: #f0efee; display: block; }

@media (max-width: 720px) {
    .nav-group { width: 100%; padding: 8px 4px 2px; }
    .kv { grid-template-columns: 1fr; }
}
