:root{
  --bg:#020617;
  --panel:#071225;
  --panel2:#081a33;
  --border:#1e293b;
  --txt:#e5e7eb;
  --muted:#94a3b8;
  --primary:#38bdf8;
  --green:#22c55e;
  --red:#ef4444;
  --shadow: 0 0 0 1px rgba(56,189,248,.06);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(56,189,248,.08), transparent 60%),
              radial-gradient(1000px 800px at 80% 10%, rgba(34,197,94,.06), transparent 55%),
              var(--bg);
  color:var(--txt);
}
a{color:inherit;text-decoration:none}
.container{max-width:980px;margin:0 auto;padding:18px}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 18px;border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(8,26,51,.75), rgba(2,6,23,.6));
  position:sticky;top:0;backdrop-filter: blur(10px); z-index:20;
}
.brand{display:flex;gap:10px;align-items:center}
.brand b{font-size:22px}
.brand small{display:block;color:var(--muted);margin-top:2px}
.nav{display:flex;gap:10px;align-items:center;}
.nav a{
  padding:10px 12px;border:1px solid var(--border);border-radius:10px;
  background: rgba(7,18,37,.6);
}
.nav a.active{border-color:rgba(56,189,248,.5); box-shadow: var(--shadow);}
.card{
  background: linear-gradient(180deg, rgba(7,18,37,.85), rgba(2,6,23,.78));
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  margin-top:14px;
  box-shadow: var(--shadow);
}
h2,h3{margin:0 0 10px 0}
.muted{color:var(--muted);font-size:13px}
.row{display:flex;gap:12px;flex-wrap:wrap}
.col{flex:1;min-width:240px}
label{display:block;margin-top:10px;font-size:13px;color:#cbd5f5}
input, select{
  width:100%;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(2,6,23,.75);
  color:var(--txt);
  outline:none;
}
input:focus, select:focus{border-color:rgba(56,189,248,.7);}
.btnbar{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
button{
  padding:11px 14px;border-radius:12px;border:0;cursor:pointer;font-weight:700;
}
.btn{background:var(--primary);color:#01101a}
.btn2{background:rgba(7,18,37,.9);border:1px solid var(--border);color:var(--primary)}
.btng{background:var(--green);color:#02110a}
.btnr{background:var(--red);color:#fff}
.list{margin-top:10px}
.item{
  padding:12px;
  border:1px solid rgba(30,41,59,.9);
  border-radius:14px;
  background: rgba(2,6,23,.6);
  margin-top:10px;
}
.item:hover{border-color:rgba(56,189,248,.5)}
.item .top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.badge{
  font-size:12px;color:var(--muted);
  padding:6px 10px;border-radius:999px;border:1px solid var(--border);
  background: rgba(7,18,37,.7);
}
.code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;font-size:12px;word-break:break-all;color:#cbd5f5}
hr{border:0;border-top:1px solid rgba(30,41,59,.7);margin:12px 0}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:50;
  padding:18px;
}
.modal{
  width:min(560px, 100%);
  background: linear-gradient(180deg, rgba(7,18,37,.97), rgba(2,6,23,.92));
  border:1px solid rgba(56,189,248,.25);
  border-radius:18px;
  padding:16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.modal .header{display:flex;align-items:center;justify-content:space-between}
.modal .header b{font-size:16px}
.x{
  background:transparent;border:1px solid var(--border);
  color:var(--muted);border-radius:10px;padding:8px 10px;
}
.x:hover{border-color:rgba(56,189,248,.5);color:#e5e7eb}

.toast{
  position:fixed;right:18px;bottom:18px;
  background: rgba(7,18,37,.92);
  border:1px solid rgba(56,189,248,.25);
  border-radius:14px;padding:12px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  display:none; z-index:60;
}

@media (max-width:520px){
  .topbar{flex-direction:column;align-items:flex-start;gap:10px}
  .nav{width:100%}
  .nav a{flex:1;text-align:center}
}
video{
  width:100%;
  margin-top:12px;
  border-radius:14px;
  background:#000;
  box-shadow: 0 0 0 1px rgba(56,189,248,.15);
}


.camera-view {
  max-width: 980px;
  margin: auto;
}

.video-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

video {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.video-status {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(0,0,0,.6);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.dot.offline { background:#ff4d4f }
.dot.online { background:#4cd964 }

.video-actions {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #0b1220;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.tab {
  padding: 6px 14px;
  border-radius: 20px;
  background: #111a2c;
  cursor: pointer;
}
.tab.active {
  background: #1f6bff;
}

.tab-content { display:none }
.tab-content.active { display:block }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
  gap: 10px;
}

.filter-actions {
  display:flex;
  gap:10px;
  margin:12px 0;
}

.record-list {
  display:grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap:12px;
}

.record-list video {
  border-radius:12px;
}

.timeline {
  margin: 10px 0;
  font-size: 13px;
  opacity:.85;
}

.hint {
  font-size: 13px;
  opacity: .7;
}



.camera-view {
  max-width: 980px;
  margin: auto;
}

.video-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

video {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.video-status {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(0,0,0,.6);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.dot.offline { background:#ff4d4f }
.dot.online { background:#4cd964 }

.video-actions {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #0b1220;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.tab {
  padding: 6px 14px;
  border-radius: 20px;
  background: #111a2c;
  cursor: pointer;
}
.tab.active {
  background: #1f6bff;
}

.tab-content { display:none }
.tab-content.active { display:block }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
  gap: 10px;
}

.filter-actions {
  display:flex;
  gap:10px;
  margin:12px 0;
}

.record-list {
  display:grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap:12px;
}

.record-list video {
  border-radius:12px;
}

.timeline {
  margin: 10px 0;
  font-size: 13px;
  opacity:.85;
}

.hint {
  font-size: 13px;
  opacity: .7;
}








/* =========================
   FILTER FAB
========================= */
.filter-fab {
  position: fixed;
  right: 18px;
  bottom: 24px;
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  z-index: 50;
}

/* =========================
   FILTER PANEL
========================= */
.filter-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -100%;
  background: #0b1220;
  border-radius: 18px 18px 0 0;
  padding: 16px;
  box-shadow: 0 -20px 50px rgba(0,0,0,.6);
  transition: bottom .25s ease;
  z-index: 60;
}

.filter-panel.open {
  bottom: 0;
}

.fp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.fp-head button {
  background: none;
  border: none;
  color: #aaa;
  font-size: 18px;
}

/* GRID */
.fp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fp-group {
  display: flex;
  flex-direction: column;
}

.fp-group.full {
  grid-column: span 2;
}

.fp-group label {
  font-size: 12px;
  color: #9fb6ff;
  margin-bottom: 4px;
}

.fp-group input,
.fp-group select {
  background: #111a33;
  border: 1px solid #1e2a55;
  border-radius: 10px;
  padding: 10px;
  color: #fff;
}

/* ACTIONS */
.fp-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}



.offline-overlay{
  position:absolute;
  inset:0;
  background:rgba(5,10,20,.85);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:30;
}
.offline-overlay.hidden{display:none}
.offline-box{text-align:center;color:#fff}
.offline-box .dot{
  display:inline-block;
  width:10px;height:10px;
  background:red;border-radius:50%;
  animation:blink 1s infinite;
}
@keyframes blink{50%{opacity:.3}}


/* ================= ICON BAR ================= */
.icon-bar{
  display:flex;
  flex-direction:column;      /* um abaixo do outro */
  align-items:flex-end;
  gap:8px;
  margin-top:-40px;           /* sobe para alinhar com o título */
  float:right;
}

/* ================= ICON BUTTON ================= */
.icon-btn{
  width:38px;
  height:38px;
  border-radius:10px;
  background:#081321;
  border:1px solid rgba(255,255,255,.08);
  color:#fff;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:.2s;
  text-decoration:none;
}

.icon-btn:hover{
  background:#1f6fff;
  box-shadow:0 6px 16px rgba(31,111,255,.35);
}

.icon-bar{
  position:absolute;
  top:46px;
  right:18px;
}
.card{
  position:relative;
}



/* ===== PROGRESS ===== */
.progress{
  width:100%;
  height:6px;
  border-radius:6px;
  background:rgba(255,255,255,.08);
  overflow:hidden;
  margin:10px 0;
}
.progress .bar{
  height:100%;
  width:0%;
  background:#1f6fff;
  animation:scan 1.2s infinite;
}
@keyframes scan{
  0%{ width:0 }
  50%{ width:80% }
  100%{ width:0 }
}
.hidden{ display:none; }


.btn-rec.active{
  background:#ff4d4d!important;
  box-shadow:0 0 0 6px rgba(255,77,77,.25);
}

.badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  margin-top:4px;
  background:#081321;
  border:1px solid rgba(255,255,255,.08);
}
.badge.person{ color:#2ecc71; }
.badge.motion{ color:#3498db; }
.badge.manual{ color:#9b59b6; }
.badge.plate { color:#f39c12; }


/* ===== Globoseg Auth pills ===== */
.gs-user-pill{
  opacity:.9;
  cursor:default;
}
.gs-logout-btn{
  cursor:pointer;
}
.gs-logout-btn:hover{
  filter:brightness(1.1);
}



/* ================= LOGIN PAGE ================= */
body.login-page{
  min-height:100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, #0b2a55 0%, transparent 60%),
    linear-gradient(180deg, #050b16, #081321);
}

/* desativa container padrão só no login */
body.login-page .container{
  padding-top:40px;
}

/* centralização correta */
.login-wrap{
  max-width:420px;
  margin:80px auto;
}

/* card */
.login-card{
  background:rgba(7,18,37,.75);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:22px;
  box-shadow:0 25px 80px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
}

.login-card h2{
  margin:0 0 6px;
}

.login-row{
  display:grid;
  gap:12px;
  margin-top:16px;
}

.login-actions{
  display:flex;
  gap:10px;
  margin-top:18px;
}

.login-actions .btn{
  flex:1;
}

.err{
  color:#ff7b7b;
  display:none;
  margin-top:12px;
}
.ok{
  color:#6cff9a;
  display:none;
  margin-top:12px;
}

/* mobile */
@media (max-width:480px){
  .login-wrap{
    margin:50px 16px;
  }
}



/* =========================
   MOBILE MENU – PADRÃO GLOBOSEG (FIX)
========================= */

.menu-toggle{
  display:none;
  width:42px;
  height:42px;
  border-radius:12px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}

.topbar{
  position:relative;
  z-index:999;
}

/* overlay opcional */
.nav-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  z-index:998;
}

@media (max-width:768px){
  .menu-toggle{ display:flex; }

  /* 🔥 SOBRESCREVE O styles.css */
  .topbar{
    flex-direction:row !important;
    align-items:center !important;
  }

  .nav{
    position:absolute;
    top:64px;
    right:14px;

    width:auto !important;
    min-width:220px;

    display:none;
    flex-direction:column;
    align-items:stretch;
    gap:10px;

    padding:12px;
    background:rgba(7,18,37,.96);
    border:1px solid rgba(255,255,255,.10);
    border-radius:14px;
    box-shadow:0 18px 45px rgba(0,0,0,.55);
    backdrop-filter: blur(10px);

    z-index:1000;
  }

  .nav.open{
    display:flex;
  }

  /* 🔥 LINKS COMO BOTÕES (NÃO CENTRALIZAR MENU) */
  .nav a{
    flex:none !important;
    width:100%;
    text-align:left !important;

    padding:12px 14px;
    border-radius:12px;

    background:rgba(255,255,255,.04);
    border:1px solid rgba(255,255,255,.08);
  }

  .nav a:hover{
    background:rgba(255,255,255,.08);
  }

  .nav-overlay.open{
    display:block;
  }
}











/* ===============================
   CAM ACTIONS – ÍCONES ONLY
   =============================== */

.cam-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
  flex-wrap:wrap;
}

/* botão base */
.cam-btn{
  width:46px;
  height:46px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(7,18,37,.6);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:.18s ease;
}

/* svg padrão */
.cam-btn svg{
  width:22px;
  height:22px;
  fill:#e5e7eb;
  transition:.18s ease;
}

/* hover */
.cam-btn:hover{
  background:rgba(12,30,60,.85);
  transform:translateY(-1px);
}

.cam-btn:hover svg{
  fill:#38bdf8;
}

/* ===============================
   ÍCONES ESPECÍFICOS
   =============================== */

/* ao vivo */
.icon-live svg{
  fill:#22c55e;
}

/* parar */
.icon-stop svg{
  fill:#ef4444;
}

/* foto */
.icon-photo svg{
  fill:#e5e7eb;
}

/* gravação */
.icon-record svg{
  fill:#ff4d4d;
}

/* gravação ativa */
.btn-rec.active{
  background:#ff4d4d !important;
  box-shadow:0 0 0 6px rgba(255,77,77,.25);
  border-color:#ff4d4d;
}

.btn-rec.active svg{
  fill:#fff;
}

/* ===============================
   MOBILE – estilo APP (iCSee-like)
   =============================== */
@media(max-width:768px){
  .cam-actions{
    justify-content:space-between;
  }

  .cam-btn{
    width:48px;
    height:48px;
  }
}


/* ===============================
   PAGER – SETAS HORIZONTAIS
   =============================== */
/* ===============================
   PAGER – COMPACTO
   =============================== */
.pager{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;              /* 👈 mais próximo */
  margin-top:10px;
}

/* texto central mais enxuto */
.pager #pageInfo{
  min-width:auto;       /* remove espaçamento forçado */
  padding:0 4px;
}

/* botões menores */
.pager .btn2{
  width:36px;
  height:34px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
}



/* =========================
   BOTÃO VOLTAR (GLOBAL)
========================= */
.btn-back{
  background:rgba(255,255,255,.08);
  color:#fff;
  border:none;
  padding:8px 14px;
  border-radius:12px;
  cursor:pointer;
  font-size:14px;
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}

.btn-back:hover{
  background:rgba(255,255,255,.15);
}

/* MOBILE: garante visível */
@media(max-width:768px){
  .btn-back{
    font-size:13px;
    padding:7px 12px;
  }

  /* evita sumir com regras antigas */
  .cam-nav{
    display:flex !important;
  }
}


/* =====================
   HEADER CÂMERAS
===================== */
.cams-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:20px;
}

.btn-add-cam{
  background:#2563eb;
  color:#fff;
  padding:10px 14px;
  border-radius:10px;
  text-decoration:none;
  font-weight:500;
}
.btn-add-cam:hover{
  background:#1d4ed8;
}

/* =====================
   GRID
===================== */
.cams-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:18px;
}

/* =====================
   ITEM
===================== */
.cam-item{
  background:#0b1220;
  border-radius:18px;
  padding:12px;
  border:1px solid rgba(255,255,255,.06);
}

/* CARD CLICÁVEL */
.cam-card{
  cursor:pointer;
}

.cam-thumb{
  aspect-ratio:16/9;
  border-radius:14px;
  overflow:hidden;
  background:#020617;
}

.cam-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.cam-thumb img.no-preview{
  opacity:.25;
}

.cam-name{
  text-align:center;
  margin-top:8px;
  font-weight:600;
}

/* =====================
   AÇÕES
===================== */
.cam-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

.btn-action{
  flex:1;
  padding:8px;
  border-radius:10px;
  border:none;
  cursor:pointer;
  font-size:14px;
}

.btn-action.primary{
  background:#0ea5e9;
  color:#fff;
}

.btn-action.danger{
  background:#1f2933;
  color:#f87171;
}

.btn-action.danger:hover{
  background:#7f1d1d;
}

/* =====================
   MOBILE
===================== */
@media (max-width:768px){
  .cams-header{
    flex-direction:column;
    align-items:stretch;
  }

  .btn-add-cam{
    text-align:center;
  }
}

/* BOTÃO WHATSAPP – MAIOR */


/* ÍCONE SVG MAIOR */
.btn-wa svg{
  width:18px;          /* antes: 18px */
  height:18px;
}

/* HOVER */
.btn-wa:hover{
  transform:scale(1.08);
  filter:brightness(1.1);
}

/* MOBILE – ainda maior para o dedo */
@media (max-width:480px){
 /* BOTÃO WHATSAPP */
/* BOTÃO WHATSAPP */
.btn-wa{
  width:42px;
  height:42px;
  border:none;
  border-radius:50%;
  background:transparent; /* 🔥 remove quadrado branco */
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}


 /* SVG */
.btn-wa svg{
  width:30px;
  height:30px;
  display:block;
}

/* cores via CSS (melhor prática) */
.btn-wa .wa-bg{
  fill:#25D366;   /* verde WhatsApp */
}

.btn-wa .wa-icon{
  fill:#ffffff;   /* símbolo branco */
}

}


/* ================= TOOLTIP EVENTO ================= */
.ev-tooltip{
  position:absolute;
  left:0;
  top:100%;
  margin-top:6px;
  background:#081321;
  border:1px solid rgba(255,255,255,.12);
  padding:8px 10px;
  border-radius:10px;
  font-size:12px;
  line-height:1.4;
  white-space:nowrap;
  opacity:0;
  transform:translateY(4px);
  pointer-events:none;
  transition:.15s;
  z-index:20;
  box-shadow:0 12px 30px rgba(0,0,0,.45);
}

.rec-item:hover .ev-tooltip{
  opacity:1;
  transform:translateY(0);
}

.ev-tooltip b{
  font-weight:600;
}

.ev-in{ color:#2ecc71; }
.ev-out{ color:#ff7675; }
.ev-loc{ opacity:.85; }
