/* Cores do site infornetprovedor.com: azul-marinho (#002e7f / degradê #00276c→#00358c),
   vermelho #e52330 e o ciano do "N" da marca como destaque. */
/* Topo e barra de baixo em azul; o meio claro (branco), como as seções do site. */
:root {
  --bg: #ffffff; --panel: #ffffff; --panel2: #f1f6ff; --ink: #092c65; --muted: #526987;
  --cyan: #0a6fb0; --red: #e52330; --green: #15803d; --amber: #b45309; --line: #d8e4f3;
  --navy: #002e7f; --hero: linear-gradient(125deg, #00276c, #00358c);
  --shadow: 0 1px 3px #092c6512, 0 4px 14px #092c650d;
  --radius: 16px; --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #eef3fa; color: var(--ink);
  font: 15px/1.4 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

/* Moldura de celular: no computador fica uma coluna central, no celular ocupa a tela. */
.app { max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--bg); position: relative; }
@media (min-width: 520px) { .app { min-height: 100vh; box-shadow: 0 0 0 1px var(--line), 0 20px 60px #000a; } }

.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* Login */
.login { justify-content: center; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); gap: 28px; }
.login-brand { text-align: center; }
.login { background: var(--hero); }
.login-logo { width: min(260px, 75%); height: auto; display: block; margin: 0 auto; }
.login h1 { margin: 14px 0 4px; font-size: 24px; font-weight: 600; letter-spacing: .5px; color: var(--cyan); }
.login p { margin: 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form input { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none; }
.form input:focus { border-color: var(--cyan); }
.btn { border: 0; border-radius: 12px; padding: 14px; font-weight: 600; cursor: pointer; }
/* Botão principal como no site: azul-marinho no fundo claro (e branco no login azul). */
.btn.primary { background: var(--navy); color: #fff; }
.btn:disabled { opacity: .6; }
.erro { color: var(--red); margin: 0; min-height: 1.2em; font-size: 14px; }

/* Topo e abas */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--hero); border-bottom: 1px solid #ffffff1a; box-shadow: 0 6px 20px #0003; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .4px; }
.brand img { height: 30px; width: auto; display: block; }
.brand b { color: var(--cyan); font-weight: 600; padding-left: 10px; border-left: 1px solid #ffffff33; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; }
.content { flex: 1; padding: 12px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; gap: 12px; }
.section-head h2 { margin: 0; font-size: 22px; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--navy); border-top: 1px solid #ffffff1a; }
.tabbar button { border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 3px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tabbar button.on { color: var(--cyan); }

/* Ao vivo */
.cams { display: grid; gap: 14px; }
.cam { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cam-video { position: relative; aspect-ratio: 16/9; background: #000; cursor: pointer; }
.cam-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 12px; pointer-events: none; }
.live-badge { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 6px; background: #000a; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.cam-info { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; gap: 10px; }
.cam-info b { display: block; }
.cam-info small { color: var(--muted); }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--panel2); white-space: nowrap; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.on { color: var(--green); } .dot.off { color: var(--red); } .dot.wait { color: var(--amber); } .dot.cloud { color: var(--cyan); }

/* Eventos */
.date { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.chips button.on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.events { display: grid; gap: 10px; }
.event { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px; cursor: pointer; text-align: left; width: 100%; }
.event .thumb { width: 128px; aspect-ratio: 16/9; border-radius: 10px; background: #000 center/cover no-repeat; position: relative; }
.event .thumb span { position: absolute; right: 6px; bottom: 6px; background: #000b; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.event b { display: block; font-size: 16px; }
.event small { display: block; color: var(--muted); margin: 2px 0 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.hour { margin: 14px 2px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

/* Status */
.stack { display: grid; gap: 10px; margin-bottom: 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.row small { display: block; color: var(--muted); }
.meter { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--cyan); border-radius: 99px; }
.meter.warn i { background: var(--amber); } .meter.bad i { background: var(--red); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi small { color: var(--muted); display: block; font-size: 12px; }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* Administracao de cameras */
.tabbar { grid-template-columns: repeat(var(--tabs, 3), 1fr); }
.btn.small { padding: 8px 14px; font-size: 14px; }
/* Deteccao inteligente */
.opt { display: grid; grid-template-columns: 24px 32px 1fr; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.opt input { width: 22px; height: 22px; accent-color: var(--navy); margin: 0; }
.opt .ic { font-size: 24px; text-align: center; }
.opt b { display: block; font-size: 15px; } .opt small { display: block; }
.det-btn { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--ink); }
.cam-actions { display: flex; align-items: center; gap: 8px; }
/* Ativacao de cameras (atendimento): no computador a tela usa a largura toda */
#ativ.sheet { max-width: 1000px; }
@media (min-width: 1000px) { #ativ.sheet { box-shadow: 0 0 0 1px var(--line), 0 20px 60px #000a; } }
.cfg-body.wide { padding: 16px; }
.head-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.busca { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; background: var(--panel); color: var(--ink); }
.ativ-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ativ-info div { background: var(--panel2); border-radius: 10px; padding: 8px 10px; }
.ativ-info small { display: block; color: var(--muted); } .ativ-info b { font-size: 14px; word-break: break-all; }
.ativ-lista { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ativ-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.ativ-item.feito { opacity: .75; background: var(--panel2); }
.ativ-item label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.ativ-item input, .ativ-item select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 14px; background: var(--bg); color: var(--ink); width: 100%; min-width: 0; }
.ativ-item .dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ativ-item .marca-sel { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.ativ-item .marca-sel input { width: 20px; height: 20px; accent-color: var(--navy); }
.res { border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.res.ok { background: #15803d14; color: var(--green); } .res.bad { background: #e5233014; color: var(--red); }
details.regras summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details.regras table { width: 100%; font-size: 12px; border-collapse: collapse; margin-top: 6px; }
details.regras td { padding: 4px; border-bottom: 1px solid var(--line); }
/* Contrato do SGP */
.vinc { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.vinc input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; min-width: 0; }
.contrato { display: grid; gap: 4px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel2); }
.contrato.bloq { background: #e5233012; }
.contrato .btn { justify-self: start; }
.btn.ghost { background: var(--panel2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #ff4a5566; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form select { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; color: var(--ink); }
#form-nova { margin-bottom: 14px; }
.cam-row { display: grid; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.cam-row .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.cam-row small { color: var(--muted); display: block; }
.cam-row.bloq { opacity: .7; background: var(--panel2); }
#usr-lista { margin-top: 4px; }
.cam-row .acts { display: flex; gap: 8px; }
.cam-row .acts .btn { flex: 1; padding: 10px; font-size: 14px; }
.cfg-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); display: grid; gap: 14px; align-content: start; }
.field { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.field small { color: var(--muted); }
.field code { font: 13px/1.45 ui-monospace, Consolas, monospace; word-break: break-all; color: var(--cyan); background: var(--bg); padding: 10px; border-radius: 10px; user-select: all; }
.field .btn { padding: 10px; font-size: 14px; }
.tip { font-size: 13px; color: var(--muted); }
.tip table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tip td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tip td:first-child { color: var(--muted); } .tip td:last-child { color: var(--ink); font-weight: 600; text-align: right; }
.warn-box { border: 1px solid #f5b04155; background: #f5b04112; color: var(--amber); border-radius: 12px; padding: 10px 12px; font-size: 13px; }

/* Player em tela cheia */
.sheet { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
@media (orientation: landscape) and (max-height: 520px) { .sheet { max-width: none; } }
.sheet-bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--hero); }
.sheet-bar > div { flex: 1; min-width: 0; }
.sheet-bar small { display: block; }
.sheet-video { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: #000; }
/* O vídeo ocupa a área toda (retrato, paisagem e tela cheia); a imagem fica "contida" no centro. */
.sheet-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; transform-origin: center center; will-change: transform; }
.sheet:fullscreen { max-width: none; }
.sheet:-webkit-full-screen { max-width: none; }
/* Celular deitado (ou tela cheia): a imagem usa a tela inteira e a barra fica por cima; um toque mostra/esconde a barra. */
@media (orientation: landscape) and (max-height: 520px) {
  .sheet-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; background: linear-gradient(#000c, #0000); padding: 8px calc(12px + env(safe-area-inset-right)) 18px calc(12px + env(safe-area-inset-left)); transition: opacity .25s; }
}
.sheet:fullscreen .sheet-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; background: linear-gradient(#000c, #0000); transition: opacity .25s; }
.sheet.sem-barra .sheet-bar, .sheet.sem-barra .ctl { opacity: 0; pointer-events: none; }
/* Controles do player */
.ctl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px;
  padding: 18px calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: linear-gradient(#0000, #000c); color: #fff; transition: opacity .25s; touch-action: manipulation; }
.ctl-b { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px; background: #fff2; color: #fff; cursor: pointer; }
.ctl-b svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.ctl-t { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: #fffd; min-width: 34px; text-align: center; }
.ctl-barra { flex: 1; min-width: 0; height: 28px; accent-color: var(--cyan); touch-action: pan-x; }
.ctl-vivo { flex: 1; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #ff6b6b; }
.ctl.vivo .ctl-t, .ctl.vivo .ctl-barra, .ctl.vivo .ctl-vel { display: none; }
.ctl-vel { width: auto; min-width: 44px; padding: 0 10px; font: 700 13px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.ctl-vel.rapido { background: var(--cyan); color: #fff; }
.ctl:not(.vivo) .ctl-vivo { display: none; }
/* Com a barra por cima do vídeo, o indicador de zoom desce para não cobrir os botões. */
@media (orientation: landscape) and (max-height: 520px) { .zoom-info { top: 62px; right: calc(10px + env(safe-area-inset-right)); } }
.sheet:fullscreen .zoom-info { top: 62px; }
.zoom-info { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px;
  background: #000a; color: #fff; font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.zoom-info button { border: 0; border-radius: 999px; padding: 6px 12px; background: #fff2; color: #fff; font: inherit; cursor: pointer; }
.zoom-dica { position: absolute; bottom: calc(74px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 2; padding: 6px 12px; border-radius: 999px; background: #000a; color: #fffc; font-size: 12px; pointer-events: none; transition: opacity .4s; white-space: nowrap; }

/* ---- Regiões azuis (topo, barra de baixo, login e player) mantêm texto claro ---- */
.topbar, .tabbar { color: #fff; }
.topbar .icon-btn { background: #ffffff1f; color: #fff; }
.tabbar button { color: #a9bfe3; }
.tabbar button.on { color: #fff; }
.tabbar button.on svg { stroke: #fff; }
.login { --panel: #ffffff12; --panel2: #ffffff1a; --line: #ffffff2e; --bg: #001f57; --ink: #fff; --muted: #c3d3ee; color: #fff; }
.login h1 { color: #7fd6ee; }
.login .form input { background: #00174a; color: #fff; }
.login .btn.primary { background: #fff; color: var(--navy); }
.login .erro { color: #ff8a92; }
.sheet:not(.light) { color: #fff; }
.sheet-bar { color: #fff; }
.sheet-bar .icon-btn { background: #ffffff1f; color: #fff; }
.sheet-bar .muted { color: #c3d3ee; }
/* Cartões brancos sobre fundo branco: borda suave + sombra leve */
.card, .cam, .row, .kpi, .event, .cam-row, .field { box-shadow: var(--shadow); }
.live-badge, .event .thumb span { color: #fff; }
.field code { background: var(--panel2); }
.form input, .form select { background: #fff; }
.topbar .brand b { color: #7fd6ee; }

/* ---- Computador (tela larga): usa a tela toda ----
   Menu vira barra lateral, câmeras e eventos em grade, player grande. No celular nada muda. */
@media (min-width: 900px) {
  :root { --side: 220px; --topo: 60px; }
  .app { max-width: none; box-shadow: none !important; background: #f4f7fc; }
  .topbar { min-height: var(--topo); padding: 10px 24px; }
  .brand img { height: 34px; }
  .tabbar { top: var(--topo); bottom: 0; left: 0; transform: none; width: var(--side); max-width: none; height: auto; padding: 16px 12px;
    grid-template-columns: 1fr; grid-auto-rows: 48px; align-content: start; gap: 6px; border-top: 0; border-right: 1px solid #ffffff1a; }
  .tabbar button { grid-auto-flow: column; justify-content: start; gap: 12px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .tabbar button:hover { background: #ffffff14; color: #fff; }
  .tabbar button.on { background: #ffffff24; }
  .content { padding: 20px 32px 40px calc(var(--side) + 32px); }
  .content > .tab { max-width: 1600px; }
  .section-head h2 { font-size: 26px; }
  .cams { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
  .events { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
  .event { grid-template-columns: 176px 1fr; }
  .event .thumb { width: 176px; }
  .event:hover, .cam-video:hover { filter: brightness(1.04); }
  .stack { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
  #st-sistema.stack { max-width: 900px; }
  #tab-cameras .stack { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); align-items: start; }
  #form-nova { max-width: 560px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  /* Login centralizado */
  .login { align-items: center; }
  .login > * { width: 100%; max-width: 420px; }
  /* Player ocupa a janela; telas de configuração viram painel central */
  #sheet.sheet { max-width: none; }
  .sheet.light { max-width: 640px; box-shadow: 0 0 0 100vmax #0009; }
  #ativ.sheet { max-width: 1100px; }
  .zoom-dica { display: none; }
}
