/* IACam — painel da central. Marca iTake (vermelho), claro/escuro pelo sistema. */
:root {
  --marca: #e30613;
  --marca-escura: #b8050f;
  --fundo: #f6f6f4;
  --superficie: #ffffff;
  --superficie-2: #f1f1ee;
  --borda: #e3e3df;
  --texto: #1c1c1a;
  --texto-2: #55554f;
  --mudo: #85857d;
  --link: #b8050f;
  --ok: #0c8a0c;
  --ok-fundo: #e7f6e7;
  --erro: #b42323;
  --erro-fundo: #fdeaea;
  --aviso: #8a5a00;
  --aviso-fundo: #fff4d6;
  --info-fundo: #eaf2fe;
  --sombra: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --raio: 10px;
  --n0: #64748b; --n1: #3b82f6; --n2: #fab219; --n3: #ec835a; --n4: #d03b3b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #131312;
    --superficie: #1c1c1b;
    --superficie-2: #252523;
    --borda: #34342f;
    --texto: #ececea;
    --texto-2: #b9b9b2;
    --mudo: #8c8c84;
    --link: #ff6b73;
    --ok: #4cc94c;
    --ok-fundo: #16301a;
    --erro: #ff7b7b;
    --erro-fundo: #3a1818;
    --aviso: #f3c35a;
    --aviso-fundo: #372b10;
    --info-fundo: #16243a;
    --sombra: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fundo); color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .4rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: .86em; }
pre { background: var(--superficie-2); border: 1px solid var(--borda); padding: .7rem; border-radius: 8px;
      overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* ---------------------------------------------------------------- topo */
.topo { background: var(--marca); color: #fff; position: sticky; top: 0; z-index: 20; }
.topo-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 1rem;
           padding: .55rem 16px; flex-wrap: wrap; }
.marca { color: #fff; font-weight: 800; letter-spacing: .2px; font-size: 1.05rem; display: flex;
         align-items: center; gap: .45rem; white-space: nowrap; }
.marca:hover { text-decoration: none; }
.marca .ponto { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; align-items: center; flex: 1; }
.nav a { color: #fff; padding: .35rem .6rem; border-radius: 7px; font-size: .93rem; opacity: .92; white-space: nowrap; }
.nav a:hover, .nav a.ativo { background: rgba(255,255,255,.18); text-decoration: none; opacity: 1; }
.nav .dir { margin-left: auto; }
.contador { display: inline-block; min-width: 1.35em; padding: 0 .35em; border-radius: 99px; background: #fff;
            color: var(--marca-escura); font-size: .75rem; font-weight: 700; text-align: center; margin-left: .25rem; }

/* -------------------------------------------------------------- layout */
.container { max-width: 1280px; margin: 0 auto; padding: 18px 16px 48px; }
.estreito { max-width: 440px; }
.cabecalho { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
             margin-bottom: 1rem; }
.cabecalho p { margin: 0; color: var(--texto-2); }
.grade { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.lado { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .lado { grid-template-columns: 1fr; } }
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
        box-shadow: var(--sombra); padding: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.linha { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.linha.fim { justify-content: flex-end; }
.entre { justify-content: space-between; }
.mt { margin-top: 1rem; } .mt2 { margin-top: .5rem; } .mb0 { margin-bottom: 0; }
.mudo { color: var(--mudo); } .pequeno { font-size: .85rem; } .centro { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--borda); margin: 1rem 0; }

/* --------------------------------------------------------- stat tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px 16px;
       box-shadow: var(--sombra); color: var(--texto); display: block; }
.kpi:hover { text-decoration: none; border-color: var(--mudo); }
.kpi .rotulo { font-size: .82rem; color: var(--texto-2); }
.kpi .valor { font-size: 2rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .nota { font-size: .8rem; color: var(--mudo); }
.kpi.destaque { border-left: 4px solid var(--marca); }

/* ------------------------------------------------------------- tabelas */
.tabela-wrap { overflow-x: auto; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--borda); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-2); background: var(--superficie-2);
     white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--superficie-2); }
td.acoes { white-space: nowrap; text-align: right; }
td textarea { min-width: 240px; }
.miniatura { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--superficie-2);
             display: block; }

/* -------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 99px;
         font-size: .8rem; font-weight: 600; border: 1px solid var(--borda); background: var(--superficie-2);
         color: var(--texto); white-space: nowrap; }
.badge .bolinha, .bolinha { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; flex: none; }
.nivel-0 .bolinha { background: var(--n0); } .nivel-1 .bolinha { background: var(--n1); }
.nivel-2 .bolinha { background: var(--n2); } .nivel-3 .bolinha { background: var(--n3); }
.nivel-4 .bolinha { background: var(--n4); }
.nivel-3, .nivel-4 { border-color: currentColor; }
.nivel-4 { color: var(--erro); }
.rev-pendente { background: var(--aviso-fundo); color: var(--aviso); border-color: transparent; }
.rev-sem_irregularidade { background: var(--ok-fundo); color: var(--ok); border-color: transparent; }
.rev-irregularidade_confirmada { background: var(--erro-fundo); color: var(--erro); border-color: transparent; }
.rev-inconclusiva, .rev-arquivada_auto { color: var(--texto-2); }
.on { color: var(--ok); } .off { color: var(--erro); }
.status-on .bolinha { background: var(--ok); } .status-off .bolinha { background: var(--erro); }
.chip { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 6px; background: var(--superficie-2);
        border: 1px solid var(--borda); color: var(--texto-2); margin: .1rem .15rem .1rem 0; }

/* ------------------------------------------------------------- banners */
.banner { padding: .7rem .9rem; border-radius: 8px; margin: 0 0 1rem; background: var(--info-fundo); border: 1px solid var(--borda); }
.banner.ok { background: var(--ok-fundo); color: var(--ok); border-color: transparent; }
.banner.erro { background: var(--erro-fundo); color: var(--erro); border-color: transparent; }
.banner.aviso { background: var(--aviso-fundo); color: var(--aviso); border-color: transparent; }
.aviso-etico { border-left: 4px solid var(--marca); background: var(--superficie); padding: .7rem .9rem; border-radius: 8px;
               border-top: 1px solid var(--borda); border-right: 1px solid var(--borda); border-bottom: 1px solid var(--borda);
               font-size: .92rem; color: var(--texto-2); margin-bottom: 1rem; }

/* ------------------------------------------------------------- forms */
label { display: block; font-size: .88rem; color: var(--texto-2); margin: .6rem 0 .2rem; font-weight: 600; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; color: var(--texto); }
input, select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--borda); border-radius: 8px; font: inherit;
  background: var(--superficie); color: var(--texto); }
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--marca) 45%, transparent); border-color: var(--marca); }
textarea { min-height: 80px; resize: vertical; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.ajuda { font-size: .8rem; color: var(--mudo); font-weight: 400; margin-top: .15rem; }
fieldset { border: 1px solid var(--borda); border-radius: 8px; padding: .4rem .9rem .9rem; margin: .8rem 0; }
legend { font-weight: 700; font-size: .92rem; padding: 0 .3rem; }
.olho-wrap { position: relative; display: block; }
.olho-wrap input { padding-right: 2.4rem; }
.olho-btn { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); background: none; border: 0;
            color: var(--mudo); cursor: pointer; padding: .2rem; display: flex; }

/* ------------------------------------------------------------- botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem;
       border-radius: 8px; border: 1px solid var(--marca); background: var(--marca); color: #fff; font: inherit;
       font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--marca-escura); text-decoration: none; }
.btn.sec { background: var(--superficie); color: var(--texto); border-color: var(--borda); }
.btn.sec:hover { background: var(--superficie-2); }
.btn.perigo { background: var(--superficie); color: var(--erro); border-color: var(--erro); }
.btn.pequeno { padding: .28rem .6rem; font-size: .84rem; }
.btn-bloco { width: 100%; margin-top: 1rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
form.inline { display: inline; }

/* ------------------------------------------------------------- abas */
.abas { display: flex; gap: .2rem; border-bottom: 1px solid var(--borda); margin: .5rem 0 1rem; overflow-x: auto; }
.abas a { padding: .5rem .8rem; color: var(--texto-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.abas a.ativa { color: var(--texto); border-bottom-color: var(--marca); font-weight: 600; }
.abas a:hover { text-decoration: none; color: var(--texto); }

/* ---------------------------------------------------------- linha do tempo */
.tempo { list-style: none; margin: 0; padding: 0; }
.tempo li { display: grid; grid-template-columns: 70px 22px 1fr; gap: .4rem; padding: .35rem 0;
            border-bottom: 1px dashed var(--borda); font-size: .92rem; }
.tempo li:last-child { border-bottom: 0; }
.tempo .h { color: var(--mudo); font-variant-numeric: tabular-nums; font-size: .82rem; padding-top: .1rem; }
.tempo .ic { text-align: center; }
.tempo .res { font-size: .75rem; margin-left: .3rem; }
.res-ok { color: var(--ok); } .res-falha { color: var(--erro); font-weight: 700; } .res-ignorado { color: var(--aviso); }
.res-simulado { color: var(--texto-2); }

/* --------------------------------------------------------------- mídia */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.galeria figure { margin: 0; }
.galeria img, .galeria video { width: 100%; border-radius: 8px; background: #000; display: block; }
.galeria figcaption { font-size: .8rem; color: var(--mudo); margin-top: .2rem; }
video { max-width: 100%; }

/* ------------------------------------------------------------ ao vivo */
.ao-vivo { position: relative; background: #000; border-radius: 8px; aspect-ratio: 16 / 9; overflow: hidden;
           display: flex; align-items: center; justify-content: center; color: #bbb; font-size: .9rem; }
.ao-vivo img { width: 100%; height: 100%; object-fit: contain; }
.ao-vivo .selo { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem;
                 padding: .1rem .45rem; border-radius: 5px; }

/* ------------------------------------------------------------ zonas */
.editor-zonas { position: relative; width: 100%; background: #111; border-radius: 8px; overflow: hidden; user-select: none; }
.editor-zonas img { width: 100%; display: block; opacity: .95; }
.editor-zonas canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.lista-zonas { list-style: none; padding: 0; margin: .5rem 0 0; }
.lista-zonas li { display: grid; grid-template-columns: 14px 1fr 170px auto; gap: .5rem; align-items: center;
                  padding: .3rem 0; border-bottom: 1px solid var(--borda); }
@media (max-width: 600px) { .lista-zonas li { grid-template-columns: 14px 1fr; } }
.cor-zona { width: 14px; height: 14px; border-radius: 3px; }

/* ------------------------------------------------------- escalonamento */
.degrau { border: 1px solid var(--borda); border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; background: var(--superficie-2); }
.degrau .cab { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-weight: 700; }
.degrau .acao-linha { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.degrau select, .degrau input { width: auto; min-width: 120px; }

/* ------------------------------------------------------------- toast */
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 50; background: #222; color: #fff;
         padding: .6rem 1rem; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: .92rem;
         max-width: calc(100% - 32px); display: none; }
#toast.erro { background: var(--erro); }

/* ------------------------------------------------------------- login */
.login-cab { text-align: center; margin: 2.2rem 0 1rem; }
.login-cab .selo { display: inline-flex; width: 56px; height: 56px; border-radius: 14px; background: var(--marca);
                   color: #fff; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.login-cab h1 { margin: .7rem 0 .1rem; }
.codigo-input { font-size: 1.6rem; letter-spacing: .5rem; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .container { padding: 14px 16px 40px; }
  .kpi .valor { font-size: 1.6rem; }
  th, td { padding: .45rem .5rem; }
  .esconder-celular { display: none; }
}
