/* NexSightS Retails — shared styles */
:root {
  --bg: #0a1524; --bg2: #0e1d31; --panel: #11243b; --panel2: #15304d; --line: #1f3b5c; --text: #e6f0fa; --muted: #8aa4c0;
  --teal: #19d3c5; --teal2: #0fb5a8; --orange: #f59e0b; --red: #ef4444; --green: #22c55e; --yellow: #eab308; --blue: #3b82f6; --grey: #64748b;
  --radius: 12px; --shadow: 0 8px 30px rgba(0,0,0,.25);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
code, .mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; }
pre { background: #071120; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .gap0 { gap: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2, .g4, .g6 { grid-template-columns: 1fr; } }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none !important; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: linear-gradient(135deg, var(--teal), var(--teal2)); color: #04201d; border-color: transparent; }
.btn.orange { background: var(--orange); color: #241500; border-color: transparent; }
.btn.danger { background: transparent; color: #ffb4b4; border-color: #6b2330; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; } .btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea { background: #0a1a2c; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; } .check input { width: auto; }

/* cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card .hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.card .hd h3 { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(25,211,197,.05); }
.tablewrap { overflow: auto; max-height: 70vh; }

/* status */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.6); } .dot.warn { background: var(--yellow); }
.dot.crit { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,.8); } .dot.unknown { background: var(--grey); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: #1d3550; color: var(--muted); }
.pill.ok, .pill.active, .pill.paid, .pill.resolved { background: rgba(34,197,94,.15); color: #6ee79b; }
.pill.warn, .pill.pending, .pill.ack, .pill.investigating, .pill.mitigated { background: rgba(234,179,8,.15); color: #facc15; }
.pill.crit, .pill.revoked, .pill.failed, .pill.suspended, .pill.expired, .pill.open { background: rgba(239,68,68,.15); color: #fca5a5; }
.pill.info { background: rgba(59,130,246,.15); color: #93c5fd; }
.blink { animation: blink 1s steps(2, start) infinite; } @keyframes blink { to { visibility: hidden; } }

/* KPI tiles */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.kpi .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: rgba(25,211,197,.12); color: var(--teal); flex: none; }
.kpi .ic.o { background: rgba(245,158,11,.14); color: var(--orange); } .kpi .ic.r { background: rgba(239,68,68,.14); color: var(--red); }
.kpi .v { font-size: 22px; font-weight: 800; white-space: nowrap; } .kpi .l { font-size: 12px; color: var(--muted); }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.s { width: 16px; height: 16px; }

/* app shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; font-weight: 800; font-size: 16px; color: var(--text); text-decoration: none !important; }
.brand img { width: 34px; height: 34px; } .brand small { display: block; font-size: 10.5px; font-weight: 600; color: var(--teal); letter-spacing: .05em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; text-decoration: none; font-size: 13.5px; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, rgba(25,211,197,.18), transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--teal); }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #5b7898; padding: 14px 10px 6px; font-weight: 800; }
.nav .num { margin-left: auto; font-size: 10.5px; background: #1d3550; border-radius: 6px; padding: 0 6px; color: var(--muted); }
.nav .num.bad { background: var(--red); color: #fff; }
.nav a.locked { opacity: .45; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: rgba(10,21,36,.85); position: sticky; top: 0; z-index: 500; backdrop-filter: blur(6px); }
.top h1 { font-size: 18px; margin: 0; }
.live { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.content { padding: 20px 22px 40px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { position: fixed; z-index: 1000; left: -260px; width: 250px; transition: left .2s; }
  .side.open { left: 0; } .menu-btn { display: inline-flex; }
}

/* map */
.map { height: 420px; border-radius: 10px; border: 1px solid var(--line); background: #0a1a2c; }
.map.tall { height: 620px; }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.mk { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(0,0,0,.25); }
.mk.ok { background: var(--green); } .mk.warn { background: var(--yellow); } .mk.crit { background: var(--red); animation: pulse 1.4s infinite; } .mk.unknown { background: var(--grey); }
.mk.hq { border-radius: 4px; } .mk.truck { width: 22px; height: 22px; border-radius: 6px; background: var(--blue); display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.7); } 70% { box-shadow: 0 0 0 14px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }

/* module cards */
.mod { position: relative; cursor: pointer; transition: border-color .15s; }
.mod:hover { border-color: var(--teal); }
.mod .n { position: absolute; top: -10px; left: -10px; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #241500; font-weight: 800; display: grid; place-items: center; border: 3px solid var(--bg); }
.mod .bar { display: flex; height: 6px; border-radius: 6px; overflow: hidden; background: #1d3550; margin-top: 10px; }
.mod .bar i { display: block; } .mod.locked { opacity: .55; }
.bar-ok { background: var(--green); } .bar-warn { background: var(--yellow); } .bar-crit { background: var(--red); } .bar-unknown { background: var(--grey); }
.meter { height: 8px; border-radius: 6px; background: #1d3550; overflow: hidden; min-width: 80px; } .meter i { display: block; height: 100%; background: var(--green); }
.meter i.w { background: var(--yellow); } .meter i.c { background: var(--red); }

/* camera grid */
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cam { background: #050c16; border: 1px solid var(--line); border-radius: 8px; aspect-ratio: 16/10; position: relative; overflow: hidden; display: flex; align-items: flex-end; }
.cam::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 2px, transparent 2px 4px), radial-gradient(circle at 30% 30%, #13304e, #050c16 70%); }
.cam.crit::before { background: repeating-linear-gradient(45deg, #1a0a0f 0 10px, #12060a 10px 20px); }
.cam .lbl { position: relative; padding: 6px 8px; font-size: 11px; width: 100%; background: linear-gradient(transparent, rgba(0,0,0,.8)); display: flex; gap: 6px; align-items: center; }
.cam .rec { position: absolute; top: 6px; right: 8px; font-size: 10px; color: #fca5a5; font-weight: 800; }

/* modal / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(2,8,16,.7); z-index: 2000; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(640px, 100%); max-height: 90vh; overflow: auto; padding: 20px; box-shadow: var(--shadow); }
.modal.wide { width: min(1000px, 100%); }
.modal .x { float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; background: none; border: 0; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: grid; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--teal); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--orange); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; text-decoration: none; cursor: pointer; }
.tabs a.on { color: var(--text); border-color: var(--teal); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.locked-box { text-align: center; padding: 50px 20px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline .it { position: relative; margin-bottom: 14px; }
.timeline .it::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; background: var(--teal); border-radius: 50%; }
.keybox { font-family: "JetBrains Mono", Consolas, monospace; font-size: 15px; letter-spacing: .05em; background: #071120; border: 1px dashed var(--teal); padding: 8px 12px; border-radius: 8px; display: inline-block; }
.banner { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.4); color: #fcd34d; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.chart { position: relative; height: 240px; } .chart.sm { height: 160px; }
#graph { height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #0a1a2c; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #13385a, var(--bg) 60%); }
.auth .card { width: min(420px, 100%); padding: 26px; }
.oauth { display: grid; gap: 8px; margin: 14px 0; }
.oauth .btn { justify-content: center; background: #fff; color: #111; border-color: #fff; }
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.err { color: #fca5a5; font-size: 13px; min-height: 18px; margin-top: 8px; }
